Converting NES101 tut to other assemblers such as ASM6
Posted: Sun Jan 04, 2009 2:17 pm
I guess this is specifically aimed at tokumaru since I know he uses and likes ASM6.
From what I understand, CA65 is quite close to P65 and doesn't require much if any source modification for NES101. However, I really like what I see in ASM6, how simple and straightforward it is; seems like the perfect beginner compiler if nothing else.
At the same time I like the test ROM from NES101 very much, it would be quite easy to play with and adapt for educational purposes. In fact it is perfect as the first step toward/past Hello World, assuming everything it teaches is still considered good practice.
So I'm looking into getting NES101 set up for another assembler, in my case ASM6. I ran tutorprg.p65 through ASM6 and made a sample list of directives it doesn't like:
Apparently .alias sprite $200 should be something like sprite: .equ $200, but the use of a label means I need to check the rest of the sources for issues with this, correct?
Not sure what to do with .segment zp:
ASM6's problem with bne a'done is "extra characters on line," which would make me immediately suspect the apostrophe, but other places in the source are fine using it in labels. It's easy enough to get rid of apostrophes just to make sure.
It looks like .ascii is just a .db, is this right? Does it even need any conversion?
And finally, .advance $FFFA looks like it could be trouble.
I know this is long-ish, just wanted to be thorough. Anything blatant I'm missing that will cause a lot of grief? If anyone knows how I can modify these directives to get it to compile in ASM6, that would be most helpful.
EDIT: Ok, NESTech cleared up one thing, the .advance $FFFA was being used to set up the interrupt jump labels, so that's fixable.
From what I understand, CA65 is quite close to P65 and doesn't require much if any source modification for NES101. However, I really like what I see in ASM6, how simple and straightforward it is; seems like the perfect beginner compiler if nothing else.
At the same time I like the test ROM from NES101 very much, it would be quite easy to play with and adapt for educational purposes. In fact it is perfect as the first step toward/past Hello World, assuming everything it teaches is still considered good practice.
So I'm looking into getting NES101 set up for another assembler, in my case ASM6. I ran tutorprg.p65 through ASM6 and made a sample list of directives it doesn't like:
Code: Select all
.alias sprite $200
.segment zp
.space dx 1
* lda $2002
bne a'done
.ascii "12345678901234567890123456789012"
.advance $FFFANot sure what to do with .segment zp:
Nor .space dx 1, it seems simple but I'm not sure what his notation means:.segment segmentname: Sets the current segment to the name specified. If the segment has not yet been referenced, its program counter is initialized to zero.
*s are just anonymous labels and can be easily fixed..space label size: This pragma is used to organize global variables. It defines the label specified to be at the current location of the program counter, and then advances the program counter size steps ahead. No actual code is produced. This is equivalent to label: .org ^+size.
ASM6's problem with bne a'done is "extra characters on line," which would make me immediately suspect the apostrophe, but other places in the source are fine using it in labels. It's easy enough to get rid of apostrophes just to make sure.
It looks like .ascii is just a .db, is this right? Does it even need any conversion?
And finally, .advance $FFFA looks like it could be trouble.
One other thing I caught: ASM6 didn't throw an error at .text, but it looks like it just interpreted that as a label. It's equivalent to .segment text so that can be solved the same way as an above error..advance address: Forces the program counter to be address. Unlike the .org pragma, .advance outputs zeroes until the program counter reaches a specified address. Attempting to .advance to a point behind the current program counter is an assemble-time error.
I know this is long-ish, just wanted to be thorough. Anything blatant I'm missing that will cause a lot of grief? If anyone knows how I can modify these directives to get it to compile in ASM6, that would be most helpful.
EDIT: Ok, NESTech cleared up one thing, the .advance $FFFA was being used to set up the interrupt jump labels, so that's fixable.