It is currently Sun Sep 22, 2019 11:11 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: req: nestest.asm
PostPosted: Sat Nov 17, 2007 12:37 am 
Offline

Joined: Sat Nov 17, 2007 12:34 am
Posts: 5
hi everyone

does anyone here know where to find the nestest.asm source file?

i found the readme, but i'm failing some tests and the error codes don't help me much. the readme says

Code:
For a more detailed reason
for the failure, you should check out the .ASM file included with this
document.


but i haven't been able to find the source code anywhere :oops:


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 17, 2007 1:02 am 
Offline
User avatar

Joined: Fri Jun 29, 2007 10:25 pm
Posts: 324
Location: Earth, Milkyway Galaxy, The Universe, M-Theory
perhaps using a 6502 dissasembler may help?

http://www.ameth.org/~veilleux/dcc6502.html

_________________
Code:
          *=$0000
loop      JMP loop
          .eof


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 17, 2007 1:24 am 
Offline

Joined: Sat Nov 17, 2007 12:34 am
Posts: 5
your link is dead for me at the moment.. i'll try it again later

Code:
Firefox can't establish a connection to the server at www.ameth.org.


Last edited by zagadka on Sat Nov 17, 2007 7:15 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 17, 2007 5:32 am 
Offline

Joined: Sat Nov 17, 2007 12:34 am
Posts: 5
ok, fixed the flag tests, i didn't realise bit 5 of the status register was meant to be 1 at all times!

Code:
  // 1 at all times
 cpu->status |= MASK_BIT5;


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 17, 2007 6:51 am 
Offline

Joined: Sat Nov 17, 2007 12:34 am
Posts: 5
ok, fixed the remaining bugs, i pass all of nestest.asm now

thanks a lot to whoever wrote it!

the actual bugs were

1. overflow for sbc/adc was wrong

this is what i had originally

Code:
static void cpu_updateOverflow(CPU cpu, Byte a, Byte b, Byte c) {
  assert(cpu != NULL);

              // positive                    // positive                     // negative
  if ( ((a & MASK_BIT7) == MASK_BIT7) && ((b & MASK_BIT7) == MASK_BIT7) && ((c & MASK_BIT7) == 0) ) {

    cpu_setOverflow(cpu, TRUE);

               // negative                 // negative                 // positive
 } else if ( ((a & MASK_BIT7) == 0) && ((b & MASK_BIT7) == 0) && ((c & MASK_BIT7) == MASK_BIT7) ) {

    cpu_setOverflow(cpu, TRUE);

  } else {
    cpu_setOverflow(cpu, FALSE);
  }
}


it still looks right to me, but apparently it was wrong. i did a rewrite based on the overflow stuff here

2. jmp indirect wasn't wrapping around the low byte property

3. all the indirect,x functions weren't wrapping around the low byte properly

(i made the indirect y functions wrap too for now)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 17, 2007 8:11 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 21595
Location: NE Indiana, USA (NTSC)
atari2600a wrote:
perhaps using a 6502 dissasembler may help?

http://www.ameth.org/~veilleux/dcc6502.html

"For a more detailed reason for the failure, you should check out the .ASM file" implies that the reasons are in code comments. Disassembly does not recover code comments.

_________________
Pin Eight | Twitter | GitHub | Patreon


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 17, 2007 10:19 am 
Offline
User avatar

Joined: Mon Sep 27, 2004 8:33 am
Posts: 3715
Location: Central Texas, USA
zagadka wrote:
ok, fixed the flag tests, i didn't realise bit 5 of the status register was meant to be 1 at all times!

Status bits 4 and 5 doesn't even exist. Lots of docs say otherwise, which is the start of confusion! The 6502 remembers only 6 status bits. When pushing them on the stack as a byte, the two extra bits are set to fixed values based on the cause of the push. Bit 5 is always set, and bit 4 is set for BRK and PHP, clear for an interrupt (IRQ/NMI).


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 17, 2007 1:00 pm 
Offline
User avatar

Joined: Fri Jun 29, 2007 10:25 pm
Posts: 324
Location: Earth, Milkyway Galaxy, The Universe, M-Theory
tepples wrote:
atari2600a wrote:
perhaps using a 6502 dissasembler may help?

http://www.ameth.org/~veilleux/dcc6502.html

"For a more detailed reason for the failure, you should check out the .ASM file" implies that the reasons are in code comments. Disassembly does not recover code comments.


Yeah, but if the original ASM files are unavailable, at least having a disassembly can be of a little help...

_________________
Code:
          *=$0000
loop      JMP loop
          .eof


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 17, 2007 2:41 pm 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3188
Location: Brazil
Actually, I have a built-in disassembler that can dump a piece of code into a text file, making my analysis much easier, regardless the original source of the program.

_________________
Zepper
RockNES developer


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 18, 2007 12:19 am 
Offline
User avatar

Joined: Sat Oct 29, 2005 2:09 am
Posts: 504
Location: Indianapolis
blargg wrote:
zagadka wrote:
ok, fixed the flag tests, i didn't realise bit 5 of the status register was meant to be 1 at all times!

Status bits 4 and 5 doesn't even exist. Lots of docs say otherwise, which is the start of confusion! The 6502 remembers only 6 status bits. When pushing them on the stack as a byte, the two extra bits are set to fixed values based on the cause of the push. Bit 5 is always set, and bit 4 is set for BRK and PHP, clear for an interrupt (IRQ/NMI).


Yes, but reading it (i.e. PHP PLA) results in bit 5 always being set. Checking out the 6502 chip schematic, it is shown pulled up! the BRK flag comes from the interrupt logic like you'd expect.

As for the test ROM, I am the dork that wrote it a long time ago. Sorry there's no source for it but I don't have a clean version of the source that I released. Disassembling it (or running the code under a debugger (you DO have a simple debugger in your emu, right? :-) ) should result in the code you seek.

The code is REAL simple, I just do the tests one after another and write a number to a ZP location if something fails. I tried to make it so that the earlier tests have to pass before those functions get used later on in other tests, so that SOMETHING would work at first and it wouldn't just fail right off the bat. Though if your CPU is REAL broken it still might not work.

_________________
/* this is a comment */


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 18, 2007 1:05 am 
Offline

Joined: Sat Nov 17, 2007 12:34 am
Posts: 5
i pass all your tests now :)

in other news i've decided to call my emulator 1337nes


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 18, 2007 1:30 am 
Offline
User avatar

Joined: Fri Jun 29, 2007 10:25 pm
Posts: 324
Location: Earth, Milkyway Galaxy, The Universe, M-Theory
lol, kind of reminds me of a friend's 8086-compatible IRC client, 1337IRC!

_________________
Code:
          *=$0000
loop      JMP loop
          .eof


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group