mirror of
https://github.com/fachat/xa65.git
synced 2024-09-30 07:56:36 +00:00
merged xa-2.3.13 into listing
This commit is contained in:
commit
986ed9bbc2
21
xa/ChangeLog
21
xa/ChangeLog
@ -363,8 +363,29 @@ xa-2.3.11
|
|||||||
|
|
||||||
-- Cameron Kaiser <ckaiser@floodgap.com> 4 May 2020
|
-- Cameron Kaiser <ckaiser@floodgap.com> 4 May 2020
|
||||||
|
|
||||||
|
xa-2.3.12
|
||||||
|
|
||||||
|
* Regression fix for address size validation in 65816 mode (thanks Sam
|
||||||
|
Falvo; we had a pending fix for this but I like his test case).
|
||||||
|
* Testsuite expanded.
|
||||||
|
|
||||||
|
-- Cameron Kaiser <ckaiser@floodgap.com> 26 November 2021
|
||||||
|
|
||||||
|
xa-2.3.13
|
||||||
|
|
||||||
|
* Fix // and /* */ in quoted strings. Incredible no one ever hit this
|
||||||
|
before (thanks ZornsLemma).
|
||||||
|
* Segfault fixes for file65, reloc65 and xa. Remember, kids, if you ever
|
||||||
|
run xa as root all kittens will die. Please save the kittens (thanks
|
||||||
|
Stephen Kitt).
|
||||||
|
* Just compare to null in the preprocessor (thanks Bas Wassink).
|
||||||
|
* Testsuite expanded.
|
||||||
|
|
||||||
|
-- Cameron Kaiser <ckaiser@floodgap.com> 25 March 2022
|
||||||
|
|
||||||
xa-2.x.x
|
xa-2.x.x
|
||||||
|
|
||||||
|
* Listing feature
|
||||||
* Add -E commandline option to not stop after 20 errors, but show all
|
* Add -E commandline option to not stop after 20 errors, but show all
|
||||||
of them
|
of them
|
||||||
* Introduce -X compatibility set commandline option, to distinguish
|
* Introduce -X compatibility set commandline option, to distinguish
|
||||||
|
@ -53,7 +53,7 @@ clean:
|
|||||||
(cd src && ${MAKE} clean)
|
(cd src && ${MAKE} clean)
|
||||||
(cd loader && ${MAKE} clean)
|
(cd loader && ${MAKE} clean)
|
||||||
(cd misc && ${MAKE} mrproper)
|
(cd misc && ${MAKE} mrproper)
|
||||||
rm -f xa *.exe *.o65
|
rm -f xa *.exe *.o65 *.s
|
||||||
|
|
||||||
install: xa uncpk
|
install: xa uncpk
|
||||||
$(MKDIR) $(BINDIR)
|
$(MKDIR) $(BINDIR)
|
||||||
@ -63,7 +63,7 @@ install: xa uncpk
|
|||||||
#$(MKDIR) $(DOCDIR)/xa65
|
#$(MKDIR) $(DOCDIR)/xa65
|
||||||
|
|
||||||
dist: clean
|
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.13.tar xa-2.3.13 ; gzip xa-2.3.13.tar
|
||||||
|
|
||||||
test: xa uncpk
|
test: xa uncpk
|
||||||
cd tests && ./harness -make="$(MAKE)" -cc="$(CC)" -cflags="$(CFLAGS)"
|
cd tests && ./harness -make="$(MAKE)" -cc="$(CC)" -cflags="$(CFLAGS)"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.TH XA "1" "9 November 2019"
|
.TH XA "1" "24 November 2021"
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
xa \- 6502/R65C02/65816 cross-assembler
|
xa \- 6502/R65C02/65816 cross-assembler
|
||||||
@ -325,7 +325,7 @@ shift right (8)
|
|||||||
.B >= =>
|
.B >= =>
|
||||||
greater than or equal to (7)
|
greater than or equal to (7)
|
||||||
.TP
|
.TP
|
||||||
.B <
|
.B >
|
||||||
greater than (7)
|
greater than (7)
|
||||||
.TP
|
.TP
|
||||||
.B <= =<
|
.B <= =<
|
||||||
@ -1041,7 +1041,7 @@ This manual page was written by David Weinehall <tao@acc.umu.se>,
|
|||||||
Andre Fachat <fachat@web.de>
|
Andre Fachat <fachat@web.de>
|
||||||
and Cameron Kaiser <ckaiser@floodgap.com>.
|
and Cameron Kaiser <ckaiser@floodgap.com>.
|
||||||
Original xa package (C)1989-1997 Andre Fachat. Additional changes
|
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.
|
Cameron Kaiser. The official maintainer is Cameron Kaiser.
|
||||||
|
|
||||||
.SH 30 YEARS OF XA
|
.SH 30 YEARS OF XA
|
||||||
|
@ -101,13 +101,14 @@ int main(int argc, char *argv[]) {
|
|||||||
rompar = 1;
|
rompar = 1;
|
||||||
if(argv[i][1]=='A') rompar++;
|
if(argv[i][1]=='A') rompar++;
|
||||||
if(argv[i][2]) romoff = atoi(argv[i]+2);
|
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;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
xapar = 1;
|
xapar = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,"file65: %s unknown option\n",argv[i]);
|
fprintf(stderr,"%s: %s unknown option\n",programname,argv[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -85,6 +85,7 @@ int main(int argc, char *argv[]) {
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
int tflag = 0, dflag = 0, bflag = 0, zflag = 0;
|
int tflag = 0, dflag = 0, bflag = 0, zflag = 0;
|
||||||
int tbase = 0, dbase = 0, bbase = 0, zbase = 0;
|
int tbase = 0, dbase = 0, bbase = 0, zbase = 0;
|
||||||
|
int *base;
|
||||||
char *outfile = "a.o65";
|
char *outfile = "a.o65";
|
||||||
int extract = 0;
|
int extract = 0;
|
||||||
int verbose = 0;
|
int verbose = 0;
|
||||||
@ -113,37 +114,40 @@ int main(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
if(argv[i][2]) outfile=argv[i]+2;
|
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;
|
break;
|
||||||
case 'X':
|
case 'X':
|
||||||
extract=3;
|
extract=3;
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
|
base=NULL;
|
||||||
switch(argv[i][2]) {
|
switch(argv[i][2]) {
|
||||||
case 't':
|
case 't':
|
||||||
tflag= 1;
|
tflag= 1;
|
||||||
if(argv[i][3]) tbase = atoi(argv[i]+3);
|
base=&tbase;
|
||||||
else tbase = atoi(argv[++i]);
|
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
dflag= 1;
|
dflag= 1;
|
||||||
if(argv[i][3]) dbase = atoi(argv[i]+3);
|
base=&dbase;
|
||||||
else dbase = atoi(argv[++i]);
|
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
bflag= 1;
|
bflag= 1;
|
||||||
if(argv[i][3]) bbase = atoi(argv[i]+3);
|
base=&bbase;
|
||||||
else bbase = atoi(argv[++i]);
|
|
||||||
break;
|
break;
|
||||||
case 'z':
|
case 'z':
|
||||||
zflag= 1;
|
zflag= 1;
|
||||||
if(argv[i][3]) zbase = atoi(argv[i]+3);
|
base=&zbase;
|
||||||
else zbase = atoi(argv[++i]);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("Unknown segment type '%c' - ignored!\n", argv[i][2]);
|
printf("Unknown segment type '%c' - ignored!\n", argv[i][2]);
|
||||||
break;
|
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;
|
break;
|
||||||
case 'x': /* extract segment */
|
case 'x': /* extract segment */
|
||||||
switch(argv[i][2]) {
|
switch(argv[i][2]) {
|
||||||
@ -163,7 +167,7 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
42
xa/src/xa.c
42
xa/src/xa.c
@ -56,9 +56,9 @@
|
|||||||
#define ANZWARN 13
|
#define ANZWARN 13
|
||||||
|
|
||||||
#define programname "xa"
|
#define programname "xa"
|
||||||
#define progversion "v2.3.11+af"
|
#define progversion "v2.3.13+af"
|
||||||
#define authors "Written by Andre Fachat, Jolse Maginnis, David Weinehall and Cameron Kaiser"
|
#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-2022 Andre Fachat, Jolse Maginnis, David Weinehall\nand Cameron Kaiser."
|
||||||
|
|
||||||
/* exported globals */
|
/* exported globals */
|
||||||
int ncmos, cmosfl, w65816, n65816;
|
int ncmos, cmosfl, w65816, n65816;
|
||||||
@ -248,7 +248,11 @@ int main(int argc,char *argv[])
|
|||||||
{
|
{
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
if (argv[i][2] == 0) {
|
if (argv[i][2] == 0) {
|
||||||
name = argv[++i];
|
if (i + 1 < argc) name = argv[++i];
|
||||||
|
else {
|
||||||
|
fprintf(stderr, "-O requires an argument\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
name = argv[i]+2;
|
name = argv[i]+2;
|
||||||
}
|
}
|
||||||
@ -260,7 +264,13 @@ int main(int argc,char *argv[])
|
|||||||
case 'A': /* make text segment start so that text relocation
|
case 'A': /* make text segment start so that text relocation
|
||||||
is not necessary when _file_ starts at adr */
|
is not necessary when _file_ starts at adr */
|
||||||
romable = 2;
|
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);
|
else romaddr = atoi(argv[i]+2);
|
||||||
break;
|
break;
|
||||||
case 'G':
|
case 'G':
|
||||||
@ -308,7 +318,11 @@ int main(int argc,char *argv[])
|
|||||||
break;
|
break;
|
||||||
case 'I':
|
case 'I':
|
||||||
if(argv[i][2]==0) {
|
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 {
|
} else {
|
||||||
reg_include(argv[i]+2);
|
reg_include(argv[i]+2);
|
||||||
}
|
}
|
||||||
@ -329,21 +343,33 @@ int main(int argc,char *argv[])
|
|||||||
break;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
if(argv[i][2]==0) {
|
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 {
|
} else {
|
||||||
ofile=argv[i]+2;
|
ofile=argv[i]+2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
if(argv[i][2]==0) {
|
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 {
|
} else {
|
||||||
lfile=argv[i]+2;
|
lfile=argv[i]+2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
if(argv[i][2]==0) {
|
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 {
|
} else {
|
||||||
efile=argv[i]+2;
|
efile=argv[i]+2;
|
||||||
}
|
}
|
||||||
|
56
xa/src/xap.c
56
xa/src/xap.c
@ -62,6 +62,8 @@ static int pp_undef(char*);
|
|||||||
#define VALBEF 6
|
#define VALBEF 6
|
||||||
|
|
||||||
static int ungeteof = 0;
|
static int ungeteof = 0;
|
||||||
|
static int quotebs = 0;
|
||||||
|
static int inquote = 0;
|
||||||
|
|
||||||
static char *cmd[]={ "echo","include","define","undef","printdef","print",
|
static char *cmd[]={ "echo","include","define","undef","printdef","print",
|
||||||
"ifdef","ifndef","else","endif",
|
"ifdef","ifndef","else","endif",
|
||||||
@ -886,7 +888,7 @@ int pp_open(char *name)
|
|||||||
flist[0].filep=fp;
|
flist[0].filep=fp;
|
||||||
flist[0].flinep=NULL;
|
flist[0].flinep=NULL;
|
||||||
|
|
||||||
return(((long)fp)==0l);
|
return (fp == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pp_close(void)
|
void pp_close(void)
|
||||||
@ -1017,6 +1019,7 @@ int pgetline(char *t)
|
|||||||
int c,er=E_OK;
|
int c,er=E_OK;
|
||||||
int rlen, tlen;
|
int rlen, tlen;
|
||||||
char *p = 0;
|
char *p = 0;
|
||||||
|
char *q = 0;
|
||||||
|
|
||||||
loopfl =0; /* set if additional fetch needed */
|
loopfl =0; /* set if additional fetch needed */
|
||||||
|
|
||||||
@ -1075,6 +1078,40 @@ int pgetline(char *t)
|
|||||||
errout(E_OPENPP);
|
errout(E_OPENPP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* handle the double-slash comment (like in C++) */
|
||||||
|
/* get p past any quoted strings */
|
||||||
|
p = strchr(in_line, '/');
|
||||||
|
if (p != NULL) {
|
||||||
|
q = strchr(in_line, '"');
|
||||||
|
for(;;) {
|
||||||
|
/* no more quotes to skip, or slashes before quotes */
|
||||||
|
if (q == NULL || (p < q)) {
|
||||||
|
if (p[1] == '/') {
|
||||||
|
/* truncate line, done with loop */
|
||||||
|
*p = 0;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
/* wasn't //, but could be later */
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* quote before slash, so skip string */
|
||||||
|
q++;
|
||||||
|
while (*q != 0 && *q != '"') {
|
||||||
|
if (*q == '\\') q++;
|
||||||
|
if (*q != 0) q++;
|
||||||
|
}
|
||||||
|
if (*q == 0) break; /* oops */
|
||||||
|
q++;
|
||||||
|
p = q;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = strchr(p, '/');
|
||||||
|
if (p == NULL) break; /* never mind */
|
||||||
|
if (q != NULL) q = strchr(q, '"');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!er || loopfl) {
|
if(!er || loopfl) {
|
||||||
in_line[0]='\0';
|
in_line[0]='\0';
|
||||||
}
|
}
|
||||||
@ -1138,15 +1175,22 @@ int egetc(FILE *fp) {
|
|||||||
/* smart getc that can skip C comment blocks */
|
/* smart getc that can skip C comment blocks */
|
||||||
int rgetc(FILE *fp)
|
int rgetc(FILE *fp)
|
||||||
{
|
{
|
||||||
static int c,d,fl;
|
static int c,cc,d,fl;
|
||||||
|
cc=0;
|
||||||
fl=0;
|
fl=0;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
while((c=egetc(fp))==13); /* remove ^M for unices */
|
while((c=egetc(fp))==13); /* remove ^M for unices */
|
||||||
|
|
||||||
if(fl && (c=='*'))
|
/* flag if we're in a quoted string */
|
||||||
|
if(c=='"' && !quotebs) inquote ^= 1;
|
||||||
|
#if(0)
|
||||||
|
/* implement backslashed quotes for 2.4 */
|
||||||
|
if(c=='\\') quotebs=1; else quotebs=0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(!inquote && fl && (c=='*'))
|
||||||
{
|
{
|
||||||
if((d=egetc(fp))!='/')
|
if((d=egetc(fp))!='/')
|
||||||
ungetc(d,fp);
|
ungetc(d,fp);
|
||||||
@ -1156,12 +1200,14 @@ int rgetc(FILE *fp)
|
|||||||
while((c=egetc(fp))==13);
|
while((c=egetc(fp))==13);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* in comment block */
|
||||||
if(c=='\n')
|
if(c=='\n')
|
||||||
{
|
{
|
||||||
flist[fsp].fline++;
|
flist[fsp].fline++;
|
||||||
nlf=1;
|
nlf=1;
|
||||||
} else
|
} else
|
||||||
if(c=='/')
|
if(!inquote && c=='/')
|
||||||
{
|
{
|
||||||
if((d=egetc(fp))!='*')
|
if((d=egetc(fp))!='*')
|
||||||
ungetc(d,fp);
|
ungetc(d,fp);
|
||||||
|
35
xa/src/xat.c
35
xa/src/xat.c
@ -194,8 +194,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
|
* opcodes for each addressing mode
|
||||||
* high byte: supported architecture (no bits = original NMOS 6502)
|
* high byte: supported architecture (no bits = original NMOS 6502)
|
||||||
* bit 1: R65C02
|
* bit 1: R65C02
|
||||||
* bit 2: 65816
|
* bit 2: 65816 and allows 16-bit quantity (accum only)
|
||||||
* bit 3: 65816 and allows 16-bit quantity (immediate only)
|
* bit 3: 65816 and allows 16-bit quantity (index only)
|
||||||
* low byte: opcode itself
|
* low byte: opcode itself
|
||||||
*
|
*
|
||||||
* each opcode is indexed in this order: *=65816, ^=R65C02
|
* each opcode is indexed in this order: *=65816, ^=R65C02
|
||||||
@ -1767,8 +1767,8 @@ fprintf(stderr, "Kdsb E_DSB %i\n", j);
|
|||||||
{
|
{
|
||||||
#ifdef DEBUG_AM
|
#ifdef DEBUG_AM
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"b4: pc= %d, am = %d and vv[0] = %d, optimize = %d, bitmask = %u, er=%d\n",
|
"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);
|
pc[segment], am, vv[0], fl, (vv[0]&0xffff00), er, bl);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* terrible KLUDGE!!!! OH NOES!!!1!
|
/* terrible KLUDGE!!!! OH NOES!!!1!
|
||||||
@ -1784,8 +1784,8 @@ fprintf(stderr,
|
|||||||
am=opt[am];
|
am=opt[am];
|
||||||
#ifdef DEBUG_AM
|
#ifdef DEBUG_AM
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"aftaa1: pc= %d, am = %d and vv[0] = %d, optimize = %d, bitmask = %d\n",
|
"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));
|
pc[segment], am, vv[0], fl, (vv[0]&0xffff00), bl);
|
||||||
#endif
|
#endif
|
||||||
if(cast!='!') {
|
if(cast!='!') {
|
||||||
if(bl && !er && !(vv[0]&0xffff00) && opt[am]>=0) {
|
if(bl && !er && !(vv[0]&0xffff00) && opt[am]>=0) {
|
||||||
@ -1800,8 +1800,8 @@ fprintf(stderr,
|
|||||||
}
|
}
|
||||||
#ifdef DEBUG_AM
|
#ifdef DEBUG_AM
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"aftaa2: pc=%d, am=%d and vv[0]=%d, optimize=%d, bitmask=%d, op=%d\n",
|
"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]]);
|
pc[segment], am, vv[0], fl, (vv[0]&0xffff00), ct[n][opt[am]], bl);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1810,17 +1810,16 @@ fprintf(stderr,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
bl=le[am];
|
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) {
|
if ((am != 11 && am != 16) && (vv[0] > 255 || vv[0] < -256) && bl == 2) {
|
||||||
er = E_OVERFLOW;
|
er = E_OVERFLOW;
|
||||||
} else
|
} else
|
||||||
if ((am != 11 && am != 16) && (vv[0] > 65535 || vv[0] < -65536) && (bl == 2 || bl == 3)) {
|
if ((am != 11 && am != 16) && (vv[0] > 65535 || vv[0] < -65536) && (bl == 2 || bl == 3)) {
|
||||||
er = E_OVERFLOW;
|
er = E_OVERFLOW;
|
||||||
} else
|
|
||||||
if( ((ct[n][am]&0x400) && memode) || ((ct[n][am]&0x800) && xmode)) {
|
|
||||||
bl++;
|
|
||||||
}
|
}
|
||||||
*ll=bl;
|
*ll=bl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_AM
|
#ifdef DEBUG_AM
|
||||||
@ -2607,7 +2606,7 @@ static void tg_hex(signed char *s, int *l, int *v)
|
|||||||
static int tg_asc(signed char *s, signed char *t, int *q, int *p, int *na1, int *na2,int n)
|
static int tg_asc(signed char *s, signed char *t, int *q, int *p, int *na1, int *na2,int n)
|
||||||
{
|
{
|
||||||
|
|
||||||
int er=E_OK,i=0,j=0;
|
int er=E_OK,i=0,j=0,bs=0;
|
||||||
|
|
||||||
signed char delimiter = s[i++];
|
signed char delimiter = s[i++];
|
||||||
|
|
||||||
@ -2618,8 +2617,16 @@ fprintf(stderr, "tg_asc token = %i\n", n);
|
|||||||
t[j++]='"'; /* pass2 token for string */
|
t[j++]='"'; /* pass2 token for string */
|
||||||
j++; /* skip place for length */
|
j++; /* skip place for length */
|
||||||
|
|
||||||
while(s[i]!='\0' && s[i]!=delimiter)
|
while(s[i]!='\0' && (bs || s[i]!=delimiter))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#if(0)
|
||||||
|
/* implement backslashed quotes for 2.4 */
|
||||||
|
if(n != Kbin && s[i] == '\\' && !bs) {
|
||||||
|
fprintf(stderr, "B"); bs=1; i++; continue;
|
||||||
|
} else bs=0;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* do NOT convert for Kbin or Kaasc, or for initial parse */
|
/* do NOT convert for Kbin or Kaasc, or for initial parse */
|
||||||
if (!n || n == Kbin || n == Kaasc) {
|
if (!n || n == Kbin || n == Kaasc) {
|
||||||
t[j++]=s[i];
|
t[j++]=s[i];
|
||||||
|
@ -45,6 +45,7 @@ quotch/ Test quoting problematic characters (thanks Simon Rowe)
|
|||||||
linkr/ Test linking using .dsb and generated code
|
linkr/ Test linking using .dsb and generated code
|
||||||
csapiec/ Test on pointer arithmetic in relocating mode
|
csapiec/ Test on pointer arithmetic in relocating mode
|
||||||
math/ Math tests (currently divide by zero, thanks Frederic Cambus)
|
math/ Math tests (currently divide by zero, thanks Frederic Cambus)
|
||||||
|
alxl/ Various '816 width tests (includes Samuel Falvo's test)
|
||||||
|
|
||||||
Cameron Kaiser, André Fachat
|
Cameron Kaiser, André Fachat
|
||||||
|
|
||||||
|
24
xa/tests/alxl/Makefile
Normal file
24
xa/tests/alxl/Makefile
Normal file
@ -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
|
1
xa/tests/alxl/alxl.ok
Normal file
1
xa/tests/alxl/alxl.ok
Normal file
@ -0,0 +1 @@
|
|||||||
|
<EFBFBD><10>4<12>4<12>4
|
13
xa/tests/alxl/alxl.s
Normal file
13
xa/tests/alxl/alxl.s
Normal file
@ -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
|
1
xa/tests/alxl/alxlo1.ok
Normal file
1
xa/tests/alxl/alxlo1.ok
Normal file
@ -0,0 +1 @@
|
|||||||
|
<EFBFBD><10>4
|
10
xa/tests/alxl/alxlo1.s
Normal file
10
xa/tests/alxl/alxlo1.s
Normal file
@ -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
|
1
xa/tests/alxl/alxlo2.ok
Normal file
1
xa/tests/alxl/alxlo2.ok
Normal file
@ -0,0 +1 @@
|
|||||||
|
<EFBFBD><10>4<12>4
|
10
xa/tests/alxl/alxlo2.s
Normal file
10
xa/tests/alxl/alxlo2.s
Normal file
@ -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
|
12
xa/tests/alxl/alxlx1.s
Normal file
12
xa/tests/alxl/alxlx1.s
Normal file
@ -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
|
11
xa/tests/alxl/alxlx2.s
Normal file
11
xa/tests/alxl/alxlx2.s
Normal file
@ -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
|
10
xa/tests/alxl/alxlx3.s
Normal file
10
xa/tests/alxl/alxlx3.s
Normal file
@ -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
|
BIN
xa/tests/alxl/sizes.ok
Normal file
BIN
xa/tests/alxl/sizes.ok
Normal file
Binary file not shown.
22
xa/tests/alxl/sizes.s
Normal file
22
xa/tests/alxl/sizes.s
Normal file
@ -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
|
||||||
|
|
@ -55,6 +55,7 @@ W: while($x = readdir(D)) {
|
|||||||
chdir("..");
|
chdir("..");
|
||||||
}
|
}
|
||||||
closedir(D);
|
closedir(D);
|
||||||
|
print STDOUT "=" x 79, "\n";
|
||||||
print STDOUT "\n## ALL TESTS PASS ##\n";
|
print STDOUT "\n## ALL TESTS PASS ##\n";
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
BIN
xa/tests/stringcom/ok
Normal file
BIN
xa/tests/stringcom/ok
Normal file
Binary file not shown.
21
xa/tests/stringcom/test.s
Normal file
21
xa/tests/stringcom/test.s
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
* = $e00
|
||||||
|
.byt 10/2 // watchs // phlegm
|
||||||
|
/* .word 10/2 */ .word 65536/2
|
||||||
|
// .byt 9/9 // yo mama
|
||||||
|
// .asc "FAIL"
|
||||||
|
.asc "SIEx256SN" // foo
|
||||||
|
.asc "SIE/256SN" // bar
|
||||||
|
.asc "SIE//256SN" // bar
|
||||||
|
.asc "SIEy256SN" // baz
|
||||||
|
.asc "PASS/*PASS*///PASS//PASS"
|
||||||
|
|
||||||
|
#if(0)
|
||||||
|
/* enable when backslashed quotes are supported in 2.4 */
|
||||||
|
.asc "PASS\"\\PASS/*PASS*///PASS//\"\\PASS"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
.asc "SIE/*256*/N"
|
||||||
|
/* .asc "SIE/*256*/N"
|
||||||
|
.asc "FAIL"
|
||||||
|
*/ .asc "PASS" // .asc "FAIL" /* .asc "FAIL*/" */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user