and again thanks dclxvi . probably there's some typos in some docs.
usually the operation is written some docs (the correct ones) as "A = A - M - (IF_CARRY() ? 0 : 1)".
then, if C is set the formula goes "A = A - M" and "A = A - M - 1" if it's not set, wich is the correct behavior.
Search found 29 matches
- Sat Aug 21, 2010 9:38 pm
- Forum: Emulation and Simulation
- Topic: Problem with the logic besides the SBC instruction emulation
- Replies: 14
- Views: 6261
- Sat Aug 21, 2010 9:31 pm
- Forum: Emulation and Simulation
- Topic: in wich modes ROR overwrites original data?
- Replies: 2
- Views: 2292
- Thu Aug 19, 2010 8:33 pm
- Forum: Emulation and Simulation
- Topic: in wich modes ROR overwrites original data?
- Replies: 2
- Views: 2292
in wich modes ROR overwrites original data?
...that's what i'm wondering now while looking at the ROR behavior.
e.g.: ROR Accumulator:
byte src; // just an unsigned 8-bit number
src = (ACC >> 1); // store the rotation temporary
if(C_FLAG) src |= 0x80; // if C was set, then set the #7 bit of the rotation's result
C_FLAG = ACC & 0x1;
Z_FLAG ...
e.g.: ROR Accumulator:
byte src; // just an unsigned 8-bit number
src = (ACC >> 1); // store the rotation temporary
if(C_FLAG) src |= 0x80; // if C was set, then set the #7 bit of the rotation's result
C_FLAG = ACC & 0x1;
Z_FLAG ...
- Thu Aug 19, 2010 7:18 am
- Forum: Emulation and Simulation
- Topic: Problem with the logic besides the SBC instruction emulation
- Replies: 14
- Views: 6261
Re: Problem with the logic besides the SBC instruction emula
First, the formula is A = A - M - 1 + C
that's not way the i've found the formula. that "-1" doesn't appears in any doc i've checked.
it's strange that src is used in the temp calculation but the Memoria array is used in the V_FLAG calculation
my mistake. forgot to chanage that "Memoria[PC ...
that's not way the i've found the formula. that "-1" doesn't appears in any doc i've checked.
it's strange that src is used in the temp calculation but the Memoria array is used in the V_FLAG calculation
my mistake. forgot to chanage that "Memoria[PC ...
- Tue Aug 17, 2010 5:25 am
- Forum: Emulation and Simulation
- Topic: Problem with the logic besides the SBC instruction emulation
- Replies: 14
- Views: 6261
- Tue Aug 17, 2010 3:03 am
- Forum: Emulation and Simulation
- Topic: Problem with the logic besides the SBC instruction emulation
- Replies: 14
- Views: 6261
Problem with the logic besides the SBC instruction emulation
i came across this code to emulate the SBC instruction:
uint temp = (uint)(ACC - src - C_FLAG);
Z_FLAG = !(temp & 0xff);
N_FLAG = (temp & 0x80);
V_FLAG = ((ACC ^ temp) & (Memoria[PC] ^ temp) & 0x80)
C_FLAG = (temp < 0x100);
ACC = (byte)(temp & 0xff);
i tested the code it do work perfectly, but ...
uint temp = (uint)(ACC - src - C_FLAG);
Z_FLAG = !(temp & 0xff);
N_FLAG = (temp & 0x80);
V_FLAG = ((ACC ^ temp) & (Memoria[PC] ^ temp) & 0x80)
C_FLAG = (temp < 0x100);
ACC = (byte)(temp & 0xff);
i tested the code it do work perfectly, but ...
- Mon Aug 16, 2010 6:22 pm
- Forum: Emulation and Simulation
- Topic: problem emulating BNE instruction in C++
- Replies: 30
- Views: 17269
- Tue Mar 16, 2010 9:44 pm
- Forum: Emulation and Simulation
- Topic: a really newbie question...
- Replies: 8
- Views: 4392
- Tue Mar 16, 2010 7:40 pm
- Forum: Emulation and Simulation
- Topic: a really newbie question...
- Replies: 8
- Views: 4392
- Tue Mar 16, 2010 6:19 pm
- Forum: Emulation and Simulation
- Topic: a really newbie question...
- Replies: 8
- Views: 4392
- Tue Mar 16, 2010 5:40 pm
- Forum: Emulation and Simulation
- Topic: a really newbie question...
- Replies: 8
- Views: 4392
BigEd wrote:
Result is stored in the Accumulator. Some assemblers allow 'ASL' as a legal opcode, some 'ASL A'
Cheers
Ed
Cheers
Ed
- Tue Mar 16, 2010 5:19 pm
- Forum: Emulation and Simulation
- Topic: a really newbie question...
- Replies: 8
- Views: 4392
a really newbie question...
just to be sure: in the instruction ASL A (ASL accumulator) the operation is:
1) A = ASL accumulator
...or just
2) ASL accumulator
...???
the result of the ASL operation is stored into the accumulator? or the ASL instruction is just used to set/reset flags?
1) A = ASL accumulator
...or just
2) ASL accumulator
...???
the result of the ASL operation is stored into the accumulator? or the ASL instruction is just used to set/reset flags?
- Wed Mar 10, 2010 7:13 am
- Forum: Emulation and Simulation
- Topic: Video emulation problem on a Nintendo NES emulator
- Replies: 5
- Views: 4778
- Wed Mar 10, 2010 1:38 am
- Forum: Emulation and Simulation
- Topic: Video emulation problem on a Nintendo NES emulator
- Replies: 5
- Views: 4778
- Tue Mar 09, 2010 1:45 am
- Forum: Emulation and Simulation
- Topic: Video emulation problem on a Nintendo NES emulator
- Replies: 5
- Views: 4778
Video emulation problem on a Nintendo NES emulator
hi everyone! i'm trying to write a nintendo nes emulator. i'd written almost the 50% of the cpu core, but i have some doubts with the video emulation.
where should i start writing the ppu emulator? any advice will be greatly apreciated!
where should i start writing the ppu emulator? any advice will be greatly apreciated!