Merge branch 'master' into testsuite

This commit is contained in:
Andre Fachat 2018-09-21 14:25:00 +02:00
commit f7adc1cf18
51 changed files with 3566 additions and 109 deletions

2
README
View File

@ -10,7 +10,7 @@ Due to current time constraints Cameron can not do any updates, so I decided to
These are the directories:
xa - contains the main source. The master branch is the stable version (currently 2.3.5)
xa - contains the main source. The master branch is the stable version
These are the current branches:

View File

@ -305,6 +305,26 @@ xa-2.3.6
-- Cameron Kaiser <ckaiser@floodgap.com> 11 July 2014
xa-2.3.7
* Fixed buffer overflow and test failure with gcc 4.9 (thanks Adam Sampson).
* mvn and mvp now use the standard syntax (thanks Alessandro Gatti).
* Copyright message is no longer put in the error log to simplify testing.
* Makefile properly triggers a relink for testing or source changes.
* Spurious messages quelled.
* Documentation updated.
* Testsuite expanded.
-- Cameron Kaiser <ckaiser@floodgap.com> 29 December 2014
xa-2.3.8
* Fixed issue with colons in string literals being treated as separators
(thanks Simon Rowe).
* Testsuite expanded.
-- Cameron Kaiser <ckaiser@floodgap.com> 29 June 2017
xa-2.x.x
* Add -E commandline option to not stop after 20 errors, but show all
@ -325,3 +345,4 @@ xa-2.x.x
* add test suite code
-- André Fachat <afachat@gmx.de> 20 August, 2014

View File

@ -4,7 +4,7 @@ CC = gcc
LD = gcc
# for testing. not to be used; build failures in misc/.
#CFLAGS = -O2 -W -Wall -pedantic -ansi
CFLAGS = -O2
CFLAGS = -O2 -D_XOPEN_SOURCE=600
LDFLAGS = -lc
# for DOS?
@ -26,7 +26,10 @@ DOCDIR = $(DESTDIR)/share/doc
MKDIR = mkdir -p
INSTALL = install
all: xa uncpk
all: killxa xa uncpk
killxa:
rm -f xa
xa:
(cd src && LD=${LD} CC="${CC} ${CFLAGS}" ${MAKE})
@ -60,8 +63,8 @@ install: xa uncpk
#$(MKDIR) $(DOCDIR)/xa65
dist: clean
#cd .. ; tar cvf xa-2.3.6A.tar xa-2.3.6 ; gzip xa-2.3.6A.tar
cd .. ; tar cvf xa-2.3.6.tar xa-2.3.6 ; gzip xa-2.3.6.tar
#cd .. ; tar cvf xa-2.3.8A.tar xa-2.3.8 ; gzip xa-2.3.8A.tar
cd .. ; tar cvf xa-2.3.8.tar xa-2.3.8 ; gzip xa-2.3.8.tar
test:
test: xa uncpk
cd tests && ./harness -make="$(MAKE)" -cc="$(CC)" -cflags="$(CFLAGS)"

View File

@ -3,8 +3,7 @@ derivatives). xa is a small, fast, portable two-pass assembler that compiles
under most ANSI C compilers. It is distributed under the GNU Public License
(see COPYING).
The current version is 2.3.4, which implements multiple improvements on
2.3.2, a bug fix to the 2.3.0 version. 2.3.0 itself features many
The current version is 2.3.8, a bug fix to the long-lived 2.3.0, itself with
compatibility improvements and new man-based documentation. It also completed
the merge of the 65816 and 6502/R65C02 versions and thus the current xa can
generate code for all targets now.
@ -12,6 +11,7 @@ generate code for all targets now.
To install on a generic Unixy thing, you should be able to just type
% make # to build the executable, and if it works ...
% make test # if you have Perl, make and prerequisites, otherwise
% make install # to install man pages and binaries into the system
This will create xa along with its various support utilities. Try assembling

View File

@ -1,4 +1,4 @@
.TH XA "1" "7 February 2009"
.TH XA "1" "29 June 2017"
.SH NAME
xa \- 6502/R65C02/65816 cross-assembler
@ -844,6 +844,16 @@ and
.B dec
instructions respectively.
.LP
The 65816 instructions
.B mvn
and
.B mvp
use two eight bit parameters, the only instructions in the entire
instruction set to do so. Older versions of
.B xa
took a single 16-bit absolute value. Since 2.3.7, the standard syntax is
now accepted and the old syntax is deprecated (a warning will be generated).
.LP
Forward-defined labels -- that is, labels that are defined after the current
instruction is processed -- cannot be optimized into zero
page instructions even if the label does end up being defined as a zero page
@ -889,7 +899,7 @@ This manual page was written by David Weinehall <tao@acc.umu.se>,
Andre Fachat <fachat@web.de>
and Cameron Kaiser <ckaiser@floodgap.com>.
Original xa package (C)1989-1997 Andre Fachat. Additional changes
(C)1989-2011 Andre Fachat, Jolse Maginnis, David Weinehall,
(C)1989-2017 Andre Fachat, Jolse Maginnis, David Weinehall,
Cameron Kaiser. The official maintainer is Cameron Kaiser.
.SH WEBSITE

View File

