Incompatibility of 2-char constants 'XY' with MRAS
GmEsoft opened this issue · comments
GmEsoft commented
Incompatibility of 2-char constants 'XY' with MRAS
Hi George,
I observed this incompatibility between ZMAC in --mras
mode and MRAS:
MRAS considers 2-char constants XY
as ( 'X' << 8 ) | 'Y'
. ZMAC converts them to 'X' | ( 'Y' << 8 )
.
So, with MRAS, X
goes to the MSB and Y
goes to the LSB. With ZMAC it's reversed.
Example TEST2CHR/ASM
:
ORG 3000H
@DSPLY EQU 0AH ; SVC display msg @HL
START LD HL,'ko' ; Test message
LD (TEST),HL ;
LD HL,MSG
LD A,@DSPLY ; Display it
RST 28H ;
LD HL,0 ; exit OK
RET ; done
MSG DB 'MRAS Test result: '
TEST DB '??',0DH
END START
With MRAS:
MRAS TEST2CHR +L=TEST2CHR -GC
Output:
MRAS Test result: ok
Listing:
3000 00001 ORG 3000H
000A 00002 @DSPLY EQU 0AH ; SVC display msg @HL
3000 216F6B 00003 START LD HL,'ko' ; Test message
3003 222230 00004 LD (TEST),HL ;
3006 211030 00005 LD HL,MSG
3009 3E0A 00006 LD A,@DSPLY ; Display it
300B EF 00007 RST 28H ;
300C 210000 00008 LD HL,0 ; exit OK
300F C9 00009 RET ; done
3010 4D 00010 MSG DB 'MRAS Test result: '
52 41 53 20 54 65 73 74
20 72 65 73 75 6C 74 3A
20
3022 3F 00011 TEST DB '??',0DH
3F 0D
3000 00012 END START
With ZMAC:
zmac --mras --od . --oo cmd --oo lst test2chr.asm
Output:
MRAS Test result: ko
Listing:
1: - 3000 ORG 3000H
2: - 000A @DSPLY EQU 0AH ; SVC display msg @HL
3: 0+10 3000 216B6F START LD HL,'ko' ; Test message
4: 10+16 3003 222230 LD (TEST),HL ;
5: 26+10 3006 211030 LD HL,MSG
6: 36+7 3009 3E0A LD A,@DSPLY ; Display it
7: 43+11 300B EF RST 28H ;
8: 54+10 300C 210000 LD HL,0 ; exit OK
9: 64+10 300F C9 RET ; done
10: - 3010 4D524153 MSG DB 'MRAS Test result: '
20546573
74207265
73756C74
3A20
11: - 3022 3F3F0D TEST DB '??',0DH
12: - 3000 END START