OK, after a bit of fiddling I have found the following:
The LZ include files in the testpak directory of the repository seem to have different macro syntax to what I assume is the XP include files. So, in OSHEAD.INC (the file linked above) the macro syntax isn't the same as the one I used modelled on MOSHEAD.INC.
Anyway, I have created a file aim_test.asm which has the following:
Code: Select all
.INCLUDE MOSVARS.INC
.INCLUDE MOSHEAD.INC
.INCLUDE MSWI.INC
;/** Macro definitions from OSHEAD.INC ****/
;/****************** MACRO DEFINITIONS ******************************/
BSET .macro mask, addr
oim #mask, addr
.endm
BCLR .macro mask, addr
aim #^Cmask, addr
.endm
BTGL .macro mask, addr
eim #mask, addr
.endm
BTST .macro mask, addr
tim #mask, addr
.endm
.org $1000
AIM #^x40, POB_PORT6
os POB_PORT6
.org $300e
BCLR $40,POB_PORT6
BSET $08,POB_PORT6
When assembled with org2asm.tcl, the .lst file gives this:
Code: Select all
0000 0000 1000 1000 0000 (O) .org $1000
0000 0000 1000 1000 0000 (6) 71 40 17 AIM #^x40, POB_PORT6
0003 0003 1003 1003 0000 (B) 3F .byte ^X3F,POB_PORT6
0004 0004 1004 1004 0000 (B) 17 .byte ^X3F,POB_PORT6
0005 0005 300E 300E 0000 (O) .org $300e
0005 0005 300E 300E 0000 (6) 71 BF 17 aim #^C$40, POB_PORT6
0008 0008 3011 3011 0000 (6) 72 08 17 oim #$08, POB_PORT6
This is the same object code as the example given above from asm6303. I've had to change the syntax of the macro to match the syntax I used, and anyone who is still reading may have noticed that I have had to use a mask value as one of the arguments to the BSET and BCLR macros. This is different to the asm6303 instructions.
That's not a problem, though, as we have the source code to the org2asm.tcl assembler, as it's a Tcl script. We can create a new operator, I will use ^B to convert a bit number to a mask. That can then be used in the macro expansion to get a mask from a bit number like the asm6303 assembler does.
Adding that to the Tcl and using this:
Code: Select all
.INCLUDE MOSVARS.INC
.INCLUDE MOSHEAD.INC
.INCLUDE MSWI.INC
;/** Macro definitions from OSHEAD.INC ****/
;/****************** MACRO DEFINITIONS ******************************/
BSET .macro mask, addr
oim #^B=mask=, addr
.endm
BCLR .macro mask, addr
aim #^C^B=mask=, addr
.endm
BTGL .macro mask, addr
eim #mask, addr
.endm
BTST .macro mask, addr
tim #mask, addr
.endm
.org $1000
AIM #^x40, POB_PORT6
os POB_PORT6
.org $300e
BCLR 6,POB_PORT6
BSET 3,POB_PORT6
which has bit numbers for the bit set and clear macros. The macros BCLR and BSET have been altered to use the new ^B operator. It's modelled on the ^A operator of the Psion assembler. The syntax is:
^Bdnd
where d is a delimiter (any character) and n is the bit number.
So ^B=6= represents the bit mask where bit 6 is set, or 0x40.
The output from the modified org2asm.tcl is this:
Code: Select all
0000 0000 1000 1000 0000 (O) .org $1000
0000 0000 1000 1000 0000 (6) 71 40 17 AIM #^x40, POB_PORT6
0003 0003 1003 1003 0000 (B) 3F .byte ^X3F,POB_PORT6
0004 0004 1004 1004 0000 (B) 17 .byte ^X3F,POB_PORT6
0005 0005 300E 300E 0000 (O) .org $300e
0005 0005 300E 300E 0000 (6) 71 BF 17 aim #^C^B=6=, POB_PORT6
0008 0008 3011 3011 0000 (6) 72 08 17 oim #^B=3=, POB_PORT6
That now generates the same output as asm6303 from the same source.
I've pushed the updated org2asm.tcl and the aim_test.asm file to the repository.
Andrew