diff --git a/README b/README index dbb013d..0620e76 100644 --- a/README +++ b/README @@ -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: diff --git a/xa/ChangeLog b/xa/ChangeLog index 58e2ccf..92c364f 100644 --- a/xa/ChangeLog +++ b/xa/ChangeLog @@ -305,6 +305,26 @@ xa-2.3.6 -- Cameron Kaiser 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 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 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 20 August, 2014 + diff --git a/xa/Makefile b/xa/Makefile index 8fa1583..6c248dc 100644 --- a/xa/Makefile +++ b/xa/Makefile @@ -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)" diff --git a/xa/README.1st b/xa/README.1st index 0c7994a..4b61439 100644 --- a/xa/README.1st +++ b/xa/README.1st @@ -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 diff --git a/xa/man/xa.1 b/xa/man/xa.1 index 5a2a480..e9bd571 100644 --- a/xa/man/xa.1 +++ b/xa/man/xa.1 @@ -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 , Andre Fachat and Cameron Kaiser . 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 diff --git a/xa/src/xa.c b/xa/src/xa.c index 7ec1cb0..5b08d0d 100644 --- a/xa/src/xa.c +++ b/xa/src/xa.c @@ -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 */ diff --git a/xa/src/xah.h b/xa/src/xah.h index a9cd5ca..6b4362a 100644 --- a/xa/src/xah.h +++ b/xa/src/xah.h @@ -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 diff --git a/xa/src/xap.c b/xa/src/xap.c index 0fa4a5b..2e86dde 100644 --- a/xa/src/xap.c +++ b/xa/src/xap.c @@ -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); diff --git a/xa/src/xat.c b/xa/src/xat.c index 4633564..d16f4c5 100644 --- a/xa/src/xat.c +++ b/xa/src/xat.c @@ -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]==';') diff --git a/xa/tests/README b/xa/tests/README index 54dce1d..dfec6be 100644 --- a/xa/tests/README +++ b/xa/tests/README @@ -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 diff --git a/xa/tests/branch/Makefile b/xa/tests/branch/Makefile new file mode 100644 index 0000000..bc4cfd4 --- /dev/null +++ b/xa/tests/branch/Makefile @@ -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 diff --git a/xa/tests/branch/bir.ok b/xa/tests/branch/bir.ok new file mode 100644 index 0000000..d624a13 Binary files /dev/null and b/xa/tests/branch/bir.ok differ diff --git a/xa/tests/branch/bir.s b/xa/tests/branch/bir.s new file mode 100644 index 0000000..7449314 --- /dev/null +++ b/xa/tests/branch/bir.s @@ -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 diff --git a/xa/tests/branch/bor.s b/xa/tests/branch/bor.s new file mode 100644 index 0000000..bf01558 --- /dev/null +++ b/xa/tests/branch/bor.s @@ -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 diff --git a/xa/tests/chardelimiter/delimtest.a65 b/xa/tests/chardelimiter/delimtest.a65 deleted file mode 100644 index c7b3a84..0000000 --- a/xa/tests/chardelimiter/delimtest.a65 +++ /dev/null @@ -1,16 +0,0 @@ - - *=$033c - - lda #"A" - lda #'A' - - .asc "12345" - .asc '12345' - - .asc "^"" ; ^ is escape character - .asc '^'' - .asc "'" - .asc '"' - - .asc "^1" - diff --git a/xa/tests/charset/test.asm b/xa/tests/charset/test.asm deleted file mode 100644 index 645b528..0000000 --- a/xa/tests/charset/test.asm +++ /dev/null @@ -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" diff --git a/xa/tests/chppch/a.o65 b/xa/tests/chppch/a.o65 deleted file mode 100644 index 64845fb..0000000 --- a/xa/tests/chppch/a.o65 +++ /dev/null @@ -1 +0,0 @@ -` \ No newline at end of file diff --git a/xa/tests/chppch/ok.out b/xa/tests/chppch/ok.out index 98f7f93..6e25007 100644 --- a/xa/tests/chppch/ok.out +++ b/xa/tests/chppch/ok.out @@ -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 diff --git a/xa/tests/chppch/test.out b/xa/tests/chppch/test.out deleted file mode 100644 index dd4cdaa..0000000 --- a/xa/tests/chppch/test.out +++ /dev/null @@ -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 diff --git a/xa/tests/cpktest/Makefile b/xa/tests/cpktest/Makefile new file mode 100644 index 0000000..e442ee9 --- /dev/null +++ b/xa/tests/cpktest/Makefile @@ -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 diff --git a/xa/tests/cpktest/c64def.def b/xa/tests/cpktest/c64def.def new file mode 100644 index 0000000..fb3da4a --- /dev/null +++ b/xa/tests/cpktest/c64def.def @@ -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 + diff --git a/xa/tests/cpktest/de.ok b/xa/tests/cpktest/de.ok new file mode 100644 index 0000000..07fadac Binary files /dev/null and b/xa/tests/cpktest/de.ok differ diff --git a/xa/tests/cpktest/deutsch.l b/xa/tests/cpktest/deutsch.l new file mode 100644 index 0000000..2660a28 --- /dev/null +++ b/xa/tests/cpktest/deutsch.l @@ -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 diff --git a/xa/tests/cpktest/eng.ok b/xa/tests/cpktest/eng.ok new file mode 100644 index 0000000..a13d160 Binary files /dev/null and b/xa/tests/cpktest/eng.ok differ diff --git a/xa/tests/cpktest/english.l b/xa/tests/cpktest/english.l new file mode 100644 index 0000000..2307df7 --- /dev/null +++ b/xa/tests/cpktest/english.l @@ -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 diff --git a/xa/tests/cpktest/pack_eng.a65 b/xa/tests/cpktest/pack_eng.a65 new file mode 100644 index 0000000..bb0659f --- /dev/null +++ b/xa/tests/cpktest/pack_eng.a65 @@ -0,0 +1,1070 @@ + +#include "c64def.def" + +#define Tout(a) .(:lda #a:jsr Txtout:.) +#define Aout(a) .(:lda #b:jsr Txtout:jmp c:b .byt a,0:c .) +#define Ibout(a) .(:ldx a:lda #0:jsr INTOUT:.) +#define Iout(a) .(:ldx a:lda a+1:jsr INTOUT:.) + +#define PFADLEN 40 +#define FN_WR 3 +#define FN_RD 4 +#define XCODE $f7 +#define Version 1 + + .( + .word $0801 + *=$0801 + + .word basicend,10 + .byt $9e,"2064",0 ;sys $0810 +basicend .word 0 + .byt 0,0,0 + + .( + jsr CLRCH + jsr iniscreen + jsr inipar +menu1 + Tout(m1atxt) + Tout(quellpfad) + Tout(m1btxt) + Ibout(quelldrv) + Tout(m1ctxt) + Tout(zielpfad) + Tout(m1dtxt) + Ibout(zieldrv) + Tout(m1etxt) + +next jsr GET + beq next + + ldx #0 +l1 cmp befkeys,x + beq exe + inx + cpx #Anzbefs + bcc l1 + bcs next + +exe jsr exec + jmp menu1 + +exec txa + asl + tax + lda madr+1,x + pha + lda madr,x + pha + rts + +madr .word pack-1,unpack-1,quelle-1,ziel-1,switch-1,dir-1,qdrv-1,zdrv-1 +befkeys .asc TC_F1,TC_F2,TC_F3,TC_F5,TC_F8,TC_F7,TC_F4,TC_F6 +Anzbefs =8 + +m1atxt .asc TC_LCH,TC_SCO,TC_FF,TC_LF,TC_LF + .asc "(F1) PACK PROGRAMMS",TC_CR,TC_LF + .asc "(F2) EXTRACT FROM ARCHIVE",TC_CR,TC_LF + .asc "(F3) SOURCEPATH/ARC:",0 +m1btxt .asc TC_CR,TC_LF + .asc "(F4) SOURCEDEVICE:",0 +m1ctxt .asc TC_CR,TC_LF + .asc "(F5) TARGETPATH/ARC:",0 +m1dtxt .asc TC_CR,TC_LF + .asc "(F6) TARGETDEVICE :",0 +m1etxt .asc TC_CR,TC_LF + .asc "(F7) SOURCEDIRECTORY",TC_CR,TC_LF + .asc "(F8) EXCHANGE TARGET AND SOURCE",TC_CR,TC_LF + .asc "YOUR CHOICE PLEASE",TC_CR,0 + .) + +unpack .( + jsr openarcrd + bcs cls + + lda #0 + sta rcnt + sta rcnt+1 + + jsr rbyte + cmp #Version + bne verr + +loop jsr unpackfile + bcc loop + + Tout(t1) + lda rcnt+1 + ldx rcnt + jsr INTOUT + lda #TC_CR + jsr BSOUT + jsr waitkey + +cls lda #FN_RD + jsr CLOSE + rts + +verr Tout(verrtxt) + jmp cls +verrtxt .asc "UNKNOWN ARCHIVE VERSION",0 + +t1 .asc "ARCHIVE HAD BYTES #",0 + .) + +unpackfile + .( + lda #0 + sta wcnt + sta wcnt+1 + lda #TC_CR + jsr BSOUT + ldy #0 + sty P1 +l1 jsr rbyte + bcs endx + ldy P1 + sta filetab,y + inc P1 + cmp #0 + beq endnam + jsr BSOUT + jmp l1 + +endnam Tout(ask) + jsr waitkey + cmp #"J" + bne nounpack + Tout(tok) + lda #<-1 + sta P1+1 + jsr fxopen + jsr Getzst + bcs xa + bcc lo + +endx jmp end +nounpack Tout(tno) +xa lda #0 + sta P1+1 + +lo jsr rbyte + bcs cls + cmp #XCODE + bne xb + jsr rbyte + sta wxanz + cmp #0 + clc + beq cls + jsr rbyte + sta wxbyt + bit P1+1 + bpl lo +ly lda wxbyt + jsr wbyte + dec wxanz + bne ly + jmp lo + +xb bit P1+1 + bpl lo + jsr wbyte + jmp lo + +cls php + jsr wbuf + lda #FN_WR + jsr CLOSE + + Tout(t1) + lda wcnt+1 + ldx wcnt + jsr INTOUT + lda #TC_CR + jsr BSOUT + + plp +end rts + +ask .asc TC_CR,"EXTRACT FILE (Y/N)?",0 + +t1 .asc "GIVES BYTES #",0 + .) + +incwcnt .( + inc wcnt + bne l1 + inc wcnt+1 +l1 rts + .) + +fxopen .( + ldy #0 + sty INT +l1 lda zielpfad,y + sta INBUF,y + beq l2 + iny + cmp #":" + beq l1a + cmp #"/" + bne l1b +l1a sty INT +l1b cpy #PFADLEN + bcc l1 + +l2 ldx INT + ldy #0 +l3 lda filetab,y + sta INBUF,x + inx + iny + cmp #0 + bne l3 + dex + txa + ldx #INBUF + jsr SETFNPAR + lda #FN_WR + ldx zieldrv + ldy #1 + jsr SETFPAR + + jsr OPEN + bcs err + jsr clrwrbuf + clc +err rts + .) + +openarcrd .( + ldy #0 +l0 lda quellpfad,y + beq l1 + iny + cpy #PFADLEN + bcc l0 +l1 cpy #0 + beq err + tya + ldx #quellpfad + jsr SETFNPAR + lda #FN_RD + ldx quelldrv + ldy #0 + jsr SETFPAR + jsr OPEN + bcs err + jsr Getqst + bcs err + jsr clrrdbuf + clc + rts +err sec + rts + .) + +pack .( + jsr getlist + lda anzfiles + beq end + jsr openarcwr + bcs cls + + lda #Version + jsr wbyte + + lda #0 + sta P1 +l1 jsr setfadr + sta P2 + stx P2+1 + jsr packfile + inc P1 + lda P1 + cmp anzfiles + bcc l1 + + jsr wbuf + +cls lda #FN_WR + jsr CLOSE + + jsr Getzst + +end jmp LINEIN:rts + .) + +packfile .( + Tout(lft) + + ldy #0 +l1 sty P1+1 + lda (P2),y + jsr BSOUT + jsr wbyte + ldy P1+1 + iny + cmp #0 + bne l1 + + jsr fopen + bcs le + + jsr clrwxbyt +l2 jsr rbyte + bcs l3 + jsr wxbyte + jmp l2 +l3 jsr savwxbyt + +le lda #FN_RD + jsr CLOSE + + lda #XCODE + jsr wbyte + lda #0 + jsr wbyte + + lda #TC_CR + jsr BSOUT + rts + +lft .asc TC_CR,"cOPYING ",0 + + .) + +fopen .( + ldy #0 + sty INT +l1 lda quellpfad,y + sta INBUF,y + beq l2 + iny + cmp #":" + beq l1a + cmp #"/" + bne l1b +l1a sty INT +l1b cpy #PFADLEN + bcc l1 + +l2 ldx INT + ldy #0 +l3 lda (P2),y + sta INBUF,x + inx + iny + cmp #0 + bne l3 + dex + txa + ldx #INBUF + jsr SETFNPAR + lda #FN_RD + ldx quelldrv + ldy #0 + jsr SETFPAR + + jsr OPEN + bcs err + jsr clrrdbuf + clc +err rts + .) + +incrcnt .( + inc rcnt + bne l1 + inc rcnt+1 +l1 rts + .) + +rbyte .( + ldy ro + cpy ri + beq leerbuf + lda rb,y + inc ro + clc + rts + +leerbuf lda rf + beq ldbuf + sec + rts + +ldbuf lda #0 + sta ri + sta ro + ldx #FN_RD + jsr CHKIN + lda #0 + sta STATUS + +lok jsr BASIN + + pha + lda STATUS + beq l0 + lda #"L" + jsr BSOUT + Ibout($90) + lda #TC_CR + jsr BSOUT +l0 pla + + jsr incrcnt + ldy ri + sta rb,y + iny + sty ri + iny + ;cpy ro + beq le + lda STATUS + beq lok + +le lda STATUS + sta rf + jsr CLRCH + jmp rbyte + .) + +clrrdbuf .( + lda #0 + sta ri + sta ro + sta rf + rts + .) + +wxbyte .( + ldx wxanz + beq add + inx + bne ad2 + pha + jsr savwxbyt + pla + jmp add + +ad2 cmp wxbyt + beq adx + pha + jsr savwxbyt + pla +add sta wxbyt +adx inc wxanz + + rts + .) + +clrwxbyt .( + lda #0 + sta wxanz + rts + .) + +savwxbyt .( + lda wxanz + beq nosav + cmp #4 + bcs savs + lda wxbyt + cmp #XCODE + beq savs + +l1 lda wxbyt + jsr wbyte + dec wxanz + bne l1 + rts + +savs lda #XCODE + jsr wbyte + lda wxanz + jsr wbyte + lda wxbyt + jsr wbyte + lda #0 + sta wxanz +nosav rts + .) + +openarcwr .( + ldy #0 +l0 lda zielpfad,y + beq l1 + iny + cpy #PFADLEN + bcc l0 +l1 cpy #0 + beq err + tya + ldx #zielpfad + jsr SETFNPAR + lda #FN_WR + ldx zieldrv + ldy #1 + jsr SETFPAR + jsr OPEN + bcs err + lda zieldrv + jsr Getzst + bcs err + jsr clrwrbuf + clc + rts +err sec + rts + .) + +clrwrbuf .( + lda #0 + sta wi + sta wo + rts + .) + +wbyte .( + ldy wi + sta wb,y + iny + sty wi + iny + cpy wo + bne nowr + pha + jsr wbuf + pla +nowr rts + .) + +wbuf .( + ldx #FN_WR + jsr CKOUT + ldy wo +l1 cpy wi + beq end + lda wb,y + jsr BSOUT + + lda STATUS + beq l0 + tya + pha + lda #"W" + jsr $e716 + lda $90 + ora #$40 + jsr $e716 + lda #TC_CR + jsr $e716 + pla + tay +l0 + jsr incwcnt + iny + jmp l1 +end lda #0 + sta wi + sta wo + jsr CLRCH + rts + .) + + .( +&Getqst lda quelldrv + jmp Getst +&Getzst lda zieldrv +&Getst + pha + jsr CLRCH + lda #TC_CR + jsr BSOUT + pla + jsr TALK + lda #15+$60 + jsr SECTALK + lda #0 + sta STATUS + jsr IECIN + pha + jsr BSOUT + +l1 jsr IECIN + cmp #0 + beq l2 + jsr BSOUT + lda STATUS + beq l1 +l2 jsr UNTALK + pla + cmp #"0" + bne err + clc + rts +err sec + rts + .) + +/* +showlist .( + lda #0 + sta P1 + +l1 lda P1 + cmp anzfiles + bcs le + + jsr setfadr + lda #TC_CR + jsr BSOUT + lda INT + ldy INT+1 + jsr Txtout + inc P1 + jmp l1 +le rts + .) +*/ + .( +l4x jmp l4 + +&getlist + lda #0 + sta anzfiles + + lda #TC_FF + jsr BSOUT + + jsr setdirnam + jsr SENDNAM + lda DEVADR + jsr TALK + lda SECADR + jsr SECTALK + + lda #0 + sta STATUS + ldy #3 +l0 sty P1 +l1 jsr IECIN + sta P1+1 + ldy STATUS + bne l4x + jsr IECIN + dec P1 + bne l1 + ldx P1+1 + jsr INTOUT + lda #" " + jsr BSOUT + +la jsr IECIN + cmp #0 + beq l4x + cmp #TC_REV + bne l3x + jmp l3 +l3x jsr BSOUT + cmp #34 + bne la + + lda anzfiles + jsr setfadr + sta P2 + stx P2+1 + + ldy #0 +lb sty P1 + jsr IECIN + jsr BSOUT + ldy P1 + cmp #34 + beq lc + sta (P2),y + iny + cpy #17 + bcc lb +lc lda #"," + sta (P2),y + iny + +ld sty P1 + jsr IECIN + jsr BSOUT + ldy P1 + cmp #" " + beq ld + sta P1+1 + sta (P2),y + iny + lda #0 + sta (P2),y +/* + lda #TC_CR + jsr BSOUT + lda P2+1 + ldx P2 + jsr INTOUT + lda #":" + jsr BSOUT + lda P2 + ldy P2+1 + jsr Txtout +*/ +lf tax + jsr IECIN + jsr BSOUT + cmp #" " + bne lf + cpx #"<" + beq lg + lda #" " + jsr BSOUT +lg lda #" " + jsr BSOUT + + lda P1+1 + jsr testkeys + +lh jsr IECIN + cmp #0 + bne lh + beq l2 + +l3 jsr IECIN + ldx STATUS + bne l4 + tax + beq l2 + jsr BSOUT + jmp l3 + +l2 lda #TC_CR + jsr BSOUT + jsr GET + beq l5 + jsr waitkey +l5 ldy #2 + beq l4 + jmp l0 +l4 jsr CLSFIL + jmp waitkey + .) + +testkeys .( + cmp #"P" + beq ok + cmp #"S" + beq ok + rts +ok Tout(t1) + jsr waitkey + cmp #"J" + beq ja + Tout(tno) + rts +ja Tout(tok) + inc anzfiles + rts + +t1 .asc TC_REV,"YES/NO ",TC_CRL,TC_CRL,TC_CRL + .asc TC_CRL,TC_CRL,TC_CRL,TC_CRL,0 +&tno .asc TC_REO,"NO ",0 +&tok .asc TC_REO,"YES ",0 + .) + +setfadr .( + ldx #0 + stx INT+1 + asl + rol INT+1 + asl + rol INT+1 + sta INT + ldx INT+1 + asl + rol INT+1 + asl + rol INT+1 + clc + adc INT + sta INT + txa + adc INT+1 + sta INT+1 + lda #filetab + adc INT+1 + sta INT+1 + tax + pla + rts + .) + +dir .( + lda #TC_FF + jsr BSOUT + + jsr setdirnam + jsr SENDNAM + lda DEVADR + jsr TALK + lda SECADR + jsr SECTALK + + lda #0 + sta STATUS + ldy #3 +l0 sty P1 +l1 jsr IECIN + sta P1+1 + ldy STATUS + bne l4 + jsr IECIN + dec P1 + bne l1 + ldx P1+1 + jsr INTOUT + lda #" " + jsr BSOUT +l3 jsr IECIN + ldx STATUS + bne l4 + tax + beq l2 + jsr BSOUT + jmp l3 +l2 lda #TC_CR + jsr BSOUT + jsr GET + beq l5 + jsr waitkey +l5 ldy #2 + bne l0 +l4 jsr CLSFIL + jmp waitkey + .) + +waitkey jsr GET + beq waitkey + rts + +setdirnam .( +p1 =INT + + lda #"$" + sta INBUF + ldx #1 + stx p1 + + ldy #0 +l1 lda quellpfad,y + beq nodp + cmp #":" + beq dp + iny + cpy #PFADLEN + bcc l1 +nodp lda #":" + sta INBUF,x + inx +dp ldy #0 +dp1 lda quellpfad,y + sta INBUF,x + beq end + cmp #":" + beq l2a + cmp #"/" + bne l2 +l2a stx p1 +l2 inx + iny + cpy #PFADLEN + bcc dp1 +end ldx p1 + inx + lda #"*" + sta INBUF,x + inx + lda #"." + sta INBUF,x + inx + lda #"*" + sta INBUF,x + inx + txa + ldx #INBUF + jsr SETFNPAR + lda #1 + ldx quelldrv + ldy #0 + jmp SETFPAR + .) + +qdrv .( + inc quelldrv + lda quelldrv + cmp #12 + bcc ok + lda #8 + sta quelldrv +ok rts + .) + +zdrv .( + inc zieldrv + lda zieldrv + cmp #12 + bcc ok + lda #8 + sta zieldrv +ok rts + .) + +quelle .( + Tout(quelltxt) + jsr LINEIN + ldy #0 +q1 lda INBUF,y + sta quellpfad,y + beq end + iny + cpy #PFADLEN-1 + bcc q1 + lda #0 + sta quellpfad,y +end rts + +quelltxt .asc TC_CR,"PLEASE INPUT NEW SOURCEPATH/ARCHIVE:",TC_CR,0 + .) + +ziel .( + Tout(quelltxt) + jsr LINEIN + ldy #0 +q1 lda INBUF,y + sta zielpfad,y + beq end + iny + cpy #PFADLEN-1 + bcc q1 + lda #0 + sta zielpfad,y +end rts + +quelltxt .asc TC_CR,"PLEASE INPUT NEW TARGETPATH/ARCHIVE:",TC_CR,0 + .) + +switch .( + lda quelldrv + ldx zieldrv + stx quelldrv + sta zieldrv + ldx #0 +l1 lda quellpfad,x + pha + lda zielpfad,x + sta quellpfad,x + pla + sta zielpfad,x + inx + cpx #PFADLEN + bcc l1 + rts + .) + +inipar .( + lda #0 + sta quellpfad + sta zielpfad + lda DEVADR + cmp #8 + bcc noval + cmp #12 + bcc ok +noval lda #8 +ok sta quelldrv + sta zieldrv + rts + .) + +Txtout .( +p =$22 + + sta p + sty p+1 +l1 ldy #0 + lda (p),y + beq le + jsr BSOUT + inc p + bne l1 + inc p+1 + bne l1 +le rts + .) + +iniscreen .( + lda #COL_SCHWARZ + sta VIC+VIC_EXTCOL + sta VIC+VIC_BCKCOL0 + lda #TC_HELLGRUEN + jsr BSOUT + rts + .) + +sysmem =* + +quelldrv =sysmem +zieldrv =sysmem+1 +-sysmem +=2 + +quellpfad =sysmem +zielpfad =sysmem+PFADLEN +-sysmem +=2*PFADLEN + +anzfiles =sysmem +-sysmem +=1 + +wi =sysmem +wo =sysmem+1 +-sysmem +=2 +wb =sysmem +-sysmem +=256 + +wxbyt =sysmem +wxanz =sysmem+1 +-sysmem +=2 + +ri =sysmem +ro =sysmem+1 +rf =sysmem+2 +-sysmem +=3 +rb =sysmem +-sysmem +=256 + +wcnt =sysmem +-sysmem +=2 +rcnt =sysmem +-sysmem +=2 +ecnt =sysmem +-sysmem +=2 + +filetab =sysmem +ende .) + diff --git a/xa/tests/cpktest/pack_ger.a65 b/xa/tests/cpktest/pack_ger.a65 new file mode 100644 index 0000000..c65851d --- /dev/null +++ b/xa/tests/cpktest/pack_ger.a65 @@ -0,0 +1,1070 @@ + +#include "c64def.def" + +#define Tout(a) .(:lda #a:jsr Txtout:.) +#define Aout(a) .(:lda #b:jsr Txtout:jmp c:b .byt a,0:c .) +#define Ibout(a) .(:ldx a:lda #0:jsr INTOUT:.) +#define Iout(a) .(:ldx a:lda a+1:jsr INTOUT:.) + +#define PFADLEN 40 +#define FN_WR 3 +#define FN_RD 4 +#define XCODE $f7 +#define Version 1 + + .( + .word $0801 + *=$0801 + + .word basicend,10 + .byt $9e,"2064",0 ;sys $0810 +basicend .word 0 + .byt 0,0,0 + + .( + jsr CLRCH + jsr iniscreen + jsr inipar +menu1 + Tout(m1atxt) + Tout(quellpfad) + Tout(m1btxt) + Ibout(quelldrv) + Tout(m1ctxt) + Tout(zielpfad) + Tout(m1dtxt) + Ibout(zieldrv) + Tout(m1etxt) + +next jsr GET + beq next + + ldx #0 +l1 cmp befkeys,x + beq exe + inx + cpx #Anzbefs + bcc l1 + bcs next + +exe jsr exec + jmp menu1 + +exec txa + asl + tax + lda madr+1,x + pha + lda madr,x + pha + rts + +madr .word pack-1,unpack-1,quelle-1,ziel-1,switch-1,dir-1,qdrv-1,zdrv-1 +befkeys .asc TC_F1,TC_F2,TC_F3,TC_F5,TC_F8,TC_F7,TC_F4,TC_F6 +Anzbefs =8 + +m1atxt .asc TC_LCH,TC_SCO,TC_FF,TC_LF,TC_LF + .asc "(F1) PROGRAMME ZUSAMMENPACKEN",TC_CR,TC_LF + .asc "(F2) ARCHIV AUSPACKEN",TC_CR,TC_LF + .asc "(F3) QUELLPFAD:",0 +m1btxt .asc TC_CR,TC_LF + .asc "(F4) QUELLDEVICE:",0 +m1ctxt .asc TC_CR,TC_LF + .asc "(F5) ZIELPFAD :",0 +m1dtxt .asc TC_CR,TC_LF + .asc "(F6) ZIELDEVICE :",0 +m1etxt .asc TC_CR,TC_LF + .asc "(F7) QUELLDIRECTORY",TC_CR,TC_LF + .asc "(F8) QUELLE UND ZIEL TAUSCHEN",TC_CR,TC_LF + .asc "IHRE EINGABE BITTE",TC_CR,0 + .) + +unpack .( + jsr openarcrd + bcs cls + + lda #0 + sta rcnt + sta rcnt+1 + + jsr rbyte + cmp #Version + bne verr + +loop jsr unpackfile + bcc loop + + Tout(t1) + lda rcnt+1 + ldx rcnt + jsr INTOUT + lda #TC_CR + jsr BSOUT + jsr waitkey + +cls lda #FN_RD + jsr CLOSE + rts + +verr Tout(verrtxt) + jmp cls +verrtxt .asc "UNGUELTIGE ARCHIV-VERSION",0 + +t1 .asc "ARCHIV HATTE BYTES #",0 + .) + +unpackfile + .( + lda #0 + sta wcnt + sta wcnt+1 + lda #TC_CR + jsr BSOUT + ldy #0 + sty P1 +l1 jsr rbyte + bcs endx + ldy P1 + sta filetab,y + inc P1 + cmp #0 + beq endnam + jsr BSOUT + jmp l1 + +endnam Tout(ask) + jsr waitkey + cmp #"J" + bne nounpack + Tout(tok) + lda #<-1 + sta P1+1 + jsr fxopen + jsr Getzst + bcs xa + bcc lo + +endx jmp end +nounpack Tout(tno) +xa lda #0 + sta P1+1 + +lo jsr rbyte + bcs cls + cmp #XCODE + bne xb + jsr rbyte + sta wxanz + cmp #0 + clc + beq cls + jsr rbyte + sta wxbyt + bit P1+1 + bpl lo +ly lda wxbyt + jsr wbyte + dec wxanz + bne ly + jmp lo + +xb bit P1+1 + bpl lo + jsr wbyte + jmp lo + +cls php + jsr wbuf + lda #FN_WR + jsr CLOSE + + Tout(t1) + lda wcnt+1 + ldx wcnt + jsr INTOUT + lda #TC_CR + jsr BSOUT + + plp +end rts + +ask .asc TC_CR,"DATEI AUSPACKEN (J/N)?",0 + +t1 .asc "ERGIBT BYTES #",0 + .) + +incwcnt .( + inc wcnt + bne l1 + inc wcnt+1 +l1 rts + .) + +fxopen .( + ldy #0 + sty INT +l1 lda zielpfad,y + sta INBUF,y + beq l2 + iny + cmp #":" + beq l1a + cmp #"/" + bne l1b +l1a sty INT +l1b cpy #PFADLEN + bcc l1 + +l2 ldx INT + ldy #0 +l3 lda filetab,y + sta INBUF,x + inx + iny + cmp #0 + bne l3 + dex + txa + ldx #INBUF + jsr SETFNPAR + lda #FN_WR + ldx zieldrv + ldy #1 + jsr SETFPAR + + jsr OPEN + bcs err + jsr clrwrbuf + clc +err rts + .) + +openarcrd .( + ldy #0 +l0 lda quellpfad,y + beq l1 + iny + cpy #PFADLEN + bcc l0 +l1 cpy #0 + beq err + tya + ldx #quellpfad + jsr SETFNPAR + lda #FN_RD + ldx quelldrv + ldy #0 + jsr SETFPAR + jsr OPEN + bcs err + jsr Getqst + bcs err + jsr clrrdbuf + clc + rts +err sec + rts + .) + +pack .( + jsr getlist + lda anzfiles + beq end + jsr openarcwr + bcs cls + + lda #Version + jsr wbyte + + lda #0 + sta P1 +l1 jsr setfadr + sta P2 + stx P2+1 + jsr packfile + inc P1 + lda P1 + cmp anzfiles + bcc l1 + + jsr wbuf + +cls lda #FN_WR + jsr CLOSE + + jsr Getzst + +end jmp LINEIN:rts + .) + +packfile .( + Tout(lft) + + ldy #0 +l1 sty P1+1 + lda (P2),y + jsr BSOUT + jsr wbyte + ldy P1+1 + iny + cmp #0 + bne l1 + + jsr fopen + bcs le + + jsr clrwxbyt +l2 jsr rbyte + bcs l3 + jsr wxbyte + jmp l2 +l3 jsr savwxbyt + +le lda #FN_RD + jsr CLOSE + + lda #XCODE + jsr wbyte + lda #0 + jsr wbyte + + lda #TC_CR + jsr BSOUT + rts + +lft .asc TC_CR,"cOPYING ",0 + + .) + +fopen .( + ldy #0 + sty INT +l1 lda quellpfad,y + sta INBUF,y + beq l2 + iny + cmp #":" + beq l1a + cmp #"/" + bne l1b +l1a sty INT +l1b cpy #PFADLEN + bcc l1 + +l2 ldx INT + ldy #0 +l3 lda (P2),y + sta INBUF,x + inx + iny + cmp #0 + bne l3 + dex + txa + ldx #INBUF + jsr SETFNPAR + lda #FN_RD + ldx quelldrv + ldy #0 + jsr SETFPAR + + jsr OPEN + bcs err + jsr clrrdbuf + clc +err rts + .) + +incrcnt .( + inc rcnt + bne l1 + inc rcnt+1 +l1 rts + .) + +rbyte .( + ldy ro + cpy ri + beq leerbuf + lda rb,y + inc ro + clc + rts + +leerbuf lda rf + beq ldbuf + sec + rts + +ldbuf lda #0 + sta ri + sta ro + ldx #FN_RD + jsr CHKIN + lda #0 + sta STATUS + +lok jsr BASIN + + pha + lda STATUS + beq l0 + lda #"L" + jsr BSOUT + Ibout($90) + lda #TC_CR + jsr BSOUT +l0 pla + + jsr incrcnt + ldy ri + sta rb,y + iny + sty ri + iny + ;cpy ro + beq le + lda STATUS + beq lok + +le lda STATUS + sta rf + jsr CLRCH + jmp rbyte + .) + +clrrdbuf .( + lda #0 + sta ri + sta ro + sta rf + rts + .) + +wxbyte .( + ldx wxanz + beq add + inx + bne ad2 + pha + jsr savwxbyt + pla + jmp add + +ad2 cmp wxbyt + beq adx + pha + jsr savwxbyt + pla +add sta wxbyt +adx inc wxanz + + rts + .) + +clrwxbyt .( + lda #0 + sta wxanz + rts + .) + +savwxbyt .( + lda wxanz + beq nosav + cmp #4 + bcs savs + lda wxbyt + cmp #XCODE + beq savs + +l1 lda wxbyt + jsr wbyte + dec wxanz + bne l1 + rts + +savs lda #XCODE + jsr wbyte + lda wxanz + jsr wbyte + lda wxbyt + jsr wbyte + lda #0 + sta wxanz +nosav rts + .) + +openarcwr .( + ldy #0 +l0 lda zielpfad,y + beq l1 + iny + cpy #PFADLEN + bcc l0 +l1 cpy #0 + beq err + tya + ldx #zielpfad + jsr SETFNPAR + lda #FN_WR + ldx zieldrv + ldy #1 + jsr SETFPAR + jsr OPEN + bcs err + lda zieldrv + jsr Getzst + bcs err + jsr clrwrbuf + clc + rts +err sec + rts + .) + +clrwrbuf .( + lda #0 + sta wi + sta wo + rts + .) + +wbyte .( + ldy wi + sta wb,y + iny + sty wi + iny + cpy wo + bne nowr + pha + jsr wbuf + pla +nowr rts + .) + +wbuf .( + ldx #FN_WR + jsr CKOUT + ldy wo +l1 cpy wi + beq end + lda wb,y + jsr BSOUT + + lda STATUS + beq l0 + tya + pha + lda #"W" + jsr $e716 + lda $90 + ora #$40 + jsr $e716 + lda #TC_CR + jsr $e716 + pla + tay +l0 + jsr incwcnt + iny + jmp l1 +end lda #0 + sta wi + sta wo + jsr CLRCH + rts + .) + + .( +&Getqst lda quelldrv + jmp Getst +&Getzst lda zieldrv +&Getst + pha + jsr CLRCH + lda #TC_CR + jsr BSOUT + pla + jsr TALK + lda #15+$60 + jsr SECTALK + lda #0 + sta STATUS + jsr IECIN + pha + jsr BSOUT + +l1 jsr IECIN + cmp #0 + beq l2 + jsr BSOUT + lda STATUS + beq l1 +l2 jsr UNTALK + pla + cmp #"0" + bne err + clc + rts +err sec + rts + .) + +/* +showlist .( + lda #0 + sta P1 + +l1 lda P1 + cmp anzfiles + bcs le + + jsr setfadr + lda #TC_CR + jsr BSOUT + lda INT + ldy INT+1 + jsr Txtout + inc P1 + jmp l1 +le rts + .) +*/ + .( +l4x jmp l4 + +&getlist + lda #0 + sta anzfiles + + lda #TC_FF + jsr BSOUT + + jsr setdirnam + jsr SENDNAM + lda DEVADR + jsr TALK + lda SECADR + jsr SECTALK + + lda #0 + sta STATUS + ldy #3 +l0 sty P1 +l1 jsr IECIN + sta P1+1 + ldy STATUS + bne l4x + jsr IECIN + dec P1 + bne l1 + ldx P1+1 + jsr INTOUT + lda #" " + jsr BSOUT + +la jsr IECIN + cmp #0 + beq l4x + cmp #TC_REV + bne l3x + jmp l3 +l3x jsr BSOUT + cmp #34 + bne la + + lda anzfiles + jsr setfadr + sta P2 + stx P2+1 + + ldy #0 +lb sty P1 + jsr IECIN + jsr BSOUT + ldy P1 + cmp #34 + beq lc + sta (P2),y + iny + cpy #17 + bcc lb +lc lda #"," + sta (P2),y + iny + +ld sty P1 + jsr IECIN + jsr BSOUT + ldy P1 + cmp #" " + beq ld + sta P1+1 + sta (P2),y + iny + lda #0 + sta (P2),y +/* + lda #TC_CR + jsr BSOUT + lda P2+1 + ldx P2 + jsr INTOUT + lda #":" + jsr BSOUT + lda P2 + ldy P2+1 + jsr Txtout +*/ +lf tax + jsr IECIN + jsr BSOUT + cmp #" " + bne lf + cpx #"<" + beq lg + lda #" " + jsr BSOUT +lg lda #" " + jsr BSOUT + + lda P1+1 + jsr testkeys + +lh jsr IECIN + cmp #0 + bne lh + beq l2 + +l3 jsr IECIN + ldx STATUS + bne l4 + tax + beq l2 + jsr BSOUT + jmp l3 + +l2 lda #TC_CR + jsr BSOUT + jsr GET + beq l5 + jsr waitkey +l5 ldy #2 + beq l4 + jmp l0 +l4 jsr CLSFIL + jmp waitkey + .) + +testkeys .( + cmp #"P" + beq ok + cmp #"S" + beq ok + rts +ok Tout(t1) + jsr waitkey + cmp #"J" + beq ja + Tout(tno) + rts +ja Tout(tok) + inc anzfiles + rts + +t1 .asc TC_REV,"JA/NEIN",TC_CRL,TC_CRL,TC_CRL + .asc TC_CRL,TC_CRL,TC_CRL,TC_CRL,0 +&tno .asc TC_REO,"NEIN ",0 +&tok .asc TC_REO,"JA ",0 + .) + +setfadr .( + ldx #0 + stx INT+1 + asl + rol INT+1 + asl + rol INT+1 + sta INT + ldx INT+1 + asl + rol INT+1 + asl + rol INT+1 + clc + adc INT + sta INT + txa + adc INT+1 + sta INT+1 + lda #filetab + adc INT+1 + sta INT+1 + tax + pla + rts + .) + +dir .( + lda #TC_FF + jsr BSOUT + + jsr setdirnam + jsr SENDNAM + lda DEVADR + jsr TALK + lda SECADR + jsr SECTALK + + lda #0 + sta STATUS + ldy #3 +l0 sty P1 +l1 jsr IECIN + sta P1+1 + ldy STATUS + bne l4 + jsr IECIN + dec P1 + bne l1 + ldx P1+1 + jsr INTOUT + lda #" " + jsr BSOUT +l3 jsr IECIN + ldx STATUS + bne l4 + tax + beq l2 + jsr BSOUT + jmp l3 +l2 lda #TC_CR + jsr BSOUT + jsr GET + beq l5 + jsr waitkey +l5 ldy #2 + bne l0 +l4 jsr CLSFIL + jmp waitkey + .) + +waitkey jsr GET + beq waitkey + rts + +setdirnam .( +p1 =INT + + lda #"$" + sta INBUF + ldx #1 + stx p1 + + ldy #0 +l1 lda quellpfad,y + beq nodp + cmp #":" + beq dp + iny + cpy #PFADLEN + bcc l1 +nodp lda #":" + sta INBUF,x + inx +dp ldy #0 +dp1 lda quellpfad,y + sta INBUF,x + beq end + cmp #":" + beq l2a + cmp #"/" + bne l2 +l2a stx p1 +l2 inx + iny + cpy #PFADLEN + bcc dp1 +end ldx p1 + inx + lda #"*" + sta INBUF,x + inx + lda #"." + sta INBUF,x + inx + lda #"*" + sta INBUF,x + inx + txa + ldx #INBUF + jsr SETFNPAR + lda #1 + ldx quelldrv + ldy #0 + jmp SETFPAR + .) + +qdrv .( + inc quelldrv + lda quelldrv + cmp #12 + bcc ok + lda #8 + sta quelldrv +ok rts + .) + +zdrv .( + inc zieldrv + lda zieldrv + cmp #12 + bcc ok + lda #8 + sta zieldrv +ok rts + .) + +quelle .( + Tout(quelltxt) + jsr LINEIN + ldy #0 +q1 lda INBUF,y + sta quellpfad,y + beq end + iny + cpy #PFADLEN-1 + bcc q1 + lda #0 + sta quellpfad,y +end rts + +quelltxt .asc TC_CR,"BITTE NEUEN QUELLPFAD EINGEBEN:",TC_CR,0 + .) + +ziel .( + Tout(quelltxt) + jsr LINEIN + ldy #0 +q1 lda INBUF,y + sta zielpfad,y + beq end + iny + cpy #PFADLEN-1 + bcc q1 + lda #0 + sta zielpfad,y +end rts + +quelltxt .asc TC_CR,"BITTE NEUEN ZIELPFAD EINGEBEN:",TC_CR,0 + .) + +switch .( + lda quelldrv + ldx zieldrv + stx quelldrv + sta zieldrv + ldx #0 +l1 lda quellpfad,x + pha + lda zielpfad,x + sta quellpfad,x + pla + sta zielpfad,x + inx + cpx #PFADLEN + bcc l1 + rts + .) + +inipar .( + lda #0 + sta quellpfad + sta zielpfad + lda DEVADR + cmp #8 + bcc noval + cmp #12 + bcc ok +noval lda #8 +ok sta quelldrv + sta zieldrv + rts + .) + +Txtout .( +p =$22 + + sta p + sty p+1 +l1 ldy #0 + lda (p),y + beq le + jsr BSOUT + inc p + bne l1 + inc p+1 + bne l1 +le rts + .) + +iniscreen .( + lda #COL_SCHWARZ + sta VIC+VIC_EXTCOL + sta VIC+VIC_BCKCOL0 + lda #TC_HELLGRUEN + jsr BSOUT + rts + .) + +sysmem =* + +quelldrv =sysmem +zieldrv =sysmem+1 +-sysmem +=2 + +quellpfad =sysmem +zielpfad =sysmem+PFADLEN +-sysmem +=2*PFADLEN + +anzfiles =sysmem +-sysmem +=1 + +wi =sysmem +wo =sysmem+1 +-sysmem +=2 +wb =sysmem +-sysmem +=256 + +wxbyt =sysmem +wxanz =sysmem+1 +-sysmem +=2 + +ri =sysmem +ro =sysmem+1 +rf =sysmem+2 +-sysmem +=3 +rb =sysmem +-sysmem +=256 + +wcnt =sysmem +-sysmem +=2 +rcnt =sysmem +-sysmem +=2 +ecnt =sysmem +-sysmem +=2 + +filetab =sysmem +ende .) + diff --git a/xa/tests/cpp/over.asm b/xa/tests/cpp/over.asm deleted file mode 100644 index 96598e4..0000000 --- a/xa/tests/cpp/over.asm +++ /dev/null @@ -1,22 +0,0 @@ -# 1 "over.c" -# 1 "" -# 1 "/usr/include/stdc-predef.h" 1 3 4 -# 1 "" 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 diff --git a/xa/tests/dos51/Makefile b/xa/tests/dos51/Makefile new file mode 100644 index 0000000..417476f --- /dev/null +++ b/xa/tests/dos51/Makefile @@ -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 diff --git a/xa/tests/dos51/dos51.inc b/xa/tests/dos51/dos51.inc new file mode 100644 index 0000000..d16c32c --- /dev/null +++ b/xa/tests/dos51/dos51.inc @@ -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 +.) diff --git a/xa/tests/dos51/ok b/xa/tests/dos51/ok new file mode 100644 index 0000000..84415e9 Binary files /dev/null and b/xa/tests/dos51/ok differ diff --git a/xa/tests/dos51/test.s b/xa/tests/dos51/test.s new file mode 100644 index 0000000..ee8d37c --- /dev/null +++ b/xa/tests/dos51/test.s @@ -0,0 +1,6 @@ +#define SA51 $c123 +#include "dos51.inc" + +#ifdef BUG +jsr crunchsrv +#endif diff --git a/xa/tests/fordef/ok.out b/xa/tests/fordef/ok.out index 7480db3..bd0ddd8 100644 --- a/xa/tests/fordef/ok.out +++ b/xa/tests/fordef/ok.out @@ -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 diff --git a/xa/tests/masmcom/Makefile b/xa/tests/masmcom/Makefile new file mode 100644 index 0000000..6e85604 --- /dev/null +++ b/xa/tests/masmcom/Makefile @@ -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 diff --git a/xa/tests/masmcom/okmasm b/xa/tests/masmcom/okmasm new file mode 100644 index 0000000..6d63e97 Binary files /dev/null and b/xa/tests/masmcom/okmasm differ diff --git a/xa/tests/masmcom/oknomasm b/xa/tests/masmcom/oknomasm new file mode 100644 index 0000000..35c248d Binary files /dev/null and b/xa/tests/masmcom/oknomasm differ diff --git a/xa/tests/masmcom/test.s b/xa/tests/masmcom/test.s new file mode 100644 index 0000000..392a50e --- /dev/null +++ b/xa/tests/masmcom/test.s @@ -0,0 +1,3 @@ +/* when assembled with/without -M, we get two different objects */ + + lda #00 ; and this: lda #01 ; is why : lda #":" diff --git a/xa/tests/mvnmvp/Makefile b/xa/tests/mvnmvp/Makefile new file mode 100644 index 0000000..b48dbe9 --- /dev/null +++ b/xa/tests/mvnmvp/Makefile @@ -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 diff --git a/xa/tests/mvnmvp/ok b/xa/tests/mvnmvp/ok new file mode 100644 index 0000000..4c5e7d8 Binary files /dev/null and b/xa/tests/mvnmvp/ok differ diff --git a/xa/tests/mvnmvp/test.s b/xa/tests/mvnmvp/test.s new file mode 100644 index 0000000..c2d30d1 --- /dev/null +++ b/xa/tests/mvnmvp/test.s @@ -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 diff --git a/xa/tests/nonl/a.o65 b/xa/tests/nonl/a.o65 deleted file mode 100644 index e69de29..0000000 diff --git a/xa/tests/nonl/test.asm b/xa/tests/nonl/test.asm deleted file mode 100644 index 0e7fb25..0000000 --- a/xa/tests/nonl/test.asm +++ /dev/null @@ -1,3 +0,0 @@ - lda #4 - sta !$0005 - rts \ No newline at end of file diff --git a/xa/tests/op816/Makefile b/xa/tests/op816/Makefile new file mode 100644 index 0000000..b48dbe9 --- /dev/null +++ b/xa/tests/op816/Makefile @@ -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 diff --git a/xa/tests/op816/ok b/xa/tests/op816/ok new file mode 100644 index 0000000..8320439 Binary files /dev/null and b/xa/tests/op816/ok differ diff --git a/xa/tests/op816/test.s b/xa/tests/op816/test.s new file mode 100644 index 0000000..a2e6d25 --- /dev/null +++ b/xa/tests/op816/test.s @@ -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 diff --git a/xa/tests/openpp/Makefile b/xa/tests/openpp/Makefile new file mode 100644 index 0000000..9f38280 --- /dev/null +++ b/xa/tests/openpp/Makefile @@ -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 diff --git a/xa/tests/openpp/ok b/xa/tests/openpp/ok new file mode 100644 index 0000000..6963581 Binary files /dev/null and b/xa/tests/openpp/ok differ diff --git a/xa/tests/openpp/test.asm b/xa/tests/openpp/test.s similarity index 93% rename from xa/tests/openpp/test.asm rename to xa/tests/openpp/test.s index 8bdb8e9..82f62b1 100644 --- a/xa/tests/openpp/test.asm +++ b/xa/tests/openpp/test.s @@ -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 -*/ diff --git a/xa/tests/quotch/ok b/xa/tests/quotch/ok new file mode 100644 index 0000000..81665ae Binary files /dev/null and b/xa/tests/quotch/ok differ diff --git a/xa/tests/quotch/test.s b/xa/tests/quotch/test.s new file mode 100644 index 0000000..aed472e --- /dev/null +++ b/xa/tests/quotch/test.s @@ -0,0 +1,11 @@ + .word $9000 + * = $9000 + +; test specific single characters can be quoted + + LDA #';' + CMP #':' + AND #'"' + SBC #";" + ORA #":" + EOR #"'" diff --git a/xa/tests/recmac/a.o65 b/xa/tests/recmac/a.o65 deleted file mode 100644 index 7cd3c66..0000000 --- a/xa/tests/recmac/a.o65 +++ /dev/null @@ -1 +0,0 @@ -© \ No newline at end of file