It is currently Sat Nov 25, 2017 4:39 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Mon Dec 12, 2016 8:52 am 
Offline

Joined: Sun Dec 11, 2016 1:43 am
Posts: 3
Hello,

I wanted to create a simple table with pre-computed values with use of NESASM, but when I run the program and I check the RAM values are not there. Am I doing something wrongly?

Thanks
STeN

Code:
; -------------- Pre-computed table
    .bank 2
    .org  $0011
table:
    .dw   $0
    .dw   $9
    .dw   $18
    .dw   $27
    .dw   $36
    .dw   $45
    .dw   $54
    .dw   $63


Top
 Profile  
 
PostPosted: Mon Dec 12, 2016 9:08 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10120
Location: Rio de Janeiro - Brazil
A ROM file contains the information that's mapped to the ROM area of the system, and can't possibly contain any RAM information. The table you have there is not saved anywhere in the resulting ROM, it's completely lost when you assemble the program. RAM is always "empty" when programs start on the NES, and you have to manually copy any data you need to be available in there. What you need to do is define that table in ROM (i.e. loose the .org $0011) and write a loop to copy the data to RAM.

EDIT: A simple loop like this will do:
Code:
   ldx #$07
loop:
   lda table, x
   sta $11, x
   dex
   bpl loop


Top
 Profile  
 
PostPosted: Mon Dec 12, 2016 10:02 am 
Offline

Joined: Sat Apr 25, 2015 1:47 pm
Posts: 331
Location: FL
Let me guess, somebody read gbaguy's "tutorial" again...


Top
 Profile  
 
PostPosted: Mon Dec 12, 2016 5:51 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10120
Location: Rio de Janeiro - Brazil
Revenant wrote:
gbaguy's "tutorial"

Really? I know GBAGuy wrote really questionable code, but this is not just questionable, it doesn't do anything at all. The fact that someone would put something like this in a tutorial without even testing is unbelievable.


Top
 Profile  
 
PostPosted: Mon Dec 12, 2016 6:35 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3192
Location: Mountain View, CA, USA
tokumaru wrote:
Really? I know GBAGuy wrote really questionable code, but this is not just questionable, it doesn't do anything at all. The fact that someone would put something like this in a tutorial without even testing is unbelievable.

Real high quality stuff: http://patater.com/gbaguy/day7n.htm
Compare that to http://patater.com/gbaguy/day2n.htm (re: what "bank 0" is used for)


Top
 Profile  
 
PostPosted: Mon Dec 12, 2016 7:08 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1835
Location: DIGDUG
I see comments going back to 2004 on this 'tutorial'. Whoever is hosting such a thing for 12+ years, you think they could have found the time to correct the errors. I mean, they're not long pages. I could probably fix them all in one evening.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Mon Dec 12, 2016 7:20 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19259
Location: NE Indiana, USA (NTSC)
The official fix is Nerdy Nights. From the tutorial index:

Webmaster's Note

This tutorial sucks. Don't read it. Please read a real tutorial like Nerdy Nights, instead. This tutorial is hosted for archival purposes and shouldn't be trusted for anything.


Top
 Profile  
 
PostPosted: Mon Dec 12, 2016 8:06 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1835
Location: DIGDUG
A Google search doesn't take you to THAT page, which says it sucks, it takes you to this page...

http://patater.com/gbaguy/nesasm.htm

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Mon Dec 12, 2016 8:15 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19259
Location: NE Indiana, USA (NTSC)
But on http://patater.com/gbaguy/nesasm.htm, clicking Back and then NES ASM Tutorials goes to THAT page.


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 11 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