mirror of
https://github.com/fachat/xa65.git
synced 2024-12-28 01:29:22 +00:00
merge Cameron's 2.3.6 official release into master
This commit is contained in:
parent
7e71d01a9a
commit
cafa94f82a
@ -295,3 +295,12 @@ xa-2.3.5
|
||||
* Documentation updated.
|
||||
|
||||
-- Cameron Kaiser <ckaiser@floodgap.com> 7 February, 2009
|
||||
|
||||
xa-2.3.6
|
||||
|
||||
* 'make test' for regression testing framework (requires Perl).
|
||||
* Changed getline() to xa_getline() to avoid collision with glibc 2.10+
|
||||
* Fixed compile problems with misc/.
|
||||
* Fixed message offsets.
|
||||
|
||||
-- Cameron Kaiser <ckaiser@floodgap.com> 11 July 2014
|
||||
|
11
xa/Makefile
11
xa/Makefile
@ -2,7 +2,9 @@
|
||||
#
|
||||
CC = gcc
|
||||
LD = gcc
|
||||
CFLAGS = -O2 -W -Wall -pedantic -std=c99 -g
|
||||
# for testing. not to be used; build failures in misc/.
|
||||
#CFLAGS = -O2 -W -Wall -pedantic -ansi
|
||||
CFLAGS = -O2
|
||||
LDFLAGS = -lc
|
||||
|
||||
# for DOS?
|
||||
@ -58,5 +60,8 @@ install: xa uncpk
|
||||
#$(MKDIR) $(DOCDIR)/xa65
|
||||
|
||||
dist: clean
|
||||
#cd .. ; tar cvf xa-2.3.5A.tar xa-2.3.5 ; gzip xa-2.3.5A.tar
|
||||
cd .. ; tar cvf xa-2.3.5.tar xa-2.3.5 ; gzip xa-2.3.5.tar
|
||||
#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
|
||||
|
||||
test:
|
||||
cd tests && ./harness -make="$(MAKE)" -cc="$(CC)" -cflags="$(CFLAGS)"
|
||||
|
@ -1,7 +1,8 @@
|
||||
|
||||
XCBMLIB = ..
|
||||
|
||||
CFLAGS = -Wall -O2 -ansi -W
|
||||
# -Wall -ansi et al. cause compile problems.
|
||||
CFLAGS = -O2
|
||||
|
||||
LIBS = #-lncurses -ltermcap -lm
|
||||
|
||||
|
@ -18,12 +18,13 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#ifndef _MSC_VER
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -33,8 +34,8 @@
|
||||
|
||||
#define programname "file65"
|
||||
#define progversion "v0.2.1"
|
||||
#define author "Written by André Fachat"
|
||||
#define copyright "Copyright (C) 1997-2002 André Fachat."
|
||||
#define author "Written by Andre Fachat"
|
||||
#define copyright "Copyright (C) 1997-2002 Andre Fachat."
|
||||
|
||||
int read_options(FILE *fp);
|
||||
int print_labels(FILE *fp, int offset);
|
||||
@ -160,11 +161,11 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
if(rompar==1) {
|
||||
printf("-A %lu ", (unsigned long)((hdr[9]*256+hdr[8])
|
||||
-hlen +romoff +fbuf.st_size));
|
||||
-hlen +romoff +(fbuf.st_size)));
|
||||
} else
|
||||
if(rompar==2) {
|
||||
printf("%lu ", (unsigned long)((hdr[9]*256+hdr[8])
|
||||
-hlen +romoff +fbuf.st_size));
|
||||
-hlen +romoff +(fbuf.st_size)));
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
@ -35,8 +35,8 @@
|
||||
|
||||
#define programname "ldo65"
|
||||
#define progversion "v0.1.1"
|
||||
#define author "Written by André Fachat"
|
||||
#define copyright "Copyright (C) 1997-2002 André Fachat. Formerly ld65."
|
||||
#define author "Written by Andre Fachat"
|
||||
#define copyright "Copyright (C) 1997-2002 Andre Fachat. Formerly ld65."
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
|
@ -26,8 +26,8 @@
|
||||
|
||||
#define programname "printcbm"
|
||||
#define progversion "v1.0.0"
|
||||
#define author "Written by André Fachat"
|
||||
#define copyright "Copyright (C) 1997-2002 André Fachat."
|
||||
#define author "Written by Andre Fachat"
|
||||
#define copyright "Copyright (C) 1997-2002 Andre Fachat."
|
||||
|
||||
char *cmd[] = {
|
||||
"end", "for", "next", "data", "input#", "input", "dim", "read",
|
||||
|
@ -31,8 +31,8 @@
|
||||
|
||||
#define programname "reloc65"
|
||||
#define progversion "v0.2.1"
|
||||
#define author "Written by André Fachat"
|
||||
#define copyright "Copyright (C) 1997-2002 André Fachat."
|
||||
#define author "Written by Andre Fachat"
|
||||
#define copyright "Copyright (C) 1997-2002 Andre Fachat."
|
||||
|
||||
typedef struct {
|
||||
char *fname;
|
||||
|
@ -29,8 +29,8 @@
|
||||
|
||||
#define programname "uncpk"
|
||||
#define progversion "v0.2.1"
|
||||
#define author "Written by André Fachat"
|
||||
#define copyright "Copyright (C) 1997-2002 André Fachat."
|
||||
#define author "Written by Andre Fachat"
|
||||
#define copyright "Copyright (C) 1997-2002 Andre Fachat."
|
||||
|
||||
FILE *fp;
|
||||
char name[100];
|
||||
|
12
xa/src/xa.c
12
xa/src/xa.c
@ -55,9 +55,9 @@
|
||||
#define ANZWARN 13
|
||||
|
||||
#define programname "xa"
|
||||
#define progversion "v2.3.5"
|
||||
#define progversion "v2.3.6"
|
||||
#define authors "Written by Andre Fachat, Jolse Maginnis, David Weinehall and Cameron Kaiser"
|
||||
#define copyright "Copyright (C) 1989-2009 Andre Fachat, Jolse Maginnis, David Weinehall\nand Cameron Kaiser."
|
||||
#define copyright "Copyright (C) 1989-2014 Andre Fachat, Jolse Maginnis, David Weinehall\nand Cameron Kaiser."
|
||||
|
||||
/* exported globals */
|
||||
int ncmos, cmosfl, w65816, n65816;
|
||||
@ -87,7 +87,7 @@ static int pass2(void);
|
||||
static int puttmp(int);
|
||||
static int puttmps(signed char *, int);
|
||||
static void chrput(int);
|
||||
static int xagetline(char *);
|
||||
static int xa_getline(char *);
|
||||
static void lineout(void);
|
||||
static long ga_p1(void);
|
||||
static long gm_p1(void);
|
||||
@ -763,7 +763,7 @@ static int pass1(void)
|
||||
temp_er = 0;
|
||||
|
||||
/*FIXIT*/
|
||||
while(!(er=xagetline(s)))
|
||||
while(!(er=xa_getline(s)))
|
||||
{
|
||||
er=t_p1((signed char*)s,o,&l,&al);
|
||||
switch(segment) {
|
||||
@ -898,7 +898,7 @@ static char *ertxt[] = {
|
||||
"DSB",
|
||||
"NewLine",
|
||||
"NewFile",
|
||||
"CMOS-Befehl",
|
||||
"CMOS instruction used with -C",
|
||||
"pp:Wrong parameter count",
|
||||
"Illegal pointer arithmetic",
|
||||
"Illegal segment",
|
||||
@ -1002,7 +1002,7 @@ static int puttmps(signed char *s, int l)
|
||||
|
||||
static char l[MAXLINE];
|
||||
|
||||
static int xagetline(char *s)
|
||||
static int xa_getline(char *s)
|
||||
{
|
||||
static int ec;
|
||||
|
||||
|
24
xa/src/xah.h
24
xa/src/xah.h
@ -112,19 +112,19 @@ typedef struct {
|
||||
#define E_OUTOFDATA -34 /* out of data */
|
||||
#define E_ILLQUANT -35 /* generic illegal quantity error */
|
||||
#define E_BIN -36 /* okdef */
|
||||
/* errors thru 63 are placeholders */
|
||||
/* errors thru 64 are placeholders */
|
||||
|
||||
#define W_ADRRELOC -64 /* word relocation in byte value */
|
||||
#define W_BYTRELOC -65 /* byte relocation in word value */
|
||||
#define E_WPOINTER -66 /* illegal pointer arithmetic! */
|
||||
#define W_ADDRACC -67 /* addr access to low or high byte pointer */
|
||||
#define W_HIGHACC -68 /* high byte access to low byte pointer */
|
||||
#define W_LOWACC -69 /* low byte access to high byte pointer */
|
||||
#define W_FORLAB -70 /* no zp-optimization for a forward label */
|
||||
#define W_OPENPP -71 /* warning about open preprocessor directive */
|
||||
#define W_OVER64K -72 /* included binary over 64K in 6502 mode */
|
||||
#define W_OVER16M -73 /* included binary over 16M in 65816 mode */
|
||||
/* warnings 74-76 are placeholders */
|
||||
#define W_ADRRELOC -65 /* word relocation in byte value */
|
||||
#define W_BYTRELOC -66 /* byte relocation in word value */
|
||||
#define E_WPOINTER -67 /* illegal pointer arithmetic! */
|
||||
#define W_ADDRACC -68 /* addr access to low or high byte pointer */
|
||||
#define W_HIGHACC -69 /* high byte access to low byte pointer */
|
||||
#define W_LOWACC -70 /* low byte access to high byte pointer */
|
||||
#define W_FORLAB -71 /* no zp-optimization for a forward label */
|
||||
#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 T_VALUE -1
|
||||
#define T_LABEL -2
|
||||
|
11
xa/src/xap.c
11
xa/src/xap.c
@ -214,20 +214,13 @@ int pp_endif(char *t)
|
||||
/* stub for handling CPP directives */
|
||||
int pp_cpp(char *t) {
|
||||
|
||||
char *fname = NULL;
|
||||
if(sscanf(t, " %d \"%ms\"", &filep->fline, &fname) == 2) {
|
||||
if(sscanf(t, " %d \"%s\"", &filep->fline, filep->fname) == 2) {
|
||||
/* massage it into our parameters and drop last quote */
|
||||
char *u = "";
|
||||
|
||||
filep->fline--;
|
||||
if((u = (char *)strrchr(fname, '"')))
|
||||
if((u = (char *)strrchr(filep->fname, '"')))
|
||||
*u = '\0';
|
||||
|
||||
// overwrite the original filename
|
||||
// this may create a memory leak, but we do not know
|
||||
// whether the file name has already been used in the cross
|
||||
// reference list. So we just accept that...
|
||||
filep->fname = fname;
|
||||
return (0);
|
||||
} else {
|
||||
return(E_SYNTAX);
|
||||
|
@ -2,6 +2,14 @@ This is a directory of test suites for complex or pathological cases that
|
||||
have been repaired (?) in the current version. It is primarily for internal
|
||||
testing, but is here for your interest.
|
||||
|
||||
Starting with 2.3.6, you should not normally need to run these directly
|
||||
unless 'make test' fails. If you do, use harness:
|
||||
|
||||
./harness -cc=... -cflags=... -make=... -tests=testdir,testdir,testdir,...
|
||||
|
||||
If -tests is omitted, all tests are run.
|
||||
Don't run the makefiles directly, if they exist; they may not work properly.
|
||||
|
||||
adrm/ Addressing mode test (especially the optimizer and quantity
|
||||
prefixes)
|
||||
nonl/ Patryk's no-new-line-on-last-line cases ;)
|
||||
|
BIN
xa/tests/adrm/02.ok
Normal file
BIN
xa/tests/adrm/02.ok
Normal file
Binary file not shown.
BIN
xa/tests/adrm/816.ok
Normal file
BIN
xa/tests/adrm/816.ok
Normal file
Binary file not shown.
20
xa/tests/adrm/Makefile
Normal file
20
xa/tests/adrm/Makefile
Normal file
@ -0,0 +1,20 @@
|
||||
default:
|
||||
# xa should not allow this to happen. if it does, this test is no good.
|
||||
../../xa 816.asm || exit 0 && exit 1
|
||||
../../xa zab.asm || exit 0 && exit 1
|
||||
../../xa zpa.asm || exit 0 && exit 1
|
||||
../../xa -C c02.asm || exit 0 && exit 1
|
||||
# expected-to-fail tests did fail. should be no more errors now.
|
||||
../../xa -C 02.asm -o 02.o
|
||||
../hextool -cmp=02.ok < 02.o
|
||||
../../xa c02.asm -o c02.o
|
||||
../hextool -cmp=c02.ok < c02.o
|
||||
../../xa -w 816.asm -o 816.o
|
||||
../hextool -cmp=816.ok < 816.o
|
||||
../../xa -w zab.asm -o zab.o
|
||||
../hextool -cmp=zab.ok < zab.o
|
||||
../../xa -w zpa.asm -o zpa.o
|
||||
../hextool -cmp=zpa.ok < zpa.o
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
BIN
xa/tests/adrm/c02.ok
Normal file
BIN
xa/tests/adrm/c02.ok
Normal file
Binary file not shown.
BIN
xa/tests/adrm/zab.ok
Normal file
BIN
xa/tests/adrm/zab.ok
Normal file
Binary file not shown.
BIN
xa/tests/adrm/zpa.ok
Normal file
BIN
xa/tests/adrm/zpa.ok
Normal file
Binary file not shown.
12
xa/tests/binclude/Makefile
Normal file
12
xa/tests/binclude/Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
default:
|
||||
../../xa test.asm -o test.o
|
||||
../hextool -cmp=test.ok < test.o
|
||||
../../xa -w test.asm -o test816.o
|
||||
../hextool -cmp=test.ok < test816.o
|
||||
../../xa test2.asm -o test2.o
|
||||
../hextool -cmp=test2.ok < test2.o
|
||||
../../xa test3.asm -o test3.o
|
||||
../hextool -cmp=test.ok < test3.o
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
117
xa/tests/binclude/sd/README.2nd
Normal file
117
xa/tests/binclude/sd/README.2nd
Normal file
@ -0,0 +1,117 @@
|
||||
This is the readme for xa, a cross-assembler for the 6502 and 65816 CPUs (and
|
||||
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.3, which implements several compatibility
|
||||
improvements on 2.3.2, a bug fix to the 2.3.0 version.
|
||||
|
||||
2.3.0 itself features many 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.
|
||||
|
||||
To install on a generic Unixy thing, you should be able to just type
|
||||
|
||||
% make # to build the executable, and if it works ...
|
||||
% make install # to install man pages and binaries into the system
|
||||
|
||||
This will create xa along with its various support utilities. Try assembling
|
||||
the cpk depacker in examples/ as a test. xa also comes with uncpk (a program
|
||||
for generating cpk archives) and printcbm (a program for listing Commodore
|
||||
BASIC test) and file65, ldo65 and reloc65 for displaying, linking and
|
||||
relocating o65 files in Andre's relocatable format (see doc/fileformats.txt).
|
||||
The loader/ directory also has goodies for managing relocatable binaries.
|
||||
|
||||
Don't forget the man pages in man/. Install these into your MANPATH at your
|
||||
leisure, or read them with nroff -man (and/or groff -man).
|
||||
|
||||
xa is no longer broadly supported outside of Unix due to my inability to test
|
||||
it, but has nothing that should impair it from compiling elsewhere. To wit,
|
||||
DOS compilation is still supported with the GO32 package. You should just be
|
||||
able to type
|
||||
|
||||
C:\> make dos
|
||||
|
||||
In addition, there are compatibility updates to allow it to compile under
|
||||
Microsoft Visual Studio and mingw. It should compile under VS2005 as written;
|
||||
look in the vstudio directory for solution and project files provided by
|
||||
Fabian Nunez. For mingw, use
|
||||
|
||||
make mingw
|
||||
|
||||
Similarly, Amiga and Atari ST compilation should still also function with
|
||||
their particular compatible packages.
|
||||
|
||||
xa has a companion disassembler, the dxa package. dxa is not included in the
|
||||
standard xa distribution, but can be downloaded from the xa home page at
|
||||
|
||||
http://www.floodgap.com/retrotech/xa/
|
||||
|
||||
Please check by periodically for the latest version of both packages.
|
||||
|
||||
xa was originally written and maintained by Andre Fachat. The current version
|
||||
is maintained by Cameron Kaiser.
|
||||
|
||||
Please send me your comments at ckaiser@floodgap.com -- Andre's original
|
||||
readme follows and applies generally to the present version.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
XA is a 6502 cross compiler:
|
||||
|
||||
- under GNU public license
|
||||
|
||||
- can produce _relocatable_ binaries
|
||||
|
||||
- The full fileformat description and 6502 file loader included.
|
||||
|
||||
- also included relocation and info utilites, as well as linker
|
||||
|
||||
- for any ANSI-C compliant computer (only utilities need 'stat' call
|
||||
for file size).
|
||||
|
||||
- fast by hashtables
|
||||
|
||||
- Rockwell CMOS opcodes
|
||||
|
||||
- running under DOS and any ANSI C system (Unix, Amiga, Atari ST)
|
||||
|
||||
I developed this cross assembler for the 6502 CPU family quite some time
|
||||
ago on my Atari ST. The assembler has successfully been ported to Amiga
|
||||
and Unix computer (ported? just compiled... :-)
|
||||
Lately I came across the problem to need relocatable 6502 binary files, so
|
||||
I revised the assembler from version 2.0.7 to 2.1.0, adding a (admittedly
|
||||
proprietary) 6502 relocatable binary format. But there are not many other
|
||||
formats around and they didn't fit my needs. I have developed this format
|
||||
myself and it is under the GNU public license.
|
||||
With version 2.1.1 the 'official' version of the fileformat is supported.
|
||||
|
||||
To compile it, just type "make" (if you have the GNU gcc. If not, edit the
|
||||
Makefile for the compiler options). This produces "xa", the cross assembler;
|
||||
"uncpk", a small packing utility (where the C64 counterpart is in the
|
||||
examples subdirectory), "printcbm", that lists C64 BASIC files and
|
||||
'file65' that prints some information about o65 files. The "loader" in
|
||||
the loader subdirectory is a basic 6502 implementation of a relocating
|
||||
binary loader.
|
||||
"file65" prints file information on 'o65' relocatable files. "reloc65"
|
||||
can relocate 'o65' files.
|
||||
|
||||
If you want to use it under DOS, you have to have the GO32 DOS crosscompiling
|
||||
tools to compile. Then just type "make dos" and you'll end up with the
|
||||
appropriate DOS binaries. This has been tested only under i386 Linux, however.
|
||||
Another archive with the DOS binaries included is provided.
|
||||
|
||||
One problem on the Atari was it's broken "malloc". Therefore I used to
|
||||
alloc everything in one chunk and divide the memory by hand. So everything
|
||||
was kind of statically allocated. This is almost gone now. Only the
|
||||
temporary storage between pass1 and pass2 and the preprocessor are still
|
||||
allocated in one chunk (size definitions in xah.h). The rest is allocated
|
||||
as needed.
|
||||
|
||||
The docs are in the 'doc' subdir. There also is a description of the
|
||||
6502 relocatable binary format. If you think some things could be
|
||||
expressed in a better way, feel free and mail me to improve my english ;-)
|
||||
[ The documentation is now maintained in man(1) format in man/ . -- CK ]
|
||||
|
||||
Andre
|
||||
|
BIN
xa/tests/binclude/test.ok
Normal file
BIN
xa/tests/binclude/test.ok
Normal file
Binary file not shown.
BIN
xa/tests/binclude/test2.ok
Normal file
BIN
xa/tests/binclude/test2.ok
Normal file
Binary file not shown.
21
xa/tests/binclude/test3.asm
Normal file
21
xa/tests/binclude/test3.asm
Normal file
@ -0,0 +1,21 @@
|
||||
/* This should be the same as test.ok */
|
||||
|
||||
.word $9000
|
||||
* = $9000
|
||||
|
||||
w = 10
|
||||
|
||||
glorb
|
||||
|
||||
.dsb 9,10 ; +9
|
||||
.byt 6, 6, 6, "devil", 'Q' ; +9 => 18
|
||||
.bin 0,5,'sd/README.2nd' ; +5 => 23
|
||||
.bin w,w+256,'sd/README.2nd' ; +266 => 289 ($0121)
|
||||
|
||||
gleeb
|
||||
; $0123
|
||||
jmp glorb
|
||||
; should be $9121 (remember the SA)
|
||||
jmp gleeb
|
||||
bne *
|
||||
|
1
xa/tests/chardelimiter/ok
Normal file
1
xa/tests/chardelimiter/ok
Normal file
@ -0,0 +1 @@
|
||||
©A©A1234512345"''"
|
16
xa/tests/chardelimiter/test.s
Normal file
16
xa/tests/chardelimiter/test.s
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
*=$033c
|
||||
|
||||
lda #"A"
|
||||
lda #'A'
|
||||
|
||||
.asc "12345"
|
||||
.asc '12345'
|
||||
|
||||
.asc "^"" ; ^ is escape character
|
||||
.asc '^''
|
||||
.asc "'"
|
||||
.asc '"'
|
||||
|
||||
.asc "^n"
|
||||
|
12
xa/tests/charset/Makefile
Normal file
12
xa/tests/charset/Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
default:
|
||||
../../xa test.s
|
||||
../hextool -cmp=no-charset.o < a.o65
|
||||
../../xa -O PETSCII test.s
|
||||
../hextool -cmp=petscii.o < a.o65
|
||||
../../xa -O PETSCREEN test.s
|
||||
../hextool -cmp=petscreen.o < a.o65
|
||||
../../xa -O HIGH test.s
|
||||
../hextool -cmp=high.o < a.o65
|
||||
|
||||
clean:
|
||||
rm -rf a.o65
|
BIN
xa/tests/charset/high.o
Normal file
BIN
xa/tests/charset/high.o
Normal file
Binary file not shown.
BIN
xa/tests/charset/no-charset.o
Normal file
BIN
xa/tests/charset/no-charset.o
Normal file
Binary file not shown.
BIN
xa/tests/charset/petscii.o
Normal file
BIN
xa/tests/charset/petscii.o
Normal file
Binary file not shown.
BIN
xa/tests/charset/petscreen.o
Normal file
BIN
xa/tests/charset/petscreen.o
Normal file
Binary file not shown.
16
xa/tests/charset/test.s
Normal file
16
xa/tests/charset/test.s
Normal file
@ -0,0 +1,16 @@
|
||||
.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"
|
6
xa/tests/chppch/Makefile
Normal file
6
xa/tests/chppch/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
default:
|
||||
../../xa -p'~' -e test.out test.c
|
||||
../hextool -cmp=ok.out < test.out
|
||||
|
||||
clean:
|
||||
rm -f a.o65 test.out
|
5
xa/tests/chppch/ok.out
Normal file
5
xa/tests/chppch/ok.out
Normal file
@ -0,0 +1,5 @@
|
||||
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
|
14
xa/tests/comcom/Makefile
Normal file
14
xa/tests/comcom/Makefile
Normal file
@ -0,0 +1,14 @@
|
||||
default:
|
||||
# this should fail.
|
||||
../../xa scomcom.asm || exit 0 && exit 1
|
||||
# it did fail. these should now all succeed.
|
||||
../../xa -M scomcom.asm
|
||||
../hextool -cmp=scomcomm.ok < a.o65
|
||||
../../xa comcom.asm
|
||||
../hextool -cmp=comcom.ok < a.o65
|
||||
../../xa -M comcom.asm
|
||||
../hextool -cmp=comcomm.ok < a.o65
|
||||
|
||||
clean:
|
||||
rm -f a.o65
|
||||
|
BIN
xa/tests/comcom/comcom.ok
Normal file
BIN
xa/tests/comcom/comcom.ok
Normal file
Binary file not shown.
BIN
xa/tests/comcom/comcomm.ok
Normal file
BIN
xa/tests/comcom/comcomm.ok
Normal file
Binary file not shown.
1
xa/tests/comcom/scomcomm.ok
Normal file
1
xa/tests/comcom/scomcomm.ok
Normal file
@ -0,0 +1 @@
|
||||
<EFBFBD><01>
|
@ -1,3 +1,7 @@
|
||||
default:
|
||||
cc -E over.c > over.asm
|
||||
../../xa over.asm
|
||||
$(CC) -E over.c > over.asm
|
||||
../../xa -w over.asm
|
||||
../hextool -cmp=expected.o < a.o65
|
||||
|
||||
clean:
|
||||
rm -f over.asm a.o65
|
||||
|
BIN
xa/tests/cpp/expected.o
Normal file
BIN
xa/tests/cpp/expected.o
Normal file
Binary file not shown.
@ -10,6 +10,8 @@
|
||||
|
||||
/* This has a .c extension for those cc -E's that won't deal with .asm */
|
||||
|
||||
* = $0000
|
||||
|
||||
lda #AA
|
||||
jmp buggy
|
||||
rts
|
||||
@ -17,3 +19,5 @@
|
||||
#include "over.h"
|
||||
|
||||
/* the buggy will force a line number to be printed */
|
||||
|
||||
buggy
|
||||
|
14
xa/tests/fordef/Makefile
Normal file
14
xa/tests/fordef/Makefile
Normal file
@ -0,0 +1,14 @@
|
||||
default:
|
||||
# this must not pass.
|
||||
../../xa -DFAIL test3.asm || exit 0 && exit 1
|
||||
# these must pass.
|
||||
../../xa test3.asm
|
||||
../hextool -cmp=test3.ok < a.o65
|
||||
# testing warnings.
|
||||
../../xa -e test.out test.asm
|
||||
../hextool -cmp=ok.out < test.out
|
||||
../hextool -cmp=test1.ok < a.o65
|
||||
|
||||
clean:
|
||||
rm -f a.o65 test.out
|
||||
|
4
xa/tests/fordef/ok.out
Normal file
4
xa/tests/fordef/ok.out
Normal file
@ -0,0 +1,4 @@
|
||||
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
|
BIN
xa/tests/fordef/test1.ok
Normal file
BIN
xa/tests/fordef/test1.ok
Normal file
Binary file not shown.
BIN
xa/tests/fordef/test3.ok
Normal file
BIN
xa/tests/fordef/test3.ok
Normal file
Binary file not shown.
67
xa/tests/harness
Executable file
67
xa/tests/harness
Executable file
@ -0,0 +1,67 @@
|
||||
#!/usr/bin/perl -s
|
||||
|
||||
$make ||= "make";
|
||||
$cc ||= "cc";
|
||||
$cflags ||= '';
|
||||
$ENV{'MAKE'} = $make;
|
||||
$ENV{'CC'} = $cc;
|
||||
$ENV{'CFLAGS'} = $cflags;
|
||||
$|++;
|
||||
|
||||
$dtests = $tests || "ALL";
|
||||
|
||||
print <<"EOF";
|
||||
CC = $cc
|
||||
CFLAGS = $cflags
|
||||
MAKE = $make
|
||||
tests to run: $dtests
|
||||
|
||||
EOF
|
||||
|
||||
# Get a list of all directories. If there is a Makefile there, do it.
|
||||
# If there is not, see if there is an .s file and an ok binary to cmp to.
|
||||
# Otherwise, do nothing (acknowledge and ignore directories we don't grok).
|
||||
|
||||
opendir(D, ".") || die("test harness failed: $!\n");
|
||||
W: while($x = readdir(D)) {
|
||||
next W if ($x =~ /^\./);
|
||||
next W if (length($tests) && ($tests !~ /$x/));
|
||||
next W if (!chdir($x));
|
||||
$x = substr($x . " " . ("." x 79), 0, 50);
|
||||
print STDOUT "$x > ";
|
||||
|
||||
if (-e "Makefile") {
|
||||
print STDOUT "running Makefile\n";
|
||||
print STDOUT "=" x 79, "\n";
|
||||
system("$make clean");
|
||||
print STDOUT "-" x 79, "\n";
|
||||
system("$make");
|
||||
print STDOUT "-" x 79, "\n";
|
||||
if ($?) {
|
||||
print STDOUT "## FAILURE (make clean NOT run) ##\n";
|
||||
exit 1;
|
||||
}
|
||||
system("$make clean");
|
||||
print STDOUT "=" x 35, " PASSED! ", "=" x 35, "\n";
|
||||
} elsif (-e "ok" && -e "test.s") {
|
||||
unlink("a.o65");
|
||||
&failed("../../xa test.s");
|
||||
&failed("../hextool -cmp=ok < a.o65");
|
||||
unlink("a.o65");
|
||||
print STDOUT "PASSED\n";
|
||||
} else {
|
||||
print STDOUT "ignored\n";
|
||||
}
|
||||
chdir("..");
|
||||
}
|
||||
closedir(D);
|
||||
print STDOUT "\n## ALL TESTS PASS ##\n";
|
||||
exit 0;
|
||||
|
||||
sub failed {
|
||||
system(@_);
|
||||
if ($?) {
|
||||
print STDOUT "## FAILURE ##\n";
|
||||
exit 1;
|
||||
}
|
||||
}
|
57
xa/tests/hextool
Executable file
57
xa/tests/hextool
Executable file
@ -0,0 +1,57 @@
|
||||
#!/usr/bin/perl -s
|
||||
|
||||
# This tool either emits hex in a machine or human parseable format, or
|
||||
# compares two binaries in the form of cmp. It is mostly to deal with
|
||||
# systems with an unreliable hexdump, that *lack* hexdump (or od), and/or
|
||||
# emit non-standard output.
|
||||
|
||||
# "use bytes"
|
||||
BEGIN { $^H |= 0x00000008 unless ($] < 5.006); }
|
||||
|
||||
|
||||
if ($output || $noutput) {
|
||||
# check output mode. If $output, there must be output. If there is
|
||||
# $noutput there must NOT be output. Feed tee or something to this.
|
||||
$wasoutput = 0;
|
||||
while(<>) {
|
||||
$wasoutput++;
|
||||
}
|
||||
exit (($wasoutput && $output) ? 0 :
|
||||
($wasoutput && $noutput) ? 1 :
|
||||
(!$wasoutput && !$noutput) ? 0 :
|
||||
1);
|
||||
}
|
||||
|
||||
if ($cmp) {
|
||||
# compare mode. both files must fit in memory. to eliminate any
|
||||
# weirdness about endianness, encoding, etc., we unpack them to
|
||||
# hex bytes and just compare strings.
|
||||
undef $/;
|
||||
open(W, "$cmp") || die("can't open $cmp: $!\n");
|
||||
$cmp = unpack("H*", <W>);
|
||||
close(W);
|
||||
$std = unpack("H*", <>);
|
||||
if ($cmp ne $std) {
|
||||
print <<"EOF";
|
||||
FAILED!
|
||||
|
||||
received from stdin
|
||||
-------------------
|
||||
$std
|
||||
|
||||
expected to equal
|
||||
-----------------
|
||||
$cmp
|
||||
|
||||
FAILED!
|
||||
EOF
|
||||
exit 255;
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
# hexdump mode. accept data on stdin, spew a stream of hex bytes.
|
||||
|
||||
while(<>) {
|
||||
print STDOUT unpack("H*", $_);
|
||||
}
|
8
xa/tests/incerr/Makefile
Normal file
8
xa/tests/incerr/Makefile
Normal file
@ -0,0 +1,8 @@
|
||||
default:
|
||||
# in 6502 mode, it will fail.
|
||||
../../xa test.s || exit 0 && exit 1
|
||||
# in 65816 mode, it will pass.
|
||||
../../xa -w test.s
|
||||
|
||||
clean:
|
||||
rm -f a.o65
|
@ -1,22 +1,23 @@
|
||||
|
||||
default: all
|
||||
all: t
|
||||
|
||||
1.o65: 1.s
|
||||
xa -R -c -o 1.o65 1.s
|
||||
hexdump -C 1.o65 > 1.o65.hex
|
||||
../../xa -R -c -o 1.o65 1.s
|
||||
../hextool 1.o65 > 1.o65.hex
|
||||
|
||||
2.o65: 2.s
|
||||
xa -R -c -o 2.o65 2.s
|
||||
hexdump -C 2.o65 > 2.o65.hex
|
||||
../../xa -R -c -o 2.o65 2.s
|
||||
../hextool 2.o65 > 2.o65.hex
|
||||
|
||||
linked.o65: 1.o65 2.o65
|
||||
ldo65 -o linked.o65 1.o65 2.o65
|
||||
hexdump -C linked.o65 > linked.o65.hex
|
||||
../../ldo65 -o linked.o65 1.o65 2.o65
|
||||
../hextool linked.o65 > linked.o65.hex
|
||||
|
||||
t: linked.o65
|
||||
reloc65 -bt 32768 -xt -o t linked.o65
|
||||
hexdump -C t > t.hex
|
||||
diff t t.ok
|
||||
../../reloc65 -bt 32768 -xt -o t linked.o65
|
||||
../hextool t > t.hex
|
||||
../hextool -cmp=t < t.ok
|
||||
|
||||
clean:
|
||||
rm -f *.o65 *.hex t
|
||||
|
BIN
xa/tests/nonl/ok
Normal file
BIN
xa/tests/nonl/ok
Normal file
Binary file not shown.
3
xa/tests/nonl/test.s
Normal file
3
xa/tests/nonl/test.s
Normal file
@ -0,0 +1,3 @@
|
||||
lda #4
|
||||
sta !$0005
|
||||
rts
|
12
xa/tests/recmac/Makefile
Normal file
12
xa/tests/recmac/Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
default:
|
||||
# this should fail.
|
||||
../../xa -DFAIL test.asm || exit 0 && exit 1
|
||||
# these should not fail.
|
||||
../../xa test.asm
|
||||
../hextool -cmp=test.ok < a.o65
|
||||
../../xa testi.asm
|
||||
../hextool -cmp=testi.ok < a.o65
|
||||
|
||||
clean:
|
||||
rm -f a.o65
|
||||
|
@ -26,6 +26,6 @@ start
|
||||
|
||||
/* this should bug out */
|
||||
|
||||
/*
|
||||
#ifdef FAIL
|
||||
POKE(NOGOOD, 7)
|
||||
*/
|
||||
#endif
|
||||
|
1
xa/tests/recmac/test.ok
Normal file
1
xa/tests/recmac/test.ok
Normal file
@ -0,0 +1 @@
|
||||
<EFBFBD><02><01><01><02><02><01><02><01><01><02><02>^<5E><05><03><>`
|
1
xa/tests/recmac/testi.ok
Normal file
1
xa/tests/recmac/testi.ok
Normal file
@ -0,0 +1 @@
|
||||
B<EFBFBD>
|
@ -1,23 +1,28 @@
|
||||
|
||||
all: a.o65 b.o65
|
||||
default: all
|
||||
all: a.o65 b.o65 compare
|
||||
|
||||
a.o65: test1.o65
|
||||
echo "********* This should give a warning about an undefined relocation table entry"
|
||||
reloc65 -X test1.o65
|
||||
hexdump -C a.o65 > a.o65.hex
|
||||
@echo "********* This should give a warning about an undefined relocation table entry"
|
||||
../../reloc65 -X test1.o65
|
||||
../hextool a.o65 > a.o65.hex
|
||||
|
||||
b.o65: test2.o65
|
||||
echo "********* This should NOT give a warning"
|
||||
reloc65 -X -o b.o65 test2.o65
|
||||
hexdump -C b.o65 > b.o65.hex
|
||||
@echo "********* This should NOT give a warning"
|
||||
../../reloc65 -X -o b.o65 test2.o65
|
||||
../hextool b.o65 > b.o65.hex
|
||||
|
||||
test1.o65: test1.a65
|
||||
xa -R -Lundefl -Ll2 -o test1.o65 test1.a65
|
||||
hexdump -C test1.o65 > test1.o65.hex
|
||||
../../xa -R -Lundefl -Ll2 -o test1.o65 test1.a65
|
||||
../hextool test1.o65 > test1.o65.hex
|
||||
|
||||
test2.o65: test2.a65
|
||||
xa -R -o test2.o65 test2.a65
|
||||
hexdump -C test2.o65 > test2.o65.hex
|
||||
../../xa -R -o test2.o65 test2.a65
|
||||
../hextool test2.o65 > test2.o65.hex
|
||||
|
||||
compare:
|
||||
../hextool -cmp=a.ok < a.o65
|
||||
../hextool -cmp=b.ok < b.o65
|
||||
|
||||
clean:
|
||||
rm -f test1.o65 a.o65 test1.o65.hex a.o65.hex
|
||||
|
BIN
xa/tests/relocundef/a.ok
Normal file
BIN
xa/tests/relocundef/a.ok
Normal file
Binary file not shown.
BIN
xa/tests/relocundef/b.ok
Normal file
BIN
xa/tests/relocundef/b.ok
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user