I've been studying ASM for different systems and trying to get a grasp on how it works on different systems. I'm looking at everything from Atari 2600 programming tutorials and ASM lists to... well, anything that uses a single ROM format. I think that came to an end in the 16 bit era, but the N64 may have used it. Haven't gotten that far yet.
That actually brings me to my question. I followed this tutorial for building a simple SNES program that does nothing but display a simple color on screen and then enter an eternal loop. Once I had the program assembled, I opened it up in a hex editor to try and learn how the file was assembled. With an opcode list, everything was pretty straightforward. For instance, it wasn't hard to figure out that these lines...
...were compiled to "A9 00 8D 22 21" when you compare the data and remember that all numbers on the 6502 (NES, Atari 2600) and its descendant, the 65816, are Little Endian. All straightforward. No problems. 8D = STA. A9 = LDA. This page shows that to be true. So now we come to the very last line in the example program, which looks like this:
The data at the location in the compiled ROM reads as: 4C 1C 81. I tried to approach this from every angle I possibly can, but I can't decipher what it means. I checked the ASM reference, and 4C (JMP) is an operation that is 3 bytes long and uses Absolute Addressing. Absolute Addressing is not complicated. It takes the two byte address, Little Endian, at face value. So 4C 1C 81 means JUMP TO $811C. I'm not sure what this means. Chalk this up to inexperience, because that's exactly what's happening here, but I am having real trouble deciphering this. If it's referring to address $811C in the ROM, it shouldn't be. Couldn't be. If it's referring to $811C in memory, well, I checked this page and that didn't make things any clearer.
Anyone who is experienced in these matters who could lend a hand, I would greatly appreciate some clarification.
Thank you.
-Turtle.
That actually brings me to my question. I followed this tutorial for building a simple SNES program that does nothing but display a simple color on screen and then enter an eternal loop. Once I had the program assembled, I opened it up in a hex editor to try and learn how the file was assembled. With an opcode list, everything was pretty straightforward. For instance, it wasn't hard to figure out that these lines...
lda #%11100000 ; Load the low byte of the green color.
sta $2122
sta $2122
; Loop forever.
Forever:
jmp Forever
.ends
Forever:
jmp Forever
.ends
Anyone who is experienced in these matters who could lend a hand, I would greatly appreciate some clarification.
Thank you.
-Turtle.
Comment