@ -56,9 +56,9 @@
#define ANZWARN 13
#define programname "xa"
#define progversion "v2.3.6+af"
#define progversion "v2.3.8+af"
#define authors "Written by Andre Fachat, Jolse Maginnis, David Weinehall and Cameron Kaiser"
#define copyright "Copyright (C) 1989-2014 Andre Fachat, Jolse Maginnis, David Weinehall\nand Cameron Kaiser."
#define copyright "Copyright (C) 1989-2017 Andre Fachat, Jolse Maginnis, David Weinehall\nand Cameron Kaiser."
/* exported globals */
int ncmos, cmosfl, w65816, n65816;
@ -402,6 +402,7 @@ int main(int argc,char *argv[])
if(setfext(old_o,".obj")==0) ofile = old_o;
if(setfext(old_l,".lab")==0) lfile = old_l;
}
if(verbose) fprintf(stderr, "%s\n",copyright);
if (printfile!=NULL && !strcmp(printfile, "-")) {
printfile=NULL;
@ -422,8 +423,7 @@ int main(int argc,char *argv[])
exit(1);
}
if(verbose) fprintf(stderr, "%s\n",copyright);
//if(verbose) fprintf(stderr, "%s\n",copyright);
if(1 /*!m_init()*/)
{
@ -435,7 +435,7 @@ int main(int argc,char *argv[])
{
if(!x_init())
{
if(fperr) fprintf(fperr,"%s\n",copyright);
/* if(fperr) fprintf(fperr,"%s\n",copyright); */
if(verbose) logout(ctime(&tim1));
list_setfile(fplist);
@ -870,7 +870,6 @@ static int pass1(void)
}
if(er!=E_EOF) {
fprintf(stderr, "foul through\n");
errout(er);
}
@ -1024,10 +1023,10 @@ static char *ertxt[] = {
"Open preprocessor directive at end of file (intentional?)",
"Included binary data exceeds 64KB",
"Included binary data exceeds 16MB",
"MVN/MVP $XXXX syntax is deprecated and will be removed",
/* more placeholders */
"",
"",
"",
};
@ -1146,13 +1145,16 @@ static int xa_getline(char *s)
do {
c=s[j]=l[i++];
if (c=='\"') {
if (!(hkfl&2) && c=='\"') {
hkfl^=1;
}
if (!comcom && !(hkfl&1) && c=='\'') {
hkfl^=2;
}
if (c==';' && !hkfl) {
// start of comment
comcom = 1;
}
if (c=='\0') {
// end of line
break; /* hkfl = comcom = 0 */

View File

@ -136,7 +136,7 @@ typedef struct {
#define E_OUTOFDATA -34 /* out of data */
#define E_ILLQUANT -35 /* generic illegal quantity error */
#define E_BIN -36 /* okdef */
/* errors thru 64 are placeholders */
/* errors thru 64 are placeholders available for use */
#define W_ADRRELOC -65 /* word relocation in byte value */
#define W_BYTRELOC -66 /* byte relocation in word value */
@ -148,7 +148,8 @@ typedef struct {
#define W_OPENPP -72 /* warning about open preprocessor directive */
#define W_OVER64K -73 /* included binary over 64K in 6502 mode */
#define W_OVER16M -74 /* included binary over 16M in 65816 mode */
/* warnings 75-77 are placeholders */
#define W_OLDMVNS -75 /* use of old mv? $xxxx syntax */
/* warnings 76-77 are placeholders available for use */
/* Meta-values for the token list. Note must not overlap with the
* K* definitions in xat.c, which have outgrown the positive numbers

View File

@ -215,14 +215,22 @@ int pp_endif(char *t)
/* stub for handling CPP directives */
int pp_cpp(char *t) {
char name[MAXLINE];
if(sscanf(t, " %d \"%s\"", &filep->fline, filep->fname) == 2) {
if(sscanf(t, " %d \"%s\"", &filep->fline, name) == 2) {
/* massage it into our parameters and drop last quote */
char *u = "";
char *u;
filep->fline--;
if((u = (char *)strrchr(filep->fname, '"')))
if((u = (char *)strrchr(name, '"')))
*u = '\0';
free(filep->fname);
filep->fname = strdup(name);
if(!filep->fname) {
fprintf(stderr,"Oops, no more memory!\n");
exit(1);
}
return (0);
} else {
return(E_SYNTAX);

View File

@ -114,6 +114,10 @@ char *arith_ops[] = {
/* length of arithmetic operators indexed by operator number */
static int lp[]= { 0,1,1,1,1,2,2,1,1,1,2,2,2,1,1,1,2,2 };
/* mvn and mvp are handled specially, they have a weird syntax */
#define Kmvp 38
#define Kmvn Kmvp+1
/* index into token array for pseudo-ops */
/* last valid mnemonic */
#define Lastbef 93
@ -790,7 +794,7 @@ printf(" wrote %02x %02x %02x %02x %02x %02x, %02x, %02x\n",
/* optimization okay on pass 1: use 0 for fl */
{
#ifdef DEBUG_AM
fprintf(stderr, "E_OK ... t_p2 xat.c\n");
fprintf(stderr, "E_OK ... t_p2 xat.c %i %i\n", t[0], *ll);
#endif
/* this actually calls pass2 on the current tokenization stream,
* but without including the Klisting token listing */
@ -819,7 +823,7 @@ fprintf(stderr, "E_NODEF pass1 xat.c\n");
/* choose addressing mode; add commas found */
if(n>=0 && n<=Lastbef)
if(n>=0 && n<=Lastbef && n != Kmvn && n != Kmvp) /* not for mvn/p */
{
int inp = 1; /* input pointer */
@ -968,6 +972,11 @@ fprintf(stderr, "E_NODEF pass1 xat.c\n");
}
er=E_NOLINE;
} else
if(n==Kmvn || n==Kmvp)
{
bl=3;
if (!w65816) er = E_65816;
} else
if(n==Kbyt || n==Kasc || n==Kaasc)
{
#ifdef DEBUG_AM
@ -1224,7 +1233,9 @@ int t_p2(signed char *t, int *ll, int fl, int *al)
}
*ll=j;
bl=j;
} else if (n == Kbin) {
} else
if (n == Kbin)
{
int j;
int l;
@ -1342,6 +1353,61 @@ int t_p2(signed char *t, int *ll, int fl, int *al)
er = E_BIN;
}
}
} else
if (n==Kmvn || n==Kmvp)
{
/* special case these instructions' syntax */
int wide=0;
i=1;
j=1;
/* write opcode */
t[0] = ((n == Kmvp) ? 0x44 : 0x54);
while(!er && t[i]!=T_END)
{
if (wide) /* oops */
er = E_SYNTAX;
#ifdef DEBUG_AM
fprintf(stderr, "mvn mvp: %i %i %i %i %i\n", t[0], t[i], wide, i, j);
#endif
if(!(er=a_term(t+i,&v,&l,pc[segment],&afl,&label,1)))
{
/*if(afl) printf("relocation 1 %04x at pc=$%04x, value now =$%04x\n",
afl,pc[segment],v); */
if(afl) u_set(pc[segment]+j, afl, label, 2);
i+=l;
/* for backwards compatibility, accept the old
mv? $xxxx syntax, but issue a warning.
mv? $00xx can be legal, so accept that too. */
if ((v & 0xff00) || (j==1 && t[i]==T_END)) {
errout(W_OLDMVNS);
wide = 1;
t[j++] = ((v & 0xff00) >> 8);
t[j++] = (v & 0x00ff);
} else {
t[j++] = v;
}
}
if (j > 3)
er=E_SYNTAX;
if(t[i]!=T_END && t[i]!=',')
er=E_SYNTAX;
else
if(t[i]==',')
i++;
}
if (j != 3) er = E_SYNTAX; /* oops */
/* before we leave, swap the bytes. although disassembled as
mv? src,dest it's actually represented as
mv? $ddss -- see
http://6502org.wikidot.com/software-65816-memorymove */
i = t[2];
t[2] = t[1];
t[1] = i;
*ll = j;
bl = j;
if (!w65816) er = E_65816;
} else if(n==Kasc || n==Kbyt || n==Kaasc) {
i=1;
j=0;
@ -1722,14 +1788,13 @@ fprintf(stderr,
#endif
}
if(!bl)
if(!bl) {
er=E_SYNTAX;
else
{
} else {
bl=le[am];
if( ((ct[n][am]&0x400) && memode) || ((ct[n][am]&0x800) && xmode)) {
bl++;
}
}
*ll=bl;
}
@ -2026,8 +2091,9 @@ static int t_conv(signed char *s, signed char *t, int *l, int pc, int *nk,
}
if(n>=0 && n<=Lastbef)
if(n != Kmvn && n != Kmvp && ((n & 0xff) <=Lastbef)) {
mk=1; /* 1= nur 1 Komma erlaubt *//* = only 1 comma ok */
}
}
if(s[p]=='\0' || s[p]==';')

View File

@ -9,13 +9,15 @@ unless 'make test' fails. If you do, use harness:
If -tests is omitted, all tests are run.
Don't run the makefiles directly, if they exist; they may not work properly.
If a Makefile is not present, then the test harness assembles "test.s" and
compares it with "ok".
adrm/ Addressing mode test (especially the optimizer and quantity
prefixes)
nonl/ Patryk's no-new-line-on-last-line cases ;)
fordef/ Optimizer warnings for forward defined labels
relocundef/ Tests for the detection of undefined references during a
reloc65 export.
reloc65 export
ldoreloc/ Test case for the relocation table reading of ldo when undef'd
refs are involved
comcom/ Comments-with-comments-with-commands-etc. for testing -M
@ -23,12 +25,19 @@ recmac/ Recursive macro evaluation testing
openpp/ Testing of open #if*s in pp
cpp/ Random preprocessor tests, mostly crap
incerr/ 1) .xl/.al should error without -w 2) error should be in
the correct file
the correct file ('816)
binclude/ Binary include code with some weird casing
chppch/ Changing preprocessor characters (-p)
charset/ Tests of when charsets should be honoured and when not
cc65/ Compatibility tests for ca65 compatibility
relmode/ tests concerning switches between segments and absolute mode
mvnmvp/ Test MVN MVP unusual addressing mode ('816)
dos51/ Regression test, label scoping, "real world code"
cpktest/ Regression test, label listing, "real world code"
op816/ Regression test for '816 opcodes (thanks Alessandro Gatti)
branch/ Branch range test
masmcom/ Another test for -M that generates totally valid code
quotch/ Test quoting problematic characters (thanks Simon Rowe)
Cameron Kaiser, André Fachat

9
xa/tests/branch/Makefile Normal file
View File

@ -0,0 +1,9 @@
default:
# xa should not allow this to happen. if it does, this test is no good.
../../xa bor.s || exit 0 && exit 1
# expected-to-fail tests did fail. should be no more errors now.
../../xa -w bir.s -o test.o
../hextool -cmp=bir.ok < test.o
clean:
rm -f *.o

BIN
xa/tests/branch/bir.ok Normal file

Binary file not shown.

14
xa/tests/branch/bir.s Normal file
View File

@ -0,0 +1,14 @@
/* just in range */
bcc pdq
pdq
bne xyz
.dsb 124,6
xyz
beq pdq
bcs xyz
bvs xyz
bvc xyz
bpl xyz
bmi xyz

14
xa/tests/branch/bor.s Normal file
View File

@ -0,0 +1,14 @@
/* just in range */
bcc pdq
pdq
bne xyz
.dsb 125,6
xyz
beq pdq
bcs xyz
bvs xyz
bvc xyz
bpl xyz
bmi xyz

View File

@ -1,16 +0,0 @@
*=$033c
lda #"A"
lda #'A'
.asc "12345"
.asc '12345'
.asc "^"" ; ^ is escape character
.asc '^''
.asc "'"
.asc '"'
.asc "^1"

View File

@ -1,16 +0,0 @@
.word $9000
* = $9000
w = 10
.bin 0,10+w,"README.1st"
.bin 0,10,"README.1st"
#include "test2.s"
.byt "FooBar"
.aasc "FooBar"
.asc "FooBar",65,97,10
.aasc "FooBar"
.bin 0,10,"README.1st"
.aasc "Barfoo",65,97,10
lda #'A'
lda #"A"

View File

@ -1 +0,0 @@
`

View File

@ -1,5 +1,3 @@
Copyright (C) 1989-2014 Andre Fachat, Jolse Maginnis, David Weinehall
and Cameron Kaiser.
12+12=12+12=24
10+10=10+10=20
5+5=5+5=10

View File

@ -1,10 +0,0 @@
# 1 "test.c"
# 1 "qwerty.h" 1
rts
#print 12+12
~print 10+10
# 1 "test.c" 2
~print 5+5

10
xa/tests/cpktest/Makefile Normal file
View File

@ -0,0 +1,10 @@
default:
../../xa -l test.l -o test.o pack_eng.a65
cmp test.l english.l || exit 1
../hextool -cmp=eng.ok < test.o
../../xa -l test.l -o test.o pack_ger.a65
cmp test.l deutsch.l || exit 1
../hextool -cmp=de.ok < test.o
clean:
rm -f *.o test.l

309
xa/tests/cpktest/c64def.def Normal file
View File

@ -0,0 +1,309 @@
/* VIC 6567 */
#define VIC_S0_X 0
#define VIC_S0_Y 1
#define VIC_S1_X 2
#define VIC_S1_Y 3
#define VIC_S2_X 4
#define VIC_S2_Y 5
#define VIC_S3_X 6
#define VIC_S3_Y 7
#define VIC_S4_X 8
#define VIC_S4_Y 9
#define VIC_S5_X 10
#define VIC_S5_Y 11
#define VIC_S6_X 12
#define VIC_S6_Y 13
#define VIC_S7_X 14
#define VIC_S7_Y 15
#define VIC_SP_MSB 16
#define VIC_SR1 17
#define VIC_IRQ_RASTER 18
#define VIC_LP_X 19
#define VIC_LP_Y 20
#define VIC_SP_EN 21
#define VIC_SR2 22
#define VIC_SP_EXPY 23
#define VIC_BASEADR 24
#define VIC_IRR 25
#define VIC_IMR 26
#define VIC_SP_PRIOR 27
#define VIC_SP_MCOLOR 28
#define VIC_SP_EXPX 29
#define VIC_SP_SCOLL 30
#define VIC_SP_BCOLL 31
#define VIC_EXTCOL 32
#define VIC_BCKCOL0 33
#define VIC_BCKCOL1 34
#define VIC_BCKCOL2 35
#define VIC_BCKCOL3 36
#define VIC_SP_MCOL0 37
#define VIC_SP_MCOL1 38
#define VIC_S0_COL 39
#define VIC_S1_COL 40
#define VIC_S2_COL 41
#define VIC_S3_COL 42
#define VIC_S4_COL 43
#define VIC_S5_COL 44
#define VIC_S6_COL 45
#define VIC_S7_COL 46
#define COL_SCHWARZ 0
#define COL_WEISS 1
#define COL_ROT 2
#define COL_TUERKIS 3
#define COL_VIOLETT 4
#define COL_GRUEN 5
#define COL_BLAU 6
#define COL_GELB 7
#define COL_ORANGE 8
#define COL_BRAUN 9
#define COL_HELLROT 10
#define COL_GRAU1 11
#define COL_GRAU2 12
#define COL_HELLGRUEN 13
#define COL_HELLBLAU 14
#define COL_GRAU3 15
#define VIC $d000
/* SID 6581 */
#define SID_0FREQL 0
#define SID_0FREQH 1
#define SID_0PULSL 2
#define SID_0PULSH 3
#define SID_0SR 4
#define SID_0ATTDEC 5
#define SID_0SUSREL 6
#define SID_1FREQL 7
#define SID_1FREQH 8
#define SID_1PULSL 9
#define SID_1PULSH 10
#define SID_1SR 11
#define SID_1ATTDEC 12
#define SID_1SUSREL 13
#define SID_2FREQL 14
#define SID_2FREQH 15
#define SID_2PULSL 16
#define SID_2PULSH 17
#define SID_2SR 18
#define SID_2ATTDEC 19
#define SID_2SUSREL 20
#define SID_FILTL 21
#define SID_FILTH 22
#define SID_SR1 23
#define SID_SR2 24
#define SID $d800
/* CIA 6526 */
#define CIA_DRA 0
#define CIA_DRB 1
#define CIA_DDRA 2
#define CIA_DDRB 3
#define CIA_TAL 4
#define CIA_TAH 5
#define CIA_TBL 6
#define CIA_TBH 7
#define CIA_TOD_THS 8
#define CIA_TOD_SEC 9
#define CIA_TOD_MIN 10
#define CIA_TOD_HR 11
#define CIA_SDR 12
#define CIA_ICR 13
#define CIA_CRA 14
#define CIA_CRB 15
#define CIA1 $dc00
#define CIA2 $dd00
/* ACIA 6551 */
#define ACIA_DR 0
#define ACIA_SR 1
#define ACIA_CMD 2
#define ACIA_CTRL 3
#define ACIA $d600
/* Basic */
#define INT $14
#define PRGANF $2b
#define VARANF $2d
#define ARRANF $2f
#define ARREND $31
#define STRANF $33
#define STRPTR $35
#define RAMEND $37
#define VARNAME $45
#define VARADR $47
#define AKKU3 $57
#define AKKU4 $5c
#define FAC $61
#define ARG $69
#define CHRGET $73
#define CHRGOT $79
#define PRGPTR $7a
#define V_ERR $0300
#define V_WARM $0302
#define V_CONV2CODE $0304
#define V_CONV2ASC $0306
#define V_GETBEFADR $0308
#define V_GETAUSDR $030a
#define SYS_AKKU $030c
#define SYS_XR $030d
#define SYS_YR $030e
#define SYS_SR $030f
#define READY $a474
#define LINEIN $a560
#define INTOUT $bdcd
/* Betriebssystem */
#define STATUS $90
#define FNAMLEN $b7
#define LOGFNR $b8
#define SECADR $b9
#define DEVADR $ba
#define FNAMPTR $bb
#define IOANF $c1
#define IOEND $c3
#define LASTKEY $c5
#define NUMKEY $c6
#define REVFL $c7
#define INLINEEND $c8
#define INZEILE $c9
#define INSPALTE $ca
#define PRESSEDKEY $cb
#define CRSRFLASH $cc
#define CRSRFLASHCNT $cd
#define CHARUNDERCRSR $ce
#define CRSRFLASHFL $cf
#define KEYINPUTFL $d0
#define LINEADR $d1
#define CRSRSPALTE $d3
#define HKFL $d4
#define LENGTHOFLINE $d5
#define CRSRZEILE $d6
#define DIV $d7
#define NUMOFINS $d8
#define RS232INBUFPTR $f7
#define RS232OUTBUFPTR $f9
#define P1 $fb /* freier Pointer */
#define P2 $fd /* freier Pointer */
#define INBUF $200
#define V_USR $0311
#define V_IRQ $0314
#define V_BRK $0316
#define V_NMI $0318
#define V_OPEN $031a
#define V_CLOSE $031c
#define V_CHKIN $031e
#define V_CKOUT $0320
#define V_CLRCH $0322
#define V_INPUT $0324
#define V_OUTPUT $0326
#define V_STOP $0328
#define V_GET $032a
#define V_CLALL $032c
#define V_WARMSTART $032e
#define V_LOAD $0330
#define V_SAVE $0332
#define SENDNAM $f3d5
#define CLSFIL $f642
#define INICIA $ff84
#define INIRAM $ff87
#define INIIO $ff8a
#define INIIOVEC $ff8d
#define SETST $ff90
#define SECLISTEN $ff93
#define SECTALK $ff96
#define RAMEND $ff99
#define RAMSTART $ff9c
#define GETKEY $ff9f
#define IECTIMEOUT $ffa2
#define IECIN $ffa5
#define IECOUT $ffa8
#define UNTALK $ffab
#define UNLISTEN $ffae
#define LISTEN $ffb1
#define TALK $ffb4
#define GETST $ffb7
#define SETFPAR $ffba
#define SETFNPAR $ffbd
#define OPEN $ffc0
#define CLOSE $ffc3
#define CHKIN $ffc6
#define CKOUT $ffc9
#define CLRCH $ffcc
#define BASIN $ffcf
#define BSOUT $ffd2
#define LOAD $ffd5
#define SAVE $ffd8
#define SETTI $ffdb
#define GETTI $ffde
#define GETSTP $ffe1
#define GET $ffe4
#define CLALL $ffe7
#define INCTI $ffea
#define SCREEN $ffed
#define CURSOR $fff0
#define GETIOBASE $fff3
/* Terminal-Commands */
#define TC_SCO 8
#define TC_SCF 9
#define TC_LF 13 /*10*/
#define TC_CR 13
#define TC_LCH $0e
#define TC_REV 18
#define TC_F1 $85
#define TC_F3 $86
#define TC_F5 $87
#define TC_F7 $88
#define TC_F2 $89
#define TC_F4 $8a
#define TC_F6 $8b
#define TC_F8 $8c
#define TC_HCH $8e
#define TC_REO $92
#define TC_FF $93
#define TC_HELLGRUEN $99
#define TC_CRL $9d

BIN
xa/tests/cpktest/de.ok Normal file

Binary file not shown.

180
xa/tests/cpktest/deutsch.l Normal file
View File

@ -0,0 +1,180 @@
basicend, 0x080b, 1, 0x0000
iniscreen, 0x10b6, 1, 0x0000
inipar, 0x1085, 1, 0x0000
menu1, 0x0819, 2, 0x0000
m1atxt, 0x0897, 2, 0x0000
Txtout, 0x10a0, 1, 0x0000
quellpfad, 0x10c6, 1, 0x0000
m1btxt, 0x08e2, 2, 0x0000
quelldrv, 0x10c4, 1, 0x0000
m1ctxt, 0x08f6, 2, 0x0000
zielpfad, 0x10ee, 1, 0x0000
m1dtxt, 0x0908, 2, 0x0000
zieldrv, 0x10c5, 1, 0x0000
m1etxt, 0x091c, 2, 0x0000
next, 0x085a, 2, 0x0000
l1, 0x0861, 2, 0x0000
befkeys, 0x088f, 2, 0x0000
exe, 0x086d, 2, 0x0000
Anzbefs, 0x0008, 2, 0x0000
exec, 0x0873, 2, 0x0000
madr, 0x087f, 2, 0x0000
pack, 0x0b2f, 1, 0x0000
unpack, 0x0966, 1, 0x0000
quelle, 0x0fe2, 1, 0x0000
ziel, 0x1023, 1, 0x0000
switch, 0x1063, 1, 0x0000
dir, 0x0efe, 1, 0x0000
qdrv, 0x0fc2, 1, 0x0000
zdrv, 0x0fd2, 1, 0x0000
openarcrd, 0x0afc, 1, 0x0000
cls, 0x0997, 12, 0x0000
rcnt, 0x1320, 1, 0x0000
rbyte, 0x0c06, 1, 0x0000
verr, 0x099d, 12, 0x0000
loop, 0x097a, 12, 0x0000
unpackfile, 0x09d6, 1, 0x0000
t1, 0x09c1, 12, 0x0000
waitkey, 0x0f5c, 1, 0x0000
verrtxt, 0x09a7, 12, 0x0000
wcnt, 0x131e, 1, 0x0000
l1, 0x09e7, 15, 0x0000
endx, 0x0a20, 15, 0x0000
filetab, 0x1324, 1, 0x0000
endnam, 0x09fd, 15, 0x0000
ask, 0x0a84, 15, 0x0000
nounpack, 0x0a23, 15, 0x0000
tok, 0x0ec6, 1, 0x0000
fxopen, 0x0ab4, 1, 0x0000
Getzst, 0x0d67, 1, 0x0000
xa, 0x0a2a, 15, 0x0000
lo, 0x0a2e, 15, 0x0000
end, 0x0a83, 15, 0x0000
tno, 0x0ebd, 1, 0x0000
cls, 0x0a64, 15, 0x0000
xb, 0x0a5a, 15, 0x0000
wxanz, 0x121a, 1, 0x0000
wxbyt, 0x1219, 1, 0x0000
ly, 0x0a4c, 15, 0x0000
wbyte, 0x0d0c, 1, 0x0000
wbuf, 0x0d22, 1, 0x0000
t1, 0x0a9c, 15, 0x0000
incwcnt, 0x0aab, 1, 0x0000
l1, 0x0ab3, 20, 0x0000
l1, 0x0ab8, 21, 0x0000
l2, 0x0acf, 21, 0x0000
l1a, 0x0ac9, 21, 0x0000
l1b, 0x0acb, 21, 0x0000
l3, 0x0ad3, 21, 0x0000
err, 0x0afb, 21, 0x0000
clrwrbuf, 0x0d03, 1, 0x0000
l0, 0x0afe, 22, 0x0000
l1, 0x0b08, 22, 0x0000
err, 0x0b2d, 22, 0x0000
Getqst, 0x0d61, 1, 0x0000
clrrdbuf, 0x0c67, 1, 0x0000
getlist, 0x0da4, 1, 0x0000
anzfiles, 0x1116, 1, 0x0000
end, 0x0b63, 23, 0x0000
openarcwr, 0x0ccd, 1, 0x0000
cls, 0x0b5b, 23, 0x0000
l1, 0x0b45, 23, 0x0000
setfadr, 0x0ecf, 1, 0x0000
packfile, 0x0b67, 1, 0x0000
lft, 0x0bac, 24, 0x0000
l1, 0x0b70, 24, 0x0000
fopen, 0x0bb6, 1, 0x0000
le, 0x0b97, 24, 0x0000
clrwxbyt, 0x0c94, 1, 0x0000
l2, 0x0b89, 24, 0x0000
l3, 0x0b94, 24, 0x0000
wxbyte, 0x0c73, 1, 0x0000
savwxbyt, 0x0c9a, 1, 0x0000
l1, 0x0bba, 26, 0x0000
l2, 0x0bd1, 26, 0x0000
l1a, 0x0bcb, 26, 0x0000
l1b, 0x0bcd, 26, 0x0000
l3, 0x0bd5, 26, 0x0000
err, 0x0bfc, 26, 0x0000
incrcnt, 0x0bfd, 1, 0x0000
l1, 0x0c05, 27, 0x0000
ro, 0x121c, 1, 0x0000
ri, 0x121b, 1, 0x0000
leerbuf, 0x0c16, 28, 0x0000
rb, 0x121e, 1, 0x0000
rf, 0x121d, 1, 0x0000
ldbuf, 0x0c1d, 28, 0x0000
lok, 0x0c2e, 28, 0x0000
l0, 0x0c47, 28, 0x0000
le, 0x0c5c, 28, 0x0000
add, 0x0c8d, 31, 0x0000
ad2, 0x0c83, 31, 0x0000
adx, 0x0c90, 31, 0x0000
nosav, 0x0ccc, 33, 0x0000
savs, 0x0cb6, 33, 0x0000
l1, 0x0caa, 33, 0x0000
l0, 0x0ccf, 34, 0x0000
l1, 0x0cd9, 34, 0x0000
err, 0x0d01, 34, 0x0000
wi, 0x1117, 1, 0x0000
wo, 0x1118, 1, 0x0000
wb, 0x1119, 1, 0x0000
nowr, 0x0d21, 36, 0x0000
l1, 0x0d2a, 37, 0x0000
end, 0x0d55, 37, 0x0000
l0, 0x0d4e, 37, 0x0000
Getst, 0x0d6a, 1, 0x0000
l1, 0x0d87, 38, 0x0000
l2, 0x0d95, 38, 0x0000
err, 0x0d9f, 38, 0x0000
l4x, 0x0da1, 39, 0x0000
l4, 0x0e7d, 39, 0x0000
setdirnam, 0x0f62, 1, 0x0000
l0, 0x0dc4, 39, 0x0000
l1, 0x0dc6, 39, 0x0000
la, 0x0de0, 39, 0x0000
l3x, 0x0dee, 39, 0x0000
l3, 0x0e59, 39, 0x0000
lb, 0x0e01, 39, 0x0000
lc, 0x0e16, 39, 0x0000
ld, 0x0e1b, 39, 0x0000
lf, 0x0e32, 39, 0x0000
lg, 0x0e46, 39, 0x0000
testkeys, 0x0e83, 1, 0x0000
lh, 0x0e50, 39, 0x0000
l2, 0x0e69, 39, 0x0000
l5, 0x0e76, 39, 0x0000
ok, 0x0e8c, 40, 0x0000
t1, 0x0ead, 40, 0x0000
ja, 0x0ea2, 40, 0x0000
l0, 0x0f19, 45, 0x0000
l1, 0x0f1b, 45, 0x0000
l4, 0x0f56, 45, 0x0000
l3, 0x0f35, 45, 0x0000
l2, 0x0f45, 45, 0x0000
l5, 0x0f52, 45, 0x0000
p1, 0x0014, 46, 0x0000
l1, 0x0f6d, 46, 0x0000
nodp, 0x0f7b, 46, 0x0000
dp, 0x0f81, 46, 0x0000
dp1, 0x0f83, 46, 0x0000
end, 0x0f9b, 46, 0x0000
l2a, 0x0f93, 46, 0x0000
l2, 0x0f95, 46, 0x0000
ok, 0x0fd1, 47, 0x0000
ok, 0x0fe1, 48, 0x0000
quelltxt, 0x1001, 49, 0x0000
q1, 0x0fee, 49, 0x0000
end, 0x1000, 49, 0x0000
quelltxt, 0x1042, 51, 0x0000
q1, 0x102f, 51, 0x0000
end, 0x1041, 51, 0x0000
l1, 0x1071, 53, 0x0000
noval, 0x1097, 54, 0x0000
ok, 0x1099, 54, 0x0000
p, 0x0022, 55, 0x0000
l1, 0x10a4, 55, 0x0000
le, 0x10b5, 55, 0x0000
sysmem, 0x1324, 1, 0x0000
ecnt, 0x1322, 1, 0x0000
ende, 0x10c4, 1, 0x0000

BIN
xa/tests/cpktest/eng.ok Normal file

Binary file not shown.

180
xa/tests/cpktest/english.l Normal file
View File

@ -0,0 +1,180 @@
basicend, 0x080b, 1, 0x0000
iniscreen, 0x10c4, 1, 0x0000
inipar, 0x1093, 1, 0x0000
menu1, 0x0819, 2, 0x0000
m1atxt, 0x0897, 2, 0x0000
Txtout, 0x10ae, 1, 0x0000
quellpfad, 0x10d4, 1, 0x0000
m1btxt, 0x08e1, 2, 0x0000
quelldrv, 0x10d2, 1, 0x0000
m1ctxt, 0x08f6, 2, 0x0000
zielpfad, 0x10fc, 1, 0x0000
m1dtxt, 0x090d, 2, 0x0000
zieldrv, 0x10d3, 1, 0x0000
m1etxt, 0x0923, 2, 0x0000
next, 0x085a, 2, 0x0000
l1, 0x0861, 2, 0x0000
befkeys, 0x088f, 2, 0x0000
exe, 0x086d, 2, 0x0000
Anzbefs, 0x0008, 2, 0x0000
exec, 0x0873, 2, 0x0000
madr, 0x087f, 2, 0x0000
pack, 0x0b32, 1, 0x0000
unpack, 0x0970, 1, 0x0000
quelle, 0x0fe5, 1, 0x0000
ziel, 0x102b, 1, 0x0000
switch, 0x1071, 1, 0x0000
dir, 0x0f01, 1, 0x0000
qdrv, 0x0fc5, 1, 0x0000
zdrv, 0x0fd5, 1, 0x0000
openarcrd, 0x0aff, 1, 0x0000
cls, 0x09a1, 12, 0x0000
rcnt, 0x132e, 1, 0x0000
rbyte, 0x0c09, 1, 0x0000
verr, 0x09a7, 12, 0x0000
loop, 0x0984, 12, 0x0000
unpackfile, 0x09dd, 1, 0x0000
t1, 0x09c9, 12, 0x0000
waitkey, 0x0f5f, 1, 0x0000
verrtxt, 0x09b1, 12, 0x0000
wcnt, 0x132c, 1, 0x0000
l1, 0x09ee, 15, 0x0000
endx, 0x0a27, 15, 0x0000
filetab, 0x1332, 1, 0x0000
endnam, 0x0a04, 15, 0x0000
ask, 0x0a8b, 15, 0x0000
nounpack, 0x0a2a, 15, 0x0000
tok, 0x0ec9, 1, 0x0000
fxopen, 0x0ab7, 1, 0x0000
Getzst, 0x0d6a, 1, 0x0000
xa, 0x0a31, 15, 0x0000
lo, 0x0a35, 15, 0x0000
end, 0x0a8a, 15, 0x0000
tno, 0x0ec0, 1, 0x0000
cls, 0x0a6b, 15, 0x0000
xb, 0x0a61, 15, 0x0000
wxanz, 0x1228, 1, 0x0000
wxbyt, 0x1227, 1, 0x0000
ly, 0x0a53, 15, 0x0000
wbyte, 0x0d0f, 1, 0x0000
wbuf, 0x0d25, 1, 0x0000
t1, 0x0aa0, 15, 0x0000
incwcnt, 0x0aae, 1, 0x0000
l1, 0x0ab6, 20, 0x0000
l1, 0x0abb, 21, 0x0000
l2, 0x0ad2, 21, 0x0000
l1a, 0x0acc, 21, 0x0000
l1b, 0x0ace, 21, 0x0000
l3, 0x0ad6, 21, 0x0000
err, 0x0afe, 21, 0x0000
clrwrbuf, 0x0d06, 1, 0x0000
l0, 0x0b01, 22, 0x0000
l1, 0x0b0b, 22, 0x0000
err, 0x0b30, 22, 0x0000
Getqst, 0x0d64, 1, 0x0000
clrrdbuf, 0x0c6a, 1, 0x0000
getlist, 0x0da7, 1, 0x0000
anzfiles, 0x1124, 1, 0x0000
end, 0x0b66, 23, 0x0000
openarcwr, 0x0cd0, 1, 0x0000
cls, 0x0b5e, 23, 0x0000
l1, 0x0b48, 23, 0x0000
setfadr, 0x0ed2, 1, 0x0000
packfile, 0x0b6a, 1, 0x0000
lft, 0x0baf, 24, 0x0000
l1, 0x0b73, 24, 0x0000
fopen, 0x0bb9, 1, 0x0000
le, 0x0b9a, 24, 0x0000
clrwxbyt, 0x0c97, 1, 0x0000
l2, 0x0b8c, 24, 0x0000
l3, 0x0b97, 24, 0x0000
wxbyte, 0x0c76, 1, 0x0000
savwxbyt, 0x0c9d, 1, 0x0000
l1, 0x0bbd, 26, 0x0000
l2, 0x0bd4, 26, 0x0000
l1a, 0x0bce, 26, 0x0000
l1b, 0x0bd0, 26, 0x0000
l3, 0x0bd8, 26, 0x0000
err, 0x0bff, 26, 0x0000
incrcnt, 0x0c00, 1, 0x0000
l1, 0x0c08, 27, 0x0000
ro, 0x122a, 1, 0x0000
ri, 0x1229, 1, 0x0000
leerbuf, 0x0c19, 28, 0x0000
rb, 0x122c, 1, 0x0000
rf, 0x122b, 1, 0x0000
ldbuf, 0x0c20, 28, 0x0000
lok, 0x0c31, 28, 0x0000
l0, 0x0c4a, 28, 0x0000
le, 0x0c5f, 28, 0x0000
add, 0x0c90, 31, 0x0000
ad2, 0x0c86, 31, 0x0000
adx, 0x0c93, 31, 0x0000
nosav, 0x0ccf, 33, 0x0000
savs, 0x0cb9, 33, 0x0000
l1, 0x0cad, 33, 0x0000
l0, 0x0cd2, 34, 0x0000
l1, 0x0cdc, 34, 0x0000
err, 0x0d04, 34, 0x0000
wi, 0x1125, 1, 0x0000
wo, 0x1126, 1, 0x0000
wb, 0x1127, 1, 0x0000
nowr, 0x0d24, 36, 0x0000
l1, 0x0d2d, 37, 0x0000
end, 0x0d58, 37, 0x0000
l0, 0x0d51, 37, 0x0000
Getst, 0x0d6d, 1, 0x0000
l1, 0x0d8a, 38, 0x0000
l2, 0x0d98, 38, 0x0000
err, 0x0da2, 38, 0x0000
l4x, 0x0da4, 39, 0x0000
l4, 0x0e80, 39, 0x0000
setdirnam, 0x0f65, 1, 0x0000
l0, 0x0dc7, 39, 0x0000
l1, 0x0dc9, 39, 0x0000
la, 0x0de3, 39, 0x0000
l3x, 0x0df1, 39, 0x0000
l3, 0x0e5c, 39, 0x0000
lb, 0x0e04, 39, 0x0000
lc, 0x0e19, 39, 0x0000
ld, 0x0e1e, 39, 0x0000
lf, 0x0e35, 39, 0x0000
lg, 0x0e49, 39, 0x0000
testkeys, 0x0e86, 1, 0x0000
lh, 0x0e53, 39, 0x0000
l2, 0x0e6c, 39, 0x0000
l5, 0x0e79, 39, 0x0000
ok, 0x0e8f, 40, 0x0000
t1, 0x0eb0, 40, 0x0000
ja, 0x0ea5, 40, 0x0000
l0, 0x0f1c, 45, 0x0000
l1, 0x0f1e, 45, 0x0000
l4, 0x0f59, 45, 0x0000
l3, 0x0f38, 45, 0x0000
l2, 0x0f48, 45, 0x0000
l5, 0x0f55, 45, 0x0000
p1, 0x0014, 46, 0x0000
l1, 0x0f70, 46, 0x0000
nodp, 0x0f7e, 46, 0x0000
dp, 0x0f84, 46, 0x0000
dp1, 0x0f86, 46, 0x0000
end, 0x0f9e, 46, 0x0000
l2a, 0x0f96, 46, 0x0000
l2, 0x0f98, 46, 0x0000
ok, 0x0fd4, 47, 0x0000
ok, 0x0fe4, 48, 0x0000
quelltxt, 0x1004, 49, 0x0000
q1, 0x0ff1, 49, 0x0000
end, 0x1003, 49, 0x0000
quelltxt, 0x104a, 51, 0x0000
q1, 0x1037, 51, 0x0000
end, 0x1049, 51, 0x0000
l1, 0x107f, 53, 0x0000
noval, 0x10a5, 54, 0x0000
ok, 0x10a7, 54, 0x0000
p, 0x0022, 55, 0x0000
l1, 0x10b2, 55, 0x0000
le, 0x10c3, 55, 0x0000
sysmem, 0x1332, 1, 0x0000
ecnt, 0x1330, 1, 0x0000
ende, 0x10d2, 1, 0x0000

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,22 +0,0 @@
# 1 "over.c"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "over.c"
# 13 "over.c"
lda #1
jmp buggy
rts
# 1 "over.h" 1
fuzz lda #5
sta $0400
bne fuzz
rts
lda @$c0c0c0
# 18 "over.c" 2

9
xa/tests/dos51/Makefile Normal file
View File

@ -0,0 +1,9 @@
default:
# xa should not allow this to happen. if it does, this test is no good.
../../xa -DBUG test.s || exit 0 && exit 1
# expected-to-fail tests did fail. should be no more errors now.
../../xa test.s -o test.o
../hextool -cmp=ok < test.o
clean:
rm -f *.o

136
xa/tests/dos51/dos51.inc Normal file
View File

@ -0,0 +1,136 @@
/* dos wedge code for inlining into routines */
/* define SA51 to allow stand-alone generation */
#ifdef SA51
.word SA51
* = SA51
#endif
/* otherwise assume this has been inlined via #include <> */
/* define BASIC51 to use BASIC interface stub */
#ifdef BASIC51
jsr $aefd
jsr $ad9e
jsr $b6a3 ; leaving a=len x=lb y=hb
#endif
/* otherwise load a with length, x/y = lb/hb */
.(
crunchsrv = $a57c
setlfs = $ffba
setnam = $ffbd
open = $ffc0
close = $ffc3
clall = $ffe7
chkin = $ffc6
chkout = $ffc9
clrchn = $ffcc
chrin = $ffcf
getin = $ffe4
print = $ffd2
readst = $ffb7
chrout = print
ready = $e37b
cnvrtdec = $bdcd
erasealine = 59903
workzp = $a5
sta work1
sty workzp+1
stx workzp
; set the filename (directory, error channel and commands)
; a, x and y already setup for us
jsr setnam
; are we requesting just the error channel?
ldx work1
beq errchn ; yes
; are we requesting a disk directory?
ldy #0
lda (workzp),y
cmp #"$"
bne errchn ; no
; yes, display directory
lda #$01
ldx 186
ldy #$00
jsr setlfs
jsr open ; open 1,dev,0 to read as BASIC formatted text
lda #147
jsr print
clc
ldx #01
jsr chkin
bcs dirdone
jsr chrin
jsr chrin
lda #$0d
jsr print
; routine to print each line of the directory
dirpll jsr chrin
jsr chrin ; skip line link
jsr chrin ; grab length (as line #)
sta work1
jsr chrin
sta work2 ; stash for later
jsr readst ; EOF or other error?
bne dirdone ; yes, end directory
lda work2 ; no, print this line
ldx work1
jsr cnvrtdec ; first the number/length
lda #$20
jsr print ; and a space
jsr chrin
dirpl jsr print ; then the filename in quotes and filetype until a null
jsr chrin
adc #0
bne dirpl ; no null yet
lda #13 ; yes, null, print CR
jsr print
jmp dirpll ; and do next line
; finish directory and clear channel, then fall through to errchn
dirdone lda #1
jsr close
jsr clall
lda #0
jsr setnam
; common routine for error channel and disk commands
errchn lda #15
ldx $ba
ldy #15
jsr setlfs ; open 15,8,15,command
jsr open
lda #18
jsr print ; rvson
; read until there's a null, adding $0d for devices that don't
errchnl ldx #15
jsr chkin
jsr chrin
sta work1
jsr readst ; power 64 sucks sometimes =-(
sta work2 ; its emulated messages have no $0d
lda work1
jsr print
lda work2
beq errchnl
lda work1
cmp #13
beq errchnd
lda #13
jsr print
errchnd lda #15
jsr close
jsr clall
lda #146
jsr print ; rvsoff
rts
work1 .byt 0
work2 .byt 0
.)

BIN
xa/tests/dos51/ok Normal file

Binary file not shown.

6
xa/tests/dos51/test.s Normal file
View File

@ -0,0 +1,6 @@
#define SA51 $c123
#include "dos51.inc"
#ifdef BUG
jsr crunchsrv
#endif

View File

@ -1,4 +1,2 @@
Copyright (C) 1989-2014 Andre Fachat, Jolse Maginnis, David Weinehall
and Cameron Kaiser.
test.asm:line 6: 0400: Warning - Can't optimize forward-defined label; using absolute addressing
test.asm:line 7: 0403: Warning - Can't optimize forward-defined label; using absolute addressing

10
xa/tests/masmcom/Makefile Normal file
View File

@ -0,0 +1,10 @@
default:
# compile with masm mode on.
../../xa -M -o test.o test.s
../hextool -cmp=okmasm < test.o
# compile without
../../xa -o test.o test.s
../hextool -cmp=oknomasm < test.o
clean:
rm -f *.o

BIN
xa/tests/masmcom/okmasm Normal file

Binary file not shown.

BIN
xa/tests/masmcom/oknomasm Normal file

Binary file not shown.

3
xa/tests/masmcom/test.s Normal file
View File

@ -0,0 +1,3 @@
/* when assembled with/without -M, we get two different objects */
lda #00 ; and this: lda #01 ; is why : lda #":"

9
xa/tests/mvnmvp/Makefile Normal file
View File

@ -0,0 +1,9 @@
default:
# xa should not allow this to happen. if it does, this test is no good.
../../xa test.s || exit 0 && exit 1
# expected-to-fail tests did fail. should be no more errors now.
../../xa -w test.s -o test.o
../hextool -cmp=ok < test.o
clean:
rm -f *.o

BIN
xa/tests/mvnmvp/ok Normal file

Binary file not shown.

14
xa/tests/mvnmvp/test.s Normal file
View File

@ -0,0 +1,14 @@
; test instructions that failed during our testing
; and test instructions in the tokenizer bordering mvn/mvp
w = $01
lda $d020
lsr
mvn w, $02
mvn $0201
mvn $0066
mvp $03, w+3
mvp $0403
mvp $0088
nop
.byt $5a, $b6
.word $b65a

View File

View File

@ -1,3 +0,0 @@
lda #4
sta !$0005
rts

9
xa/tests/op816/Makefile Normal file
View File

@ -0,0 +1,9 @@
default:
# xa should not allow this to happen. if it does, this test is no good.
../../xa test.s || exit 0 && exit 1
# expected-to-fail tests did fail. should be no more errors now.
../../xa -w test.s -o test.o
../hextool -cmp=ok < test.o
clean:
rm -f *.o

BIN
xa/tests/op816/ok Normal file

Binary file not shown.

336
xa/tests/op816/test.s Normal file
View File

@ -0,0 +1,336 @@
; Copyright (c) 2014, Alessandro Gatti - frob.it
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
;
; 1. Redistributions of source code must retain the above copyright notice,
; this list of conditions and the following disclaimer.
;
; 2. Redistributions in binary form must reproduce the above copyright notice,
; this list of conditions and the following disclaimer in the documentation
; and/or other materials provided with the distribution.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
; POSSIBILITY OF SUCH DAMAGE.
#define ZEROPAGE_0 $0
#define ZEROPAGE_1 $1
#define ZEROPAGE_2 $2
#define ZEROPAGE_3 $3
#define ZEROPAGE_4 $4
#define ZEROPAGE_5 $5
#define ZEROPAGE_6 $6
#define ZEROPAGE_7 $7
#define ZEROPAGE_8 $8
#define ZEROPAGE_9 $9
#define ZEROPAGE_A $a
#define ZEROPAGE_B $b
#define ZEROPAGE_C $c
#define ZEROPAGE_D $d
#define ZEROPAGE_E $e
#define ZEROPAGE_F $f
*=$1000
row0 BRK
ORA (ZEROPAGE_0,X)
COP #$00
ORA ZEROPAGE_0,S
TSB ZEROPAGE_0
ORA ZEROPAGE_0
ASL ZEROPAGE_0
ORA [ZEROPAGE_0]
PHP
ORA #$00
ASL
PHD
TSB datablockabs
ORA datablockabs
ASL datablockabs
ORA @datablockabs+@$FF0000
JMP row1
row1 BPL row1_target
ORA (ZEROPAGE_1),Y
row1_target ORA (ZEROPAGE_1)
ORA (ZEROPAGE_1,S),Y
TRB ZEROPAGE_1
ORA ZEROPAGE_1,X
ASL ZEROPAGE_1,X
ORA [ZEROPAGE_1],Y
CLC
ORA datablockabs,Y
INC
TCS
TRB datablockabs
ORA datablockabs,X
ASL datablockabs,X
ORA @datablockabs+@$FF0000,X
JMP row2
row2 JSR farcode
AND (ZEROPAGE_2,X)
JSR @datablockabs+@$FF0000
AND ZEROPAGE_2,S
BIT ZEROPAGE_2
AND ZEROPAGE_2
ROL ZEROPAGE_2
AND [ZEROPAGE_2]
PLP
AND #$22
ROL
PLD
BIT datablockabs
AND datablockabs
ROL datablockabs
AND @datablockabs+@$FF0000
JMP row3
row3 BMI row3_target
AND (ZEROPAGE_3),Y
row3_target AND (ZEROPAGE_3)
AND (ZEROPAGE_3,S),Y
BIT ZEROPAGE_3,X
AND ZEROPAGE_3,X
ROL ZEROPAGE_3,X
AND [ZEROPAGE_3],Y
SEC
AND datablockabs,Y
DEC
TSC
BIT datablockabs,X
AND datablockabs,X
ROL datablockabs,X
AND @datablockabs+@$FF0000,X
JMP row4
row4 RTI
EOR (ZEROPAGE_4,X)
.byte $42 ; WDM
EOR ZEROPAGE_3,S
MVP $44,$44 ;$4444 ; Should be $44, $44 instead
EOR ZEROPAGE_4
LSR ZEROPAGE_4
EOR [ZEROPAGE_4]
PHA
EOR #$44
LSR
PHK
JMP farcode
EOR datablockabs
LSR datablockabs
EOR @datablockabs+@$FF0000
JMP row5
row5 BVC row5_target
EOR (ZEROPAGE_5),Y
row5_target EOR (ZEROPAGE_5)
EOR (ZEROPAGE_5,S),Y
MVN $55,$55 ; $5555 ; Should be $55, $55 instead
EOR ZEROPAGE_5,X
LSR ZEROPAGE_5,X
EOR [ZEROPAGE_5],Y
CLI
EOR datablockabs,Y
PHY
TCD
JMP @datablockabs+@$FF0000
EOR datablockabs,X
LSR datablockabs,X
EOR @datablockabs+@$FF0000,X
JMP row6
row6 RTS
ADC (ZEROPAGE_6,X)
PER datablockabs
ADC ZEROPAGE_6,S
STZ ZEROPAGE_6
ADC ZEROPAGE_6
ROR ZEROPAGE_6
ADC [ZEROPAGE_6]
PLA
ADC #$66
ROR
RTL
JMP (datablockabs)
ADC datablockabs
ROR datablockabs
ADC @datablockabs+@$FF0000
JMP row7
row7 BVS row7_target
ADC (ZEROPAGE_7),Y
row7_target ADC (ZEROPAGE_7)
ADC (ZEROPAGE_7,S),Y
STZ ZEROPAGE_7,X
ADC ZEROPAGE_7,X
ROR ZEROPAGE_7,X
ADC [ZEROPAGE_7],Y
SEI
ADC datablockabs,Y
PLY
TDC
JMP (datablockabs,X)
ADC datablockabs,X
ROR datablockabs,X
ADC @datablockabs+@$FF0000,X
JMP row8
row8 BRA row8_target
STA (ZEROPAGE_8,X)
row8_target BRL datablockabs
STA ZEROPAGE_8,S
STY ZEROPAGE_8
STA ZEROPAGE_8
STX ZEROPAGE_8
STA [ZEROPAGE_8]
DEY
BIT #$88
TXA
PHB
STY datablockabs
STA datablockabs
STX datablockabs
STA @datablockabs+@$FF0000
JMP row9
row9 BCC row9_target
STA (ZEROPAGE_9),Y
row9_target STA (ZEROPAGE_9)
STA (ZEROPAGE_9,S),Y
STY ZEROPAGE_9,X
STA ZEROPAGE_9,X
STX ZEROPAGE_9,Y
STA [ZEROPAGE_9],Y
TYA
STA datablockabs,Y
TXS
TXY
STA datablockabs,X
STZ datablockabs,X
STA @datablockabs+@$FF0000,X
JMP rowa
rowa LDY #$AA
LDA (ZEROPAGE_A,X)
LDX #$AA
LDA ZEROPAGE_A,S
LDY ZEROPAGE_A
LDA ZEROPAGE_A
LDX ZEROPAGE_A
LDA [ZEROPAGE_A]
TAY
LDA #$AA
TAX
PLB
LDY datablockabs
LDA datablockabs
LDX datablockabs
LDA @datablockabs+@$FF0000
JMP rowb
rowb BCS rowb_target
LDA (ZEROPAGE_B),Y
rowb_target LDA (ZEROPAGE_B)
LDA (ZEROPAGE_B,S),Y
LDY ZEROPAGE_B,X
LDA ZEROPAGE_B,X
LDX ZEROPAGE_B,Y
LDA [ZEROPAGE_B],Y
CLV
LDA datablockabs,Y
TSX
TYX
LDY datablockabs,X
LDA datablockabs,X
LDX datablockabs,Y
LDA @datablockabs+@$FF0000,X
JMP rowc
rowc CPY #$CC
CMP (ZEROPAGE_C,X)
REP #$CC
CMP ZEROPAGE_C,S
CPY ZEROPAGE_C
CMP ZEROPAGE_C
DEC ZEROPAGE_C
CMP [ZEROPAGE_C]
INY
CMP #$CC
DEX
WAI
CPY datablockabs
CMP datablockabs
DEC datablockabs
CMP @datablockabs+@$FF0000
JMP rowd
rowd BNE rowd_target
CMP (ZEROPAGE_D),Y
rowd_target CMP (ZEROPAGE_D)
CMP (ZEROPAGE_D,S),Y
PEI (ZEROPAGE_D)
CMP ZEROPAGE_D,X
DEC ZEROPAGE_D,X
CMP [ZEROPAGE_D],Y
CLD
CMP datablockabs,Y
PHX
STP
.byte $DC, $34, $12 ; JML (label)
CMP datablockabs,X
DEC datablockabs,X
CMP @datablockabs+@$FF0000,X
JMP rowe
rowe CPX #$EE
SBC (ZEROPAGE_E,X)
SEP #$EE
SBC ZEROPAGE_E,S
CPX ZEROPAGE_E
SBC ZEROPAGE_E
INC ZEROPAGE_E
SBC [ZEROPAGE_E]
INX
SBC #$EE
NOP
XBA
CPX datablockabs
SBC datablockabs
INC datablockabs
SBC @datablockabs+@$FF0000
JMP rowf
rowf BEQ rowf_target
SBC (ZEROPAGE_F),Y
rowf_target SBC (ZEROPAGE_F)
SBC (ZEROPAGE_F,S),Y
PEA $1000
SBC ZEROPAGE_F,X
INC ZEROPAGE_F,X
SBC [ZEROPAGE_F],Y
SED
SBC datablockabs,Y
PLX
XCE
JSR (datablockabs,X)
SBC datablockabs,X
INC datablockabs,X
SBC @datablockabs+@$FF0000,X
JMP end
end RTS
datablockabs .word $1234
farcode RTI

11
xa/tests/openpp/Makefile Normal file
View File

@ -0,0 +1,11 @@
default:
# xa should not allow this to happen. if it does, this test is no good.
../../xa test.inc || exit 0 && exit 1
# expected-to-fail tests did fail. should be no more errors now.
../../xa -DBUG test.s -o test.o
../hextool -cmp=ok < test.o
../../xa test.s -o test.o
../hextool -cmp=ok < test.o
clean:
rm -f *.o

BIN
xa/tests/openpp/ok Normal file

Binary file not shown.

View File

@ -10,7 +10,9 @@
#endif
/* comment this out to stop testing included gaffes */
#ifdef BUG
#include "test.inc"
#endif
#if 1
#if 2
@ -21,7 +23,5 @@
#ifdef X
/* comment this out for bugs in this file */
/*
#endif
*/

BIN
xa/tests/quotch/ok Normal file

Binary file not shown.

11
xa/tests/quotch/test.s Normal file
View File

@ -0,0 +1,11 @@
.word $9000
* = $9000
; test specific single characters can be quoted
LDA #';'
CMP #':'
AND #'"'
SBC #";"
ORA #":"
EOR #"'"

View File

@ -1 +0,0 @@
<EFBFBD>