Search found 12 matches

by Sailor
Fri Feb 03, 2023 7:45 pm
Forum: Emulation and Simulation
Topic: 6502 Emulation of ADC in C
Replies: 18
Views: 12280

Re: 6502 Emulation of ADC in C

@Gordon , your code is great as usual ,
I've already read a lot about overflow flag , and how to test it and got the following facts :

1. it occurs when adding two signed numbers with similar sign , resulting in a number different in sign .
2. it occurs when (carry in) bit different than (carry ...
by Sailor
Wed Feb 01, 2023 11:45 am
Forum: Emulation and Simulation
Topic: 6502 Emulation of ADC in C
Replies: 18
Views: 12280

Re: 6502 Emulation of ADC in C

Hello Gordon
I tested your code , it is great

Update :

can your code be extended to test / set overflow flag as well ?
by Sailor
Tue Jan 31, 2023 2:59 pm
Forum: Emulation and Simulation
Topic: 6502 Emulation of ADC in C
Replies: 18
Views: 12280

Re: 6502 Emulation of ADC in C

BigEd wrote:
I wish we could get away from that whole thing. It would only take the goodwill of one person.
OK .. I've ignored the negative posts
Thanks BigEd .
by Sailor
Mon Jan 30, 2023 8:47 pm
Forum: Emulation and Simulation
Topic: 6502 Emulation of ADC in C
Replies: 18
Views: 12280

Re: 6502 Emulation of ADC in C

That's right , as an emulation's newbie , I will start to write very clear code at the beginning ,
Then , after I get a sufficient capabilities I would write the fastest one.
by Sailor
Mon Jan 30, 2023 8:01 pm
Forum: Emulation and Simulation
Topic: 6502 Emulation of ADC in C
Replies: 18
Views: 12280

6502 Emulation of ADC in C

uint8_t m,a,c; --------- // a=accumulator , m = some memory value , c = carry flag
int tmp_a; ------------------- // to store a copy of accumulator
c=0; -------------------------- // carry flag initial value
m=0x1; ---------------------- // memory variable initial value
a=0xFE ...
by Sailor
Mon Jul 10, 2017 10:01 pm
Forum: Emulation and Simulation
Topic: 6502 relative Branch = x86 jump short ?
Replies: 16
Views: 8394

Re: 6502 relative Branch = x86 jump short ?

Thank you all guys . :|
by Sailor
Mon Jul 10, 2017 6:13 pm
Forum: Emulation and Simulation
Topic: 6502 relative Branch = x86 jump short ?
Replies: 16
Views: 8394

Re: 6502 relative Branch = x86 jump short ?

OK , but I have no idea how to count cycles .
by Sailor
Sun Jul 09, 2017 6:31 pm
Forum: Emulation and Simulation
Topic: 6502 relative Branch = x86 jump short ?
Replies: 16
Views: 8394

Re: 6502 relative Branch = x86 jump short ?

Dwight
thanks for reply , all reading done as binary .
by Sailor
Sun Jul 09, 2017 4:39 pm
Forum: Emulation and Simulation
Topic: 6502 relative Branch = x86 jump short ?
Replies: 16
Views: 8394

Re: 6502 relative Branch = x86 jump short ?

OK
then how to implement 6502 branching in C (if not in inline assembly) ?
is the following code do the job ? :-

char addr ; //address of branching , char range is -128 to 127
unsigned int PC ; // word Program Counter
PC+=addr // if address is <=127 branching is forward , if address >127 ...
by Sailor
Sat Jul 08, 2017 1:49 pm
Forum: Emulation and Simulation
Topic: 6502 relative Branch = x86 jump short ?
Replies: 16
Views: 8394

Re: 6502 relative Branch = x86 jump short ?

It would appear 8086 short jump and the 6502 branching instructions calculate their offsets the same way.

Using the build in assembler in BBC basic, I've produced 2 simple bits of code:

BBC Basic for DOS Produced:
8086 Branching
099F OPT X%
099F B0 00 MOV AL,0
09A1 .branch
09A1 FE C0 INC AL
09A3 ...
by Sailor
Sat Jul 08, 2017 9:35 am
Forum: Emulation and Simulation
Topic: 6502 relative Branch = x86 jump short ?
Replies: 16
Views: 8394

Re: 6502 relative Branch = x86 jump short ?

OK
then how to implement 6502 branching in C (if not in inline assembly) ?
is the following code do the job ? :-

char addr ; //address of branching , char range is -128 to 127
unsigned int PC ; // word Program Counter
PC+=addr // if address is <=127 branching is forward , if address >127 branching ...
by Sailor
Fri Jul 07, 2017 11:43 pm
Forum: Emulation and Simulation
Topic: 6502 relative Branch = x86 jump short ?
Replies: 16
Views: 8394

6502 relative Branch = x86 jump short ?

hi every body
I am trying to simulate each instruction of the 6502 in C ( open watcom v1.8 )
by using inline assembly , my question is that :

are the 6502 branch instructions equal (the same) to the X86 jump short instructions ?