diff --git a/xa/Makefile b/xa/Makefile index 5da23e1..7bbfd64 100644 --- a/xa/Makefile +++ b/xa/Makefile @@ -63,7 +63,7 @@ install: xa uncpk #$(MKDIR) $(DOCDIR)/xa65 dist: clean - cd .. ; tar cvf xa-2.3.11.tar xa-2.3.11 ; gzip xa-2.3.11.tar + cd .. ; tar cvf xa-2.3.12.tar xa-2.3.12 ; gzip xa-2.3.12.tar test: xa uncpk cd tests && ./harness -make="$(MAKE)" -cc="$(CC)" -cflags="$(CFLAGS)" diff --git a/xa/man/xa.1 b/xa/man/xa.1 index 9032ad8..5b060e3 100644 --- a/xa/man/xa.1 +++ b/xa/man/xa.1 @@ -1,4 +1,4 @@ -.TH XA "1" "9 November 2019" +.TH XA "1" "24 November 2021" .SH NAME xa \- 6502/R65C02/65816 cross-assembler @@ -298,7 +298,7 @@ shift right (8) .B >= => greater than or equal to (7) .TP -.B < +.B > greater than (7) .TP .B <= =< @@ -982,7 +982,7 @@ This manual page was written by David Weinehall , Andre Fachat and Cameron Kaiser . Original xa package (C)1989-1997 Andre Fachat. Additional changes -(C)1989-2019 Andre Fachat, Jolse Maginnis, David Weinehall, +(C)1989-2021 Andre Fachat, Jolse Maginnis, David Weinehall, Cameron Kaiser. The official maintainer is Cameron Kaiser. .SH 30 YEARS OF XA diff --git a/xa/src/xa.c b/xa/src/xa.c index ca9f0f5..0595708 100644 --- a/xa/src/xa.c +++ b/xa/src/xa.c @@ -55,9 +55,9 @@ #define ANZWARN 13 #define programname "xa" -#define progversion "v2.3.11" +#define progversion "v2.3.12" #define authors "Written by Andre Fachat, Jolse Maginnis, David Weinehall and Cameron Kaiser" -#define copyright "Copyright (C) 1989-2020 Andre Fachat, Jolse Maginnis, David Weinehall\nand Cameron Kaiser." +#define copyright "Copyright (C) 1989-2021 Andre Fachat, Jolse Maginnis, David Weinehall\nand Cameron Kaiser." /* exported globals */ int ncmos, cmosfl, w65816, n65816; diff --git a/xa/src/xat.c b/xa/src/xat.c index 6f46ee7..6da4dd7 100644 --- a/xa/src/xat.c +++ b/xa/src/xat.c @@ -139,8 +139,8 @@ static int ktp[]={ 0,3,17,25,28,29,29,29,29,32,34,34,38,40,41,42,58, * opcodes for each addressing mode * high byte: supported architecture (no bits = original NMOS 6502) * bit 1: R65C02 - * bit 2: 65816 - * bit 3: 65816 and allows 16-bit quantity (immediate only) + * bit 2: 65816 and allows 16-bit quantity (accum only) + * bit 3: 65816 and allows 16-bit quantity (index only) * low byte: opcode itself * * each opcode is indexed in this order: *=65816, ^=R65C02 @@ -1430,8 +1430,8 @@ fprintf(stderr, "Kdsb E_DSB %i\n", j); { #ifdef DEBUG_AM fprintf(stderr, -"b4: pc= %d, am = %d and vv[0] = %d, optimize = %d, bitmask = %u, er=%d\n", - pc[segment], am, vv[0], fl, (vv[0]&0xffff00), er); +"b4: pc= %d, am = %d and vv[0] = %d, optimize = %d, bitmask = %u, er=%d, bl=%d\n", + pc[segment], am, vv[0], fl, (vv[0]&0xffff00), er, bl); #endif /* terrible KLUDGE!!!! OH NOES!!!1! @@ -1444,8 +1444,8 @@ fprintf(stderr, am=opt[am]; #ifdef DEBUG_AM fprintf(stderr, -"aftaa1: pc= %d, am = %d and vv[0] = %d, optimize = %d, bitmask = %d\n", - pc[segment], am, vv[0], fl, (vv[0]&0xffff00)); +"aftaa1: pc= %d, am = %d and vv[0] = %d, optimize = %d, bitmask = %d, bl = %d\n", + pc[segment], am, vv[0], fl, (vv[0]&0xffff00), bl); #endif if(t[*ll-1]!='!') { if(bl && !er && !(vv[0]&0xffff00) && opt[am]>=0) { @@ -1460,8 +1460,8 @@ fprintf(stderr, } #ifdef DEBUG_AM fprintf(stderr, -"aftaa2: pc=%d, am=%d and vv[0]=%d, optimize=%d, bitmask=%d, op=%d\n", - pc[segment], am, vv[0], fl, (vv[0]&0xffff00), ct[n][opt[am]]); +"aftaa2: pc=%d, am=%d and vv[0]=%d, optimize=%d, bitmask=%d, op=%d, bl=%d\n", + pc[segment], am, vv[0], fl, (vv[0]&0xffff00), ct[n][opt[am]], bl); #endif } @@ -1470,17 +1470,16 @@ fprintf(stderr, else { bl=le[am]; + if( ((ct[n][am]&0x400) && memode) || ((ct[n][am]&0x800) && xmode)) { + bl++; + } if ((am != 11 && am != 16) && (vv[0] > 255 || vv[0] < -256) && bl == 2) { er = E_OVERFLOW; } else if ((am != 11 && am != 16) && (vv[0] > 65535 || vv[0] < -65536) && (bl == 2 || bl == 3)) { er = E_OVERFLOW; - } else - if( ((ct[n][am]&0x400) && memode) || ((ct[n][am]&0x800) && xmode)) { - bl++; } *ll=bl; - } #ifdef DEBUG_AM diff --git a/xa/tests/README b/xa/tests/README index 3be8f70..c773221 100644 --- a/xa/tests/README +++ b/xa/tests/README @@ -43,6 +43,7 @@ quotch/ Test quoting problematic characters (thanks Simon Rowe) linkr/ Test linking using .dsb and generated code csapiec/ Test on pointer arithmetic in relocating mode math/ Math tests (currently divide by zero, thanks Frederic Cambus) +alxl/ Various '816 width tests (includes Samuel Falvo's test) Cameron Kaiser, AndrĂ© Fachat diff --git a/xa/tests/alxl/Makefile b/xa/tests/alxl/Makefile new file mode 100644 index 0000000..c6024c5 --- /dev/null +++ b/xa/tests/alxl/Makefile @@ -0,0 +1,24 @@ +default: + # xa should not allow this to happen. if it does, this test is no good. + ../../xa alxl.s || exit 0 && exit 1 + ../../xa alxlo1.s || exit 0 && exit 1 + ../../xa alxlo2.s || exit 0 && exit 1 + ../../xa alxlx1.s || exit 0 && exit 1 + ../../xa alxlx2.s || exit 0 && exit 1 + ../../xa alxlx3.s || exit 0 && exit 1 + ../../xa sizes.s || exit 0 && exit 1 + ../../xa -w alxlx1.s || exit 0 && exit 1 + ../../xa -w alxlx2.s || exit 0 && exit 1 + ../../xa -w alxlx3.s || exit 0 && exit 1 + # expected-to-fail tests did fail. should be no more errors now. + ../../xa -w alxl.s -o alxl.o + ../hextool -cmp=alxl.ok < alxl.o + ../../xa -w alxlo1.s -o alxlo1.o + ../hextool -cmp=alxlo1.ok < alxlo1.o + ../../xa -w alxlo2.s -o alxlo2.o + ../hextool -cmp=alxlo2.ok < alxlo2.o + ../../xa -w sizes.s -o sizes.o + ../hextool -cmp=sizes.ok < sizes.o + +clean: + rm -f *.o diff --git a/xa/tests/alxl/alxl.ok b/xa/tests/alxl/alxl.ok new file mode 100644 index 0000000..0d5e499 --- /dev/null +++ b/xa/tests/alxl/alxl.ok @@ -0,0 +1 @@ +¢4 4©4 \ No newline at end of file diff --git a/xa/tests/alxl/alxl.s b/xa/tests/alxl/alxl.s new file mode 100644 index 0000000..105dcfa --- /dev/null +++ b/xa/tests/alxl/alxl.s @@ -0,0 +1,13 @@ +; test for the xa .xl opcode that should set the XR handling to 16 bit + + *=$f000 + + ; set X/Y registers to 16 bit ... + rep #%00010000 + ; ... and tell the assembler about it + .xl + ldx #$1234 + ldy #$1234 + + .al + lda #$1234 diff --git a/xa/tests/alxl/alxlo1.ok b/xa/tests/alxl/alxlo1.ok new file mode 100644 index 0000000..768d6f6 --- /dev/null +++ b/xa/tests/alxl/alxlo1.ok @@ -0,0 +1 @@ +©4 \ No newline at end of file diff --git a/xa/tests/alxl/alxlo1.s b/xa/tests/alxl/alxlo1.s new file mode 100644 index 0000000..65480fb --- /dev/null +++ b/xa/tests/alxl/alxlo1.s @@ -0,0 +1,10 @@ +; test for the xa .xl opcode that should set the XR handling to 16 bit + + *=$f000 + + ; set X/Y registers to 16 bit ... + rep #%00010000 + ; ... and tell the assembler about it + + .al + lda #$1234 diff --git a/xa/tests/alxl/alxlo2.ok b/xa/tests/alxl/alxlo2.ok new file mode 100644 index 0000000..f729f99 --- /dev/null +++ b/xa/tests/alxl/alxlo2.ok @@ -0,0 +1 @@ +¢4 4 \ No newline at end of file diff --git a/xa/tests/alxl/alxlo2.s b/xa/tests/alxl/alxlo2.s new file mode 100644 index 0000000..3f5e555 --- /dev/null +++ b/xa/tests/alxl/alxlo2.s @@ -0,0 +1,10 @@ +; test for the xa .xl opcode that should set the XR handling to 16 bit + + *=$f000 + + ; set X/Y registers to 16 bit ... + rep #%00010000 + ; ... and tell the assembler about it + .xl + ldx #$1234 + ldy #$1234 diff --git a/xa/tests/alxl/alxlx1.s b/xa/tests/alxl/alxlx1.s new file mode 100644 index 0000000..944a458 --- /dev/null +++ b/xa/tests/alxl/alxlx1.s @@ -0,0 +1,12 @@ +; test for the xa .xl opcode that should set the XR handling to 16 bit + + *=$f000 + + ; set X/Y registers to 16 bit ... + rep #%00010000 + ; ... and tell the assembler about it + + .al + ldx #$1234 + ldy #$1234 + lda #$1234 diff --git a/xa/tests/alxl/alxlx2.s b/xa/tests/alxl/alxlx2.s new file mode 100644 index 0000000..deb27b4 --- /dev/null +++ b/xa/tests/alxl/alxlx2.s @@ -0,0 +1,11 @@ +; test for the xa .xl opcode that should set the XR handling to 16 bit + + *=$f000 + + ; set X/Y registers to 16 bit ... + rep #%00010000 + ; ... and tell the assembler about it + .xl + ldx #$1234 + ldy #$1234 + lda #$1234 diff --git a/xa/tests/alxl/alxlx3.s b/xa/tests/alxl/alxlx3.s new file mode 100644 index 0000000..78a3005 --- /dev/null +++ b/xa/tests/alxl/alxlx3.s @@ -0,0 +1,10 @@ +; test for the xa .xl opcode that should set the XR handling to 16 bit + + *=$f000 + + ; set X/Y registers to 16 bit ... + rep #%00010000 + ; ... and tell the assembler about it + ldx #$1234 + ldy #$1234 + lda #$1234 diff --git a/xa/tests/alxl/sizes.ok b/xa/tests/alxl/sizes.ok new file mode 100644 index 0000000..579e6f6 Binary files /dev/null and b/xa/tests/alxl/sizes.ok differ diff --git a/xa/tests/alxl/sizes.s b/xa/tests/alxl/sizes.s new file mode 100644 index 0000000..201a2ba --- /dev/null +++ b/xa/tests/alxl/sizes.s @@ -0,0 +1,22 @@ +#define HI(z) (((z) >> 16) & $FFFF) +#define LO(z) ((z) & $FFFF) + + .al + .xl + *=$112233 + SYM: + rts + jmp SYM + jmp $112233 + lda $112233 + lda @$2233 + lda $2233 + lda $33 + +#print HI(SYM) + lda #HI(SYM) + pha +#print LO(SYM) + lda #LO(SYM) + pha +