nesdev.com
https://forums.nesdev.com/

NESASM - table with pre-computed values
https://forums.nesdev.com/viewtopic.php?f=2&t=15239
Page 1 of 1

Author:  stenlik [ Mon Dec 12, 2016 8:52 am ]
Post subject:  NESASM - table with pre-computed values

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

Author:  tokumaru [ Mon Dec 12, 2016 9:08 am ]
Post subject:  Re: NESASM - table with pre-computed values

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

Author:  Revenant [ Mon Dec 12, 2016 10:02 am ]
Post subject:  Re: NESASM - table with pre-computed values

Let me guess, somebody read gbaguy's "tutorial" again...

Author:  tokumaru [ Mon Dec 12, 2016 5:51 pm ]
Post subject:  Re: NESASM - table with pre-computed values

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.

Author:  koitsu [ Mon Dec 12, 2016 6:35 pm ]
Post subject:  Re: NESASM - table with pre-computed values

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)

Author:  dougeff [ Mon Dec 12, 2016 7:08 pm ]
Post subject:  Re: NESASM - table with pre-computed values

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.

Author:  tepples [ Mon Dec 12, 2016 7:20 pm ]
Post subject:  Re: NESASM - table with pre-computed values

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.

Author:  dougeff [ Mon Dec 12, 2016 8:06 pm ]
Post subject:  Re: NESASM - table with pre-computed values

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

Author:  tepples [ Mon Dec 12, 2016 8:15 pm ]
Post subject:  Re: NESASM - table with pre-computed values

But on http://patater.com/gbaguy/nesasm.htm, clicking Back and then NES ASM Tutorials goes to THAT page.

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/