Nicole wrote:
Kingizor wrote:
How would you tackle the same problem with your assembler of choice?
To tell you the truth, for SNES I don't really have an assembler of choice at the moment, since ca65, WLA-DX, and bass all bother me in different ways. Generally speaking something like asm6 is what I'm looking for, though:
- Direct control over file layout with .base and .org, with no assumptions regarding output (no .bank, .segment, etc.)
- No dealing with object files, linkers, or exporting symbols
- Relatively standard syntax (please don't make me use // for comments)
- Macro system powerful enough to implement e.g. Garth's structure macros
My old X816 assembler used the .base directive for relocated code and I've kept that for the updated version I've been working on so I can flip flop from 65816 to SPC700 assembly within the same source file without having to include preassembled binaries.
Code:
.cpu 65816
.org $808000
...do stuff in 65816
spc700start
.cpu spc700
.base $0000
...do stuff in spc700
.endb
spc700end
.cpu 65816
mymacro .macro num
lda #num
tax
tay
.endm
sayhello .macro "name","number","address","city"
bra +
namedata .dcb "name",0
numberdata .dcb "number",0
addressdata .dcb "address",0
citydata .dcb "city",0
cityagain .dcb @4,0 ; 4th argument
+
mymacro 3; macro within a macro
.repeat narg ; narg=number of arguments
nop
.endr
.endm
temp .equ $200
temp = ++ ; temp=201
temp = -- ; temp=200
temp = --16 ; temp=1f0
.if temp=1f0
mymacro 12
.else
mymacro 23
.endif
start:
sayhello ""Jane Doe"",""604-123-4567"",""123 Main St"",""Vancouver""
rts
.savebin "a.bin",$80,$8000 to $ffff ; bank $80, $8000-ffff
.savebin "a2.bin",^spc700start,!spc700start to !spc700end ; save spc700 binary
.savebin "a-all.bin" ; just save from the lowest assembled address to the highest
No linkers or object files either in the new version of my assembler. In the above example you can save binaries in the last pass at any given point in the assembly process, ideally at at the end your source. You also get an idea of the other directives. X816 was just a 65816 assembler but the updated version is able to handle SPC700, 6502 and potentially more.
The backslash is my choice for multiple statements on a line.