diff -Nru xa-2.3.11/debian/changelog xa-2.3.12/debian/changelog --- xa-2.3.11/debian/changelog 2022-02-19 08:23:12.000000000 +0000 +++ xa-2.3.12/debian/changelog 2022-02-18 20:15:45.000000000 +0000 @@ -1,3 +1,12 @@ +xa (2.3.12-0.1) unstable; urgency=medium + + * Non-maintainer upload. + * New upstream release. + * Enable the test suite. Closes: #966181. + * Fix a number of segfaults. Closes: #715904, #716289, #716483. + + -- Stephen Kitt Fri, 18 Feb 2022 21:15:45 +0100 + xa (2.3.11-0.1) unstable; urgency=medium * Non-maintainer upload. diff -Nru xa-2.3.11/debian/patches/file65-a-segfault.patch xa-2.3.12/debian/patches/file65-a-segfault.patch --- xa-2.3.11/debian/patches/file65-a-segfault.patch 1970-01-01 00:00:00.000000000 +0000 +++ xa-2.3.12/debian/patches/file65-a-segfault.patch 2022-02-04 12:31:16.000000000 +0000 @@ -0,0 +1,23 @@ +Description: Avoid segfaulting if -a is given without an offset +Author: Stephen Kitt +Bug-Debian: https://bugs.debian.org/715904 + +--- a/misc/file65.c ++++ b/misc/file65.c +@@ -101,13 +101,14 @@ + rompar = 1; + if(argv[i][1]=='A') rompar++; + if(argv[i][2]) romoff = atoi(argv[i]+2); +- else romoff = atoi(argv[++i]); ++ else if(i + 1 < argc) romoff = atoi(argv[++i]); ++ else fprintf(stderr,"%s: missing offset\n",programname); + break; + case 'P': + xapar = 1; + break; + default: +- fprintf(stderr,"file65: %s unknown option\n",argv[i]); ++ fprintf(stderr,"%s: %s unknown option\n",programname,argv[i]); + break; + } + } else { diff -Nru xa-2.3.11/debian/patches/reloc65-argument-segfaults.patch xa-2.3.12/debian/patches/reloc65-argument-segfaults.patch --- xa-2.3.11/debian/patches/reloc65-argument-segfaults.patch 1970-01-01 00:00:00.000000000 +0000 +++ xa-2.3.12/debian/patches/reloc65-argument-segfaults.patch 2022-02-04 12:39:06.000000000 +0000 @@ -0,0 +1,73 @@ +Description: Avoid segfaulting if args have missing parameters +Author: Stephen Kitt +Bug-Debian: https://bugs.debian.org/716289 + +--- a/misc/reloc65.c ++++ b/misc/reloc65.c +@@ -84,6 +84,7 @@ + FILE *fp; + int tflag = 0, dflag = 0, bflag = 0, zflag = 0; + int tbase = 0, dbase = 0, bbase = 0, zbase = 0; ++ int *base; + char *outfile = "a.o65"; + int extract = 0; + +@@ -108,37 +109,40 @@ + switch(argv[i][1]) { + case 'o': + if(argv[i][2]) outfile=argv[i]+2; +- else outfile=argv[++i]; ++ else if(i + 1 < argc) outfile=argv[++i]; ++ else fprintf(stderr,"%s: missing output file\n",programname); + break; + case 'X': + extract=3; + break; + case 'b': ++ base=NULL; + switch(argv[i][2]) { + case 't': + tflag= 1; +- if(argv[i][3]) tbase = atoi(argv[i]+3); +- else tbase = atoi(argv[++i]); ++ base=&tbase; + break; + case 'd': + dflag= 1; +- if(argv[i][3]) dbase = atoi(argv[i]+3); +- else dbase = atoi(argv[++i]); ++ base=&dbase; + break; + case 'b': + bflag= 1; +- if(argv[i][3]) bbase = atoi(argv[i]+3); +- else bbase = atoi(argv[++i]); ++ base=&bbase; + break; + case 'z': + zflag= 1; +- if(argv[i][3]) zbase = atoi(argv[i]+3); +- else zbase = atoi(argv[++i]); ++ base=&zbase; + break; + default: + printf("Unknown segment type '%c' - ignored!\n", argv[i][2]); + break; + } ++ if (base != NULL) { ++ if(argv[i][3]) *base = atoi(argv[i]+3); ++ else if(i + 1 < argc) *base = atoi(argv[++i]); ++ else fprintf(stderr,"%s: missing address\n",programname); ++ } + break; + case 'x': /* extract segment */ + switch(argv[i][2]) { +@@ -158,7 +162,7 @@ + } + break; + default: +- fprintf(stderr,"reloc65: %s unknown option, use '-?' for help\n",argv[i]); ++ fprintf(stderr,"%s: %s unknown option, use '-?' for help\n",programname,argv[i]); + break; + } + } else { diff -Nru xa-2.3.11/debian/patches/series xa-2.3.12/debian/patches/series --- xa-2.3.11/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ xa-2.3.12/debian/patches/series 2022-02-18 20:06:10.000000000 +0000 @@ -0,0 +1,3 @@ +file65-a-segfault.patch +reloc65-argument-segfaults.patch +xa-argument-segfaults.patch diff -Nru xa-2.3.11/debian/patches/xa-argument-segfaults.patch xa-2.3.12/debian/patches/xa-argument-segfaults.patch --- xa-2.3.11/debian/patches/xa-argument-segfaults.patch 1970-01-01 00:00:00.000000000 +0000 +++ xa-2.3.12/debian/patches/xa-argument-segfaults.patch 2022-02-18 20:12:33.000000000 +0000 @@ -0,0 +1,85 @@ +Description: Avoid segfaulting if args have missing parameters +Author: Stephen Kitt +Bug-Debian: https://bugs.debian.org/716483 + +--- a/src/xa.c ++++ b/src/xa.c +@@ -218,8 +218,12 @@ + case 'O': /* output charset */ + { + char *name = NULL; +- if (argv[i][2] == 0) { +- name = argv[++i]; ++ if (argv[i][2] == 0) { ++ if (i + 1 < argc) name = argv[++i]; ++ else { ++ fprintf(stderr, "-O requires an argument\n"); ++ exit(1); ++ } + } else { + name = argv[i]+2; + } +@@ -231,7 +235,13 @@ + case 'A': /* make text segment start so that text relocation + is not necessary when _file_ starts at adr */ + romable = 2; +- if(argv[i][2]==0) romaddr = atoi(argv[++i]); ++ if(argv[i][2]==0) { ++ if (i + 1 < argc) romaddr = atoi(argv[++i]); ++ else { ++ fprintf(stderr, "-A requires an argument\n"); ++ exit(1); ++ } ++ } + else romaddr = atoi(argv[i]+2); + break; + case 'G': +@@ -276,28 +286,44 @@ + break; + case 'I': + if(argv[i][2]==0) { +- reg_include(argv[++i]); ++ if (i + 1 < argc) reg_include(argv[++i]); ++ else { ++ fprintf(stderr, "-I requires an argument\n"); ++ exit(1); ++ } + } else { + reg_include(argv[i]+2); + } + break; + case 'o': + if(argv[i][2]==0) { +- ofile=argv[++i]; ++ if (i + 1 < argc) ofile=argv[++i]; ++ else { ++ fprintf(stderr, "-o requires an argument\n"); ++ exit(1); ++ } + } else { + ofile=argv[i]+2; + } + break; + case 'l': + if(argv[i][2]==0) { +- lfile=argv[++i]; ++ if (i + 1 < argc) lfile=argv[++i]; ++ else { ++ fprintf(stderr, "-l requires an argument\n"); ++ exit(1); ++ } + } else { + lfile=argv[i]+2; + } + break; + case 'e': + if(argv[i][2]==0) { +- efile=argv[++i]; ++ if (i + 1 < argc) efile=argv[++i]; ++ else { ++ fprintf(stderr, "-e requires an argument\n"); ++ exit(1); ++ } + } else { + efile=argv[i]+2; + } diff -Nru xa-2.3.11/debian/rules xa-2.3.12/debian/rules --- xa-2.3.11/debian/rules 2022-02-19 08:23:12.000000000 +0000 +++ xa-2.3.12/debian/rules 2022-01-03 19:45:41.000000000 +0000 @@ -10,6 +10,7 @@ make install DESTDIR=$(CURDIR)/debian/xa65/usr override_dh_auto_test: + dh_auto_test --no-parallel %: dh $@ diff -Nru xa-2.3.11/debian/source/format xa-2.3.12/debian/source/format --- xa-2.3.11/debian/source/format 2022-02-19 08:23:12.000000000 +0000 +++ xa-2.3.12/debian/source/format 2022-02-18 20:14:08.000000000 +0000 @@ -1 +1 @@ -1.0 +3.0 (quilt) diff -Nru xa-2.3.11/Makefile xa-2.3.12/Makefile --- xa-2.3.11/Makefile 2020-05-02 22:00:31.000000000 +0000 +++ xa-2.3.12/Makefile 2021-11-25 04:28:21.000000000 +0000 @@ -63,7 +63,7 @@ #$(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 -Nru xa-2.3.11/man/xa.1 xa-2.3.12/man/xa.1 --- xa-2.3.11/man/xa.1 2019-11-09 19:08:02.000000000 +0000 +++ xa-2.3.12/man/xa.1 2021-11-25 04:31:04.000000000 +0000 @@ -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 @@ .B >= => greater than or equal to (7) .TP -.B < +.B > greater than (7) .TP .B <= =< @@ -982,7 +982,7 @@ 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 -Nru xa-2.3.11/src/xa.c xa-2.3.12/src/xa.c --- xa-2.3.11/src/xa.c 2020-05-06 21:39:58.000000000 +0000 +++ xa-2.3.12/src/xa.c 2021-11-25 04:28:57.000000000 +0000 @@ -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 -Nru xa-2.3.11/src/xat.c xa-2.3.12/src/xat.c --- xa-2.3.11/src/xat.c 2020-05-02 23:13:18.000000000 +0000 +++ xa-2.3.12/src/xat.c 2021-11-25 04:19:30.000000000 +0000 @@ -139,8 +139,8 @@ * 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 @@ { #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 @@ 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 @@ } #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 @@ 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 -Nru xa-2.3.11/tests/alxl/alxlo1.ok xa-2.3.12/tests/alxl/alxlo1.ok --- xa-2.3.11/tests/alxl/alxlo1.ok 1970-01-01 00:00:00.000000000 +0000 +++ xa-2.3.12/tests/alxl/alxlo1.ok 2020-12-15 03:16:14.000000000 +0000 @@ -0,0 +1 @@ +©4 \ No newline at end of file diff -Nru xa-2.3.11/tests/alxl/alxlo1.s xa-2.3.12/tests/alxl/alxlo1.s --- xa-2.3.11/tests/alxl/alxlo1.s 1970-01-01 00:00:00.000000000 +0000 +++ xa-2.3.12/tests/alxl/alxlo1.s 2020-12-15 03:14:22.000000000 +0000 @@ -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 -Nru xa-2.3.11/tests/alxl/alxlo2.ok xa-2.3.12/tests/alxl/alxlo2.ok --- xa-2.3.11/tests/alxl/alxlo2.ok 1970-01-01 00:00:00.000000000 +0000 +++ xa-2.3.12/tests/alxl/alxlo2.ok 2020-12-15 03:16:17.000000000 +0000 @@ -0,0 +1 @@ +¢4 4 \ No newline at end of file diff -Nru xa-2.3.11/tests/alxl/alxlo2.s xa-2.3.12/tests/alxl/alxlo2.s --- xa-2.3.11/tests/alxl/alxlo2.s 1970-01-01 00:00:00.000000000 +0000 +++ xa-2.3.12/tests/alxl/alxlo2.s 2020-12-15 03:15:50.000000000 +0000 @@ -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 -Nru xa-2.3.11/tests/alxl/alxl.ok xa-2.3.12/tests/alxl/alxl.ok --- xa-2.3.11/tests/alxl/alxl.ok 1970-01-01 00:00:00.000000000 +0000 +++ xa-2.3.12/tests/alxl/alxl.ok 2020-12-15 03:16:08.000000000 +0000 @@ -0,0 +1 @@ +¢4 4©4 \ No newline at end of file diff -Nru xa-2.3.11/tests/alxl/alxl.s xa-2.3.12/tests/alxl/alxl.s --- xa-2.3.11/tests/alxl/alxl.s 1970-01-01 00:00:00.000000000 +0000 +++ xa-2.3.12/tests/alxl/alxl.s 2020-12-15 03:15:58.000000000 +0000 @@ -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 -Nru xa-2.3.11/tests/alxl/alxlx1.s xa-2.3.12/tests/alxl/alxlx1.s --- xa-2.3.11/tests/alxl/alxlx1.s 1970-01-01 00:00:00.000000000 +0000 +++ xa-2.3.12/tests/alxl/alxlx1.s 2020-12-15 03:18:36.000000000 +0000 @@ -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 -Nru xa-2.3.11/tests/alxl/alxlx2.s xa-2.3.12/tests/alxl/alxlx2.s --- xa-2.3.11/tests/alxl/alxlx2.s 1970-01-01 00:00:00.000000000 +0000 +++ xa-2.3.12/tests/alxl/alxlx2.s 2020-12-15 03:18:49.000000000 +0000 @@ -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 -Nru xa-2.3.11/tests/alxl/alxlx3.s xa-2.3.12/tests/alxl/alxlx3.s --- xa-2.3.11/tests/alxl/alxlx3.s 1970-01-01 00:00:00.000000000 +0000 +++ xa-2.3.12/tests/alxl/alxlx3.s 2020-12-15 03:18:59.000000000 +0000 @@ -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 -Nru xa-2.3.11/tests/alxl/Makefile xa-2.3.12/tests/alxl/Makefile --- xa-2.3.11/tests/alxl/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ xa-2.3.12/tests/alxl/Makefile 2021-11-25 04:22:29.000000000 +0000 @@ -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 Binary files /tmp/tmp_c7ju6mx/48nYFqZTO4/xa-2.3.11/tests/alxl/sizes.ok and /tmp/tmp_c7ju6mx/smowJrWg0g/xa-2.3.12/tests/alxl/sizes.ok differ diff -Nru xa-2.3.11/tests/alxl/sizes.s xa-2.3.12/tests/alxl/sizes.s --- xa-2.3.11/tests/alxl/sizes.s 1970-01-01 00:00:00.000000000 +0000 +++ xa-2.3.12/tests/alxl/sizes.s 2021-11-25 04:21:44.000000000 +0000 @@ -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 + diff -Nru xa-2.3.11/tests/README xa-2.3.12/tests/README --- xa-2.3.11/tests/README 2020-05-03 21:04:15.000000000 +0000 +++ xa-2.3.12/tests/README 2021-11-25 04:21:32.000000000 +0000 @@ -43,6 +43,7 @@ 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