Home | Forums | What's new | Resources | |
PC relative addressing in SNASMSH2 |
Mask of Destiny - Sep 28, 2003 |
ExCyber | Sep 28, 2003 | ||||
I don't know about the SN assembler, but GNU as just lets you do:
Code:
I suppose you've probably already tried that, though. edit: on a possibly more helpful note, check out the IP.BIN sources in SGL, I think they use a non-GNU syntax, but I'm not sure if it's for SNASM, Hitachi's assembler, or something else. It might provide a clue though. I'd check it out myself right now but I need to get to bed about a half hour ago... |
antime | Sep 28, 2003 | ||||
You can use the "opt pc+" directive to enable GNU assembler PC-relative syntax, like so:
Code:
You could also make your constants EQUates and use the "mov.l =Addy, r1" syntax, just remember to declare a LITS section where the assembler will insert the literals. Note that putting your code at 0x6000000 is a Bad Thing because the master SH2 vector tables are set to that address. The address normally used (0x6004000) leaves space for both master and slave vector tables and stacks. Also, the address you're writing to is also in the BIOS ROM area, so it won't do much. |
Mask of Destiny | Sep 28, 2003 | |||||||||||||
Does this only affect the syntax of PC relative addressing, or does it change everything to be like GAS? In general I don't particularly care for the GNU syntax, but if it only affects PC relative addressing, that's not a problem.
I tried that and I got different errors. I used LITTAB instead of LITS, but they're supposed to be the same right?
This isn't for Saturn, it's for the 32X. For the time being, I've just set VBR to 0 so it points to the vector table in the boot ROM. On the 32X, main RAM ends at 0x6004000 and the stack builds down from here. On the 32X $20004020 is one of the inter-processor communication registers (not an official name). They can be read or written by both SH-2s and the 68K in the Genesis. EDIT:
No, I didn't, but now that I have, that works. I had tried mov.l Stuff(pc), r0 and mov.l @(Stuff, PC), r0 but I hadn't thought to try it that way. Thanks. |
antime | Sep 28, 2003 | ||||||||||||||||
According to the built-in help it just affects PC-relative syntax.
I think they're the same, but try both, just in case. In my few snasmsh2 programs I also used "opt risc+", but I can't remember what it changed. It may have had something to do with the literals. You can check my copperbar sample for one example.
Ah, OK. |
Mask of Destiny | Sep 28, 2003 | ||||
I think that's it. When I tried using that syntax I got some error about "RISC mode." |