diff --git a/xa/ChangeLog b/xa/ChangeLog index c4d05dc..c09970f 100644 --- a/xa/ChangeLog +++ b/xa/ChangeLog @@ -352,3 +352,14 @@ xa-2.3.10 -- Cameron Kaiser 9 November 2019 +xa-2.3.11 + + * Compilation fix for gcc 10 (thanks Dan Horak). + * Allow pointer arithmetic in relocating mode within the same segment, since + the result is segmentless (thanks Andre for the report). + * .dsb with negative quantities shouldn't work (thanks Andre for the report). + * Stop a divide-by-zero floating point exception (thanks Frederic Cambus). + * Testsuite expanded. + + -- Cameron Kaiser 4 May 2020 + diff --git a/xa/Makefile b/xa/Makefile index d40e328..5da23e1 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.10.tar xa-2.3.10 ; gzip xa-2.3.10.tar + cd .. ; tar cvf xa-2.3.11.tar xa-2.3.11 ; gzip xa-2.3.11.tar test: xa uncpk cd tests && ./harness -make="$(MAKE)" -cc="$(CC)" -cflags="$(CFLAGS)" diff --git a/xa/src/xa.c b/xa/src/xa.c index 7965970..ca9f0f5 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.10" +#define progversion "v2.3.11" #define authors "Written by Andre Fachat, Jolse Maginnis, David Weinehall and Cameron Kaiser" -#define copyright "Copyright (C) 1989-2019 Andre Fachat, Jolse Maginnis, David Weinehall\nand Cameron Kaiser." +#define copyright "Copyright (C) 1989-2020 Andre Fachat, Jolse Maginnis, David Weinehall\nand Cameron Kaiser." /* exported globals */ int ncmos, cmosfl, w65816, n65816; diff --git a/xa/src/xaa.c b/xa/src/xaa.c index 73dd861..40885f7 100644 --- a/xa/src/xaa.c +++ b/xa/src/xaa.c @@ -98,7 +98,9 @@ static int ag_term(signed char *s, int p, int *v, int *nafl, int *label) afl = 0; -/*printf("ag_term(%02x %02x %02x %02x %02x %02x\n",s[0],s[1],s[2],s[3],s[4],s[5]);*/ +/* +printf("ag_term(%02x %02x %02x %02x %02x %02x\n",s[0],s[1],s[2],s[3],s[4],s[5]); +*/ while(s[pp]=='-') { pp++; @@ -119,8 +121,10 @@ static int ag_term(signed char *s, int p, int *v, int *nafl, int *label) if(s[pp]==T_LABEL) { er=l_get(cval(s+pp+1),v, &afl); -/* printf("label: er=%d, seg=%d, afl=%d, nolink=%d, fundef=%d\n", - er, segment, afl, nolink, fundef); */ +/* + printf("label: er=%d, seg=%d, afl=%d, nolink=%d, fundef=%d\n", + er, segment, afl, nolink, fundef); +*/ if(er==E_NODEF && segment != SEG_ABS && fundef ) { if( nolink || (afl==SEG_UNDEF)) { er = E_OK; @@ -136,7 +140,9 @@ static int ag_term(signed char *s, int p, int *v, int *nafl, int *label) { *v=lval(s+pp+1); pp+=4; -/* printf("value: v=%04x\n",*v); */ +/* +printf("value: v=%04x\n",*v); +*/ } else if(s[pp]==T_POINTER) @@ -144,7 +150,9 @@ static int ag_term(signed char *s, int p, int *v, int *nafl, int *label) afl = s[pp+1]; *v=cval(s+pp+2); pp+=4; -/* printf("pointer: v=%04x, afl=%04x\n",*v,afl); */ +/* +printf("pointer: v=%04x, afl=%04x\n",*v,afl); +*/ } else if(s[pp]=='*') @@ -178,9 +186,10 @@ static int ag_term(signed char *s, int p, int *v, int *nafl, int *label) if((afl && !*nafl) && o==2) { afl=(afl | *nafl); /* substract constant from pointer */ } else { - if(segment!=SEG_ABS) { + /* allow math in the same segment */ + if(segment!=SEG_ABS && segment != afl) { if(!dsb_len) { - er=E_ILLPOINTER; + er=E_ILLSEGMENT; } } afl=0; @@ -224,7 +233,7 @@ static int do_op(int *w,int w2,int o) *w *=w2; break; case 4: - if (w!=0) + if (w2!=0) *w /=w2; else er =E_DIV; diff --git a/xa/src/xap.h b/xa/src/xap.h index ba5f0ba..5d87778 100644 --- a/xa/src/xap.h +++ b/xa/src/xap.h @@ -35,7 +35,7 @@ int gm_pp(void); long gm_ppm(void); long ga_ppm(void); -Datei *filep; -char s[MAXLINE]; +extern Datei *filep; +extern char s[MAXLINE]; #endif /* __XA65_XAP_H__ */ diff --git a/xa/src/xat.c b/xa/src/xat.c index f601b3c..6f46ee7 100644 --- a/xa/src/xat.c +++ b/xa/src/xat.c @@ -1205,6 +1205,9 @@ fprintf(stderr, "mvn mvp: %i %i %i %i %i\n", t[0], t[i], wide, i, j); dsb_len = 1; if(!(er=a_term(t+1,&j,&i,pc[segment],&afl,&label,0))) { + if (j<0) + er=E_SYNTAX; + else /* if(t[i+1]!=',') er=E_SYNTAX; diff --git a/xa/tests/README b/xa/tests/README index 74c0686..3be8f70 100644 --- a/xa/tests/README +++ b/xa/tests/README @@ -30,7 +30,7 @@ incerr/ 1) .xl/.al should error without -w 2) error should be in the correct file ('816) binclude/ Binary include code with some weird casing ppstrings/ Don't substitute inside strings (unless -S) -neg_offset/ Test handling of negative offsets with/without relocation +neg_offset/ Test negative offsets/values with/without relocation chppch/ Changing preprocessor characters (-p) charset/ Tests of when charsets should be honoured and when not mvnmvp/ Test MVN MVP unusual addressing mode ('816) @@ -41,6 +41,8 @@ branch/ Branch range test masmcom/ Another test for -M that generates totally valid code 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) Cameron Kaiser, André Fachat diff --git a/xa/tests/csapiec/Makefile b/xa/tests/csapiec/Makefile new file mode 100644 index 0000000..01b22dc --- /dev/null +++ b/xa/tests/csapiec/Makefile @@ -0,0 +1,12 @@ +default: + # xa should not allow this to happen. if it does, this test is no good. + ../../xa -DBUG=1 -o test.o test.s || exit 0 && exit 1 + ../../xa -R -DBUG=1 -o testseg.o test.s || exit 0 && exit 1 + # xa *should* allow this to happen. + ../../xa -o test.o test.s + ../hextool -cmp=test.ok < test.o + ../../xa -R -o testseg.o test.s + ../hextool -cmp=testseg.ok < testseg.o + +clean: + rm -f *.o diff --git a/xa/tests/csapiec/test.ok b/xa/tests/csapiec/test.ok new file mode 100644 index 0000000..a28d7bb Binary files /dev/null and b/xa/tests/csapiec/test.ok differ diff --git a/xa/tests/csapiec/test.s b/xa/tests/csapiec/test.s new file mode 100644 index 0000000..da1723d --- /dev/null +++ b/xa/tests/csapiec/test.s @@ -0,0 +1,32 @@ + .text + +c0 =*-1 + +#ifdef BUG + .data +#endif + +cmdt .asc "$",0 +cow .asc "@",0 +c2 .asc "rename",0 +c3 .asc "scratch",0 +c4 .asc "copy",0 +c5 .asc "new",0 +c6 .asc "validate",0 +c7 .asc "initialize",0 +;c8 .asc "rmdir",0 +;c9 .asc "mkdir",0 +;c10 .asc "chdir",0 +c11 .asc "assign",0 +c12 .asc "cd",0 +c13 .asc "rd",0 +c14 .asc "md",0 +c15 .asc "drv",0 ; iec-bus-unit + +cmda .byt cmdt-c0 + .byt