Search found 29 matches

by ehguacho
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

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.
by ehguacho
Sat Aug 21, 2010 9:31 pm
Forum: Emulation and Simulation
Topic: in wich modes ROR overwrites original data?
Replies: 2
Views: 2292

...so it means that the instruction DO overwrite the original data, even in all the others addressing modes.

thanks a lot mate! :wink:
by ehguacho
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 ...
by ehguacho
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 ...
by ehguacho
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

yes i did Garth, actually that's the doc if was reffering to.

looks like that expression was whipped up from a Karnaugh map or something like that, who knows... :shock:
by ehguacho
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 ...
by ehguacho
Mon Aug 16, 2010 6:22 pm
Forum: Emulation and Simulation
Topic: problem emulating BNE instruction in C++
Replies: 30
Views: 17269

sorry for revive old posts, but let me just paste my final code:

(C# Language)
private void Branch(bool Flag, bool Condition)
{
PC += 2; // PC points to the next instruction after the branch before the branch is taken
if (Flag == Condition)
{
PC--;
UInt16 Displacement = Memory[PC++]; // Post ...
by ehguacho
Tue Mar 16, 2010 9:44 pm
Forum: Emulation and Simulation
Topic: a really newbie question...
Replies: 8
Views: 4392

ok thanks! :D
by ehguacho
Tue Mar 16, 2010 7:40 pm
Forum: Emulation and Simulation
Topic: a really newbie question...
Replies: 8
Views: 4392

GARTHWILSON wrote:
Only ASL A leaves the result in the accumulator. ASL done to a memory address does not affect the accumulator.
but it affects the value in the memory address. isn't it? i.e.:

assume $FE is #AA (170 in decimal)

ASL $FE

...after that $FE is #54 (84 in decimal)
by ehguacho
Tue Mar 16, 2010 6:19 pm
Forum: Emulation and Simulation
Topic: a really newbie question...
Replies: 8
Views: 4392

leeeeee wrote:
The result of an ASL always overwrites the original data.

Lee.
that means that it may ovewrite memory address... thanks Lee!
by ehguacho
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
thanks Ed! i suppose it is also valid for "ASL Zero Page" and all the others ASL's... i mean that the result of any kind of ASL is always stored into the accumulator. is that right?
by ehguacho
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?
by ehguacho
Wed Mar 10, 2010 7:13 am
Forum: Emulation and Simulation
Topic: Video emulation problem on a Nintendo NES emulator
Replies: 5
Views: 4778

ok, thank you all for your answers! specially kc5tja, i'll try to make just like you said above.

this is a project i've been working on since i'm 18 (now i'm 20) and i always got stucked in some point (because i've internet access in my house since 2 years ago and because the complexness of this ...
by ehguacho
Wed Mar 10, 2010 1:38 am
Forum: Emulation and Simulation
Topic: Video emulation problem on a Nintendo NES emulator
Replies: 5
Views: 4778

There are already NES emulators, some probably open source. Also, the rise on the NOAC chips (Nintendo On A Chip) are populart because the PPU patent has expired.

One place to look, the Playpower $10 computer which uses one. They have an open source emulator so you will wan to take a look there ...
by ehguacho
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!