mirror of
https://github.com/fachat/xa65.git
synced 2025-04-08 18:37:12 +00:00
2.4.0b2
This commit is contained in:
parent
f46f0a95a6
commit
e6916f997b
302
xa-2.4.0+relmode.diff
Normal file
302
xa-2.4.0+relmode.diff
Normal file
@ -0,0 +1,302 @@
|
||||
diff --git a/xa/misc/file65.c b/xa/misc/file65.c
|
||||
index cec2d98..f9fe753 100644
|
||||
--- a/xa/misc/file65.c
|
||||
+++ b/xa/misc/file65.c
|
||||
@@ -48,6 +48,8 @@ int rompar = 0;
|
||||
int romoff = 0;
|
||||
int labels = 0;
|
||||
|
||||
+int verbose = 0;
|
||||
+
|
||||
void usage(FILE *fp)
|
||||
{
|
||||
fprintf(fp,
|
||||
@@ -62,13 +64,14 @@ void usage(FILE *fp)
|
||||
" in the same ROM. Add offset to start address.\n"
|
||||
" -A offset same as `-a', but only print the start address of the next\n"
|
||||
" file in the ROM\n"
|
||||
- " -V print undefined and global labels\n"
|
||||
+ " -v print undefined and global labels\n"
|
||||
+ " -vv print undefined and global labels, and relocation tables\n"
|
||||
" --version output version information and exit\n"
|
||||
" --help display this help and exit\n");
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
- int i = 1, n, mode, hlen;
|
||||
+ int i, j, n, mode, hlen;
|
||||
FILE *fp;
|
||||
char *aligntxt[4]= {"[align 1]","[align 2]","[align 4]","[align 256]"};
|
||||
if(argc<=1) {
|
||||
@@ -76,12 +79,14 @@ int main(int argc, char *argv[]) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
- if (strstr(argv[1], "--help")) {
|
||||
+ i = 1;
|
||||
+
|
||||
+ if (strstr(argv[i], "--help")) {
|
||||
usage(stdout);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
- if (strstr(argv[1], "--version")) {
|
||||
+ if (strstr(argv[i], "--version")) {
|
||||
version(programname, progversion, author, copyright);
|
||||
exit(0);
|
||||
}
|
||||
@@ -90,11 +95,12 @@ int main(int argc, char *argv[]) {
|
||||
if(argv[i][0]=='-') {
|
||||
/* process options */
|
||||
switch(argv[i][1]) {
|
||||
- case 'V':
|
||||
- labels = 1;
|
||||
- break;
|
||||
case 'v':
|
||||
- printf("file65: Version 0.2\n");
|
||||
+ j = 1;
|
||||
+ while (argv[i][j] == 'v') {
|
||||
+ verbose ++;
|
||||
+ j++;
|
||||
+ }
|
||||
break;
|
||||
case 'a':
|
||||
case 'A':
|
||||
@@ -142,7 +148,7 @@ int main(int argc, char *argv[]) {
|
||||
printf(" zero segment @ $%04x - $%04x [$%04x bytes]\n", hdr[21]*256+hdr[20], hdr[21]*256+hdr[20]+hdr[23]*256+hdr[22], hdr[23]*256+hdr[22]);
|
||||
printf(" stack size $%04x bytes %s\n", hdr[25]*256+hdr[24],
|
||||
(hdr[25]*256+hdr[24])==0?"(i.e. unknown)":"");
|
||||
- if(labels) {
|
||||
+ if(verbose) {
|
||||
read_options(fp);
|
||||
print_labels(fp, hdr[11]*256+hdr[10] + hdr[15]*256+hdr[14]);
|
||||
}
|
||||
@@ -231,13 +237,13 @@ void print_option(unsigned char *buf, int len) {
|
||||
}
|
||||
|
||||
int read_options(FILE *fp) {
|
||||
- int c, l=0;
|
||||
+ int c, d, l=0;
|
||||
unsigned char tb[256];
|
||||
|
||||
c=fgetc(fp); l++;
|
||||
while(c && c!=EOF) {
|
||||
c&=255;
|
||||
- fread(tb, 1, c-1, fp);
|
||||
+ d = fread(tb, 1, c-1, fp);
|
||||
if(labels) print_option(tb, c);
|
||||
l+=c;
|
||||
c=fgetc(fp);
|
||||
@@ -247,11 +253,17 @@ int read_options(FILE *fp) {
|
||||
|
||||
int print_labels(FILE *fp, int offset) {
|
||||
int i, nud, c, seg, off;
|
||||
+ const char *segments[] = { "undef", "abs", "text", "data", "bss", "zero" };
|
||||
+ const char *reltype[] = { "-", "LOW", "HIGH", "-", "WORD", "SEG", "SEGADDR" };
|
||||
+
|
||||
/*
|
||||
printf("print_labels:offset=%d\n",offset);
|
||||
*/
|
||||
fseek(fp, offset, SEEK_CUR);
|
||||
|
||||
+ // -----------------------------------------------------------
|
||||
+ // print undefined labels
|
||||
+
|
||||
nud = (fgetc(fp) & 0xff);
|
||||
nud += ((fgetc(fp) << 8) & 0xff00);
|
||||
|
||||
@@ -269,25 +281,59 @@ printf("print_labels:offset=%d\n",offset);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
+ // ---------------------------------------------------------
|
||||
+ // skip relocation tables
|
||||
+
|
||||
+ // two tables, one for text one for data
|
||||
for(i=0;i<2;i++) {
|
||||
+ unsigned char lowbyte;
|
||||
+ unsigned short index;
|
||||
+ unsigned short offset = 0;
|
||||
+
|
||||
+ if (verbose > 1) {
|
||||
+ printf("Relocation table for %s:\n", i ? "text":"data");
|
||||
+ }
|
||||
+
|
||||
c=fgetc(fp);
|
||||
while(c && c!=EOF) {
|
||||
c&= 0xff;
|
||||
while(c == 255 && c!= EOF) {
|
||||
+ offset += 254;
|
||||
c=fgetc(fp);
|
||||
if(c==EOF) break;
|
||||
c&= 0xff;
|
||||
}
|
||||
if(c==EOF) break;
|
||||
+ offset += c;
|
||||
|
||||
c=fgetc(fp);
|
||||
- if( (c & 0xe0) == 0x40 ) fgetc(fp);
|
||||
- if( (c & 0x07) == 0 ) { fgetc(fp); fgetc(fp); }
|
||||
-
|
||||
+ if( (c & 0xe0) == 0x40 ) {
|
||||
+ lowbyte = fgetc(fp);
|
||||
+ }
|
||||
+ if( (c & 0x07) == 0 ) {
|
||||
+ index = fgetc(fp) & 0xff;
|
||||
+ index += (fgetc(fp) & 0xff) << 8;
|
||||
+ }
|
||||
+ if (verbose > 1) {
|
||||
+ printf("\t%d:%s(%s (%d)", offset, reltype[ (c>>5) & 0xf], segments[c & 0x07], (c&0x07));
|
||||
+ if ( (c & 0xe0) == 0x40) {
|
||||
+ printf(", %02x", lowbyte);
|
||||
+ }
|
||||
+ if ( (c & 0x07) == 0) {
|
||||
+ printf(", %04x", index);
|
||||
+ }
|
||||
+ printf(")");
|
||||
+ }
|
||||
c=fgetc(fp);
|
||||
}
|
||||
+ if (verbose > 1) {
|
||||
+ printf("\n");
|
||||
+ }
|
||||
}
|
||||
|
||||
+
|
||||
+ // ---------------------------------------------------------
|
||||
+ // print global labels
|
||||
nud = (fgetc(fp) & 0xff);
|
||||
nud += ((fgetc(fp) << 8) & 0xff00);
|
||||
printf("Global Labels: %d\n", nud);
|
||||
diff --git a/xa/src/xat.c b/xa/src/xat.c
|
||||
index 52671ea..c44809d 100644
|
||||
--- a/xa/src/xat.c
|
||||
+++ b/xa/src/xat.c
|
||||
@@ -632,45 +632,45 @@ printf("reloc: er=%d, l=%d, segment=%d, pc[%d]=%04x, pc[abs(%d)]=%04x, pc[text(%
|
||||
dsb_len = 0;
|
||||
} else
|
||||
if(n==Ktext) {
|
||||
+ r_mode(RMODE_RELOC); // use of segments restores previous segment / reloc mode
|
||||
segment = relmode ? SEG_TEXT : SEG_ABS;
|
||||
t[0]=Ksegment;
|
||||
t[1]=segment;
|
||||
*ll=2;
|
||||
er=E_OKDEF;
|
||||
- r_mode(RMODE_RELOC); // use of segments always switches of ABS reloc mode
|
||||
} else
|
||||
if(n==Kdata) {
|
||||
if(relmode) {
|
||||
+ r_mode(RMODE_RELOC); // use of segments restores previous segment / reloc mode
|
||||
segment = SEG_DATA;
|
||||
t[0]=Ksegment;
|
||||
t[1]=SEG_DATA;
|
||||
*ll=2;
|
||||
er=E_OKDEF;
|
||||
- r_mode(RMODE_RELOC); // use of segments always switches of ABS reloc mode
|
||||
} else {
|
||||
er=E_ILLSEGMENT;
|
||||
}
|
||||
} else
|
||||
if(n==Kbss) {
|
||||
if(relmode) {
|
||||
+ r_mode(RMODE_RELOC); // use of segments restores previous segment / reloc mode
|
||||
segment = SEG_BSS;
|
||||
t[0]=Ksegment;
|
||||
t[1]=SEG_BSS;
|
||||
*ll=2;
|
||||
er=E_OKDEF;
|
||||
- r_mode(RMODE_RELOC); // use of segments always switches of ABS reloc mode
|
||||
} else {
|
||||
er=E_ILLSEGMENT;
|
||||
}
|
||||
} else
|
||||
if(n==Kzero) {
|
||||
if(relmode) {
|
||||
+ r_mode(RMODE_RELOC); // use of segments restores previous segment / reloc mode
|
||||
segment = SEG_ZERO;
|
||||
t[0]=Ksegment;
|
||||
t[1]=SEG_ZERO;
|
||||
*ll=2;
|
||||
er=E_OKDEF;
|
||||
- r_mode(RMODE_RELOC); // use of segments always switches of ABS reloc mode
|
||||
} else {
|
||||
er=E_ILLSEGMENT;
|
||||
}
|
||||
diff --git a/xa/tests/csapiec/testseg.ok b/xa/tests/csapiec/testseg.ok
|
||||
index 254ccb1..6a377b3 100644
|
||||
Binary files a/xa/tests/csapiec/testseg.ok and b/xa/tests/csapiec/testseg.ok differ
|
||||
diff --git a/xa/tests/relmode/Makefile b/xa/tests/relmode/Makefile
|
||||
index 350a7a7..68d64ba 100644
|
||||
--- a/xa/tests/relmode/Makefile
|
||||
+++ b/xa/tests/relmode/Makefile
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
XA=../../xa
|
||||
|
||||
-tests: mixabs1 mixabs2
|
||||
+tests: mixabs1 mixabs2 mix1 mix2 clean
|
||||
|
||||
|
||||
mixabs1: mixabsolute.a65
|
||||
@@ -17,6 +17,18 @@ mixabs2: mixabsolute.a65
|
||||
../../reloc65 -bt 40960 -o $@ $@.tmp
|
||||
../hextool -cmp=b.ok < $@
|
||||
|
||||
+mix1: mix1.a65
|
||||
+ ${XA} -R -o $@.o65 $<
|
||||
+ file65 -V $@.o65
|
||||
+ reloc65 -X -o $@ $@.o65
|
||||
+ ../hextool -cmp=$@.ok < $@.o65
|
||||
+
|
||||
+mix2: mix2.a65
|
||||
+ ${XA} -R -o $@.o65 $<
|
||||
+ file65 -V $@.o65
|
||||
+ reloc65 -X -o $@ $@.o65
|
||||
+ ../hextool -cmp=$@.ok < $@.o65
|
||||
+
|
||||
clean:
|
||||
- rm -f a.err a.o65 a.hex b.o65 mixabs2*
|
||||
+ rm -f a.err *.o65 a.hex mixabs2* mix1 mix2
|
||||
|
||||
diff --git a/xa/tests/relmode/mix1.a65 b/xa/tests/relmode/mix1.a65
|
||||
new file mode 100644
|
||||
index 0000000..10b0762
|
||||
--- /dev/null
|
||||
+++ b/xa/tests/relmode/mix1.a65
|
||||
@@ -0,0 +1,11 @@
|
||||
+
|
||||
+ .text
|
||||
+
|
||||
+ .word $0401
|
||||
+ *=$0401
|
||||
+ *=
|
||||
+
|
||||
+ .data
|
||||
+NextPacketPtr: .byte 0,0 ; word
|
||||
+
|
||||
+
|
||||
diff --git a/xa/tests/relmode/mix1.ok b/xa/tests/relmode/mix1.ok
|
||||
new file mode 100644
|
||||
index 0000000..f86cb21
|
||||
Binary files /dev/null and b/xa/tests/relmode/mix1.ok differ
|
||||
diff --git a/xa/tests/relmode/mix2.a65 b/xa/tests/relmode/mix2.a65
|
||||
new file mode 100644
|
||||
index 0000000..4cfc3e2
|
||||
--- /dev/null
|
||||
+++ b/xa/tests/relmode/mix2.a65
|
||||
@@ -0,0 +1,11 @@
|
||||
+
|
||||
+ .text
|
||||
+
|
||||
+ .word $0401
|
||||
+ *=$0401
|
||||
+
|
||||
+
|
||||
+ .data
|
||||
+NextPacketPtr: .byte 0,0 ; word
|
||||
+
|
||||
+
|
||||
diff --git a/xa/tests/relmode/mix2.ok b/xa/tests/relmode/mix2.ok
|
||||
new file mode 100644
|
||||
index 0000000..f86cb21
|
||||
Binary files /dev/null and b/xa/tests/relmode/mix2.ok differ
|
@ -6,7 +6,7 @@ LD = gcc
|
||||
# for testing. not to be used; build failures in misc/.
|
||||
#CFLAGS = -O2 -W -Wall -pedantic -ansi
|
||||
#CFLAGS = -O2 -g
|
||||
CFLAGS = -g #-O2
|
||||
CFLAGS = -O2
|
||||
LDFLAGS = -lc
|
||||
|
||||
# for DOS?
|
||||
|
@ -263,7 +263,7 @@ printf("print_labels:offset=%d\n",offset);
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// print undefined labels
|
||||
|
||||
|
||||
nud = (fgetc(fp) & 0xff);
|
||||
nud += ((fgetc(fp) << 8) & 0xff00);
|
||||
|
||||
@ -310,15 +310,15 @@ printf("print_labels:offset=%d\n",offset);
|
||||
if( (c & 0xe0) == 0x40 ) {
|
||||
lowbyte = fgetc(fp);
|
||||
}
|
||||
if( (c & 0x07) == 0 ) {
|
||||
index = fgetc(fp) & 0xff;
|
||||
index += (fgetc(fp) & 0xff) << 8;
|
||||
if( (c & 0x07) == 0 ) {
|
||||
index = fgetc(fp) & 0xff;
|
||||
index += (fgetc(fp) & 0xff) << 8;
|
||||
}
|
||||
if (verbose > 1) {
|
||||
printf("\t%d:%s(%s (%d)", offset, reltype[ (c>>5) & 0xf], segments[c & 0x07], (c&0x07));
|
||||
if ( (c & 0xe0) == 0x40) {
|
||||
printf(", %02x", lowbyte);
|
||||
}
|
||||
}
|
||||
if ( (c & 0x07) == 0) {
|
||||
printf(", %04x", index);
|
||||
}
|
||||
|
@ -124,7 +124,6 @@ file65 file;
|
||||
unsigned char cmp[] = { 1, 0, 'o', '6', '5' };
|
||||
unsigned char hdr[26] = { 1, 0, 'o', '6', '5', 0 };
|
||||
|
||||
int verbose = 0;
|
||||
|
||||
void usage(FILE *fp)
|
||||
{
|
||||
@ -140,7 +139,6 @@ void usage(FILE *fp)
|
||||
" -U accept any undef'd labels after linking\n"
|
||||
" -L<name> accept specific given undef'd labels after linking\n"
|
||||
" -g<name> only export the globals defined with (multiple) -g options\n"
|
||||
" -v verbose output\n"
|
||||
" --version output version information and exit\n"
|
||||
" --help display this help and exit\n",
|
||||
programname);
|
||||
@ -163,12 +161,12 @@ int main(int argc, char *argv[]) {
|
||||
char **defined = NULL;
|
||||
int ndefined = 0;
|
||||
int ndefalloc = 0;
|
||||
|
||||
|
||||
// globals allowed by -g
|
||||
char **globdef = NULL;
|
||||
char **globdef = NULL;
|
||||
int nglobal = 0;
|
||||
int ngloballoc = 0;
|
||||
|
||||
|
||||
if (argc <= 1) {
|
||||
usage(stderr);
|
||||
exit(1);
|
||||
@ -188,13 +186,6 @@ int main(int argc, char *argv[]) {
|
||||
while(i<argc && argv[i][0]=='-') {
|
||||
/* process options */
|
||||
switch(argv[i][1]) {
|
||||
case 'v':
|
||||
j=1;
|
||||
while (argv[i][j]=='v') {
|
||||
verbose++;
|
||||
j++;
|
||||
}
|
||||
break;
|
||||
case 'G':
|
||||
noglob=1;
|
||||
break;
|
||||
@ -304,19 +295,6 @@ printf("tbase=%04x+len=%04x->%04x, file->tbase=%04x, f.tlen=%04x -> tdiff=%04x\n
|
||||
printf("zbase=%04x+len=%04x->%04x, file->zbase=%04x, f.zlen=%04x -> zdiff=%04x\n",
|
||||
zbase, tzlen, (zbase + tzlen), file->zbase, file->zlen, file->zdiff);
|
||||
*/
|
||||
|
||||
if (verbose > 0) {
|
||||
printf("Relocating file: %s\n", file->fname);
|
||||
printf(" text: from %04x to %04x (diff is %04x, length is %04x)\n",
|
||||
file->tbase, file->tbase + file->tdiff, file->tdiff, file->tlen);
|
||||
printf(" data: from %04x to %04x (diff is %04x, length is %04x)\n",
|
||||
file->dbase, file->dbase + file->ddiff, file->ddiff, file->dlen);
|
||||
printf(" bss: from %04x to %04x (diff is %04x, length is %04x)\n",
|
||||
file->bbase, file->bbase + file->bdiff, file->bdiff, file->blen);
|
||||
printf(" zero: from %02x to %02x (diff is %02x, length is %02x)\n",
|
||||
file->zbase, file->zbase + file->zdiff, file->zdiff, file->zlen);
|
||||
}
|
||||
|
||||
/* update globals (for result file) */
|
||||
ttlen += file->tlen;
|
||||
tdlen += file->dlen;
|
||||
@ -328,26 +306,26 @@ printf("zbase=%04x+len=%04x->%04x, file->zbase=%04x, f.zlen=%04x -> zdiff=%04x\n
|
||||
{
|
||||
int er = 0;
|
||||
if (tbase + ttlen > 0x10000) {
|
||||
fprintf(stderr,
|
||||
"Overflow in text segment: end at %06x behind 64k limit\n",
|
||||
fprintf(stderr,
|
||||
"Overflow in text segment: end at %06x behind 64k limit\n",
|
||||
tbase + ttlen);
|
||||
er = 1;
|
||||
}
|
||||
if (dbase + tdlen > 0x10000) {
|
||||
fprintf(stderr,
|
||||
"Overflow in data segment: end at %06x behind 64k limit\n",
|
||||
fprintf(stderr,
|
||||
"Overflow in data segment: end at %06x behind 64k limit\n",
|
||||
dbase + tdlen);
|
||||
er = 1;
|
||||
}
|
||||
if (bbase + tblen > 0x10000) {
|
||||
fprintf(stderr,
|
||||
"Overflow in bss segment: end at %06x behind 64k limit\n",
|
||||
fprintf(stderr,
|
||||
"Overflow in bss segment: end at %06x behind 64k limit\n",
|
||||
bbase + tblen);
|
||||
er = 1;
|
||||
}
|
||||
if (zbase + tzlen > 0x100) {
|
||||
fprintf(stderr,
|
||||
"Overflow in zero segment: end at %04x behind 256 byte limit\n",
|
||||
fprintf(stderr,
|
||||
"Overflow in zero segment: end at %04x behind 256 byte limit\n",
|
||||
zbase + tzlen);
|
||||
er = 1;
|
||||
}
|
||||
@ -699,21 +677,17 @@ int len_reloc_seg(unsigned char *buf, int ri) {
|
||||
|
||||
unsigned char *reloc_globals(unsigned char *buf, file65 *fp) {
|
||||
int n, old, new, seg;
|
||||
char *name;
|
||||
|
||||
n = buf[0] + 256*buf[1];
|
||||
buf +=2;
|
||||
|
||||
while(n) {
|
||||
name = buf;
|
||||
/*printf("relocating %s, ", buf);*/
|
||||
while(*(buf++));
|
||||
seg = *buf & 0x07;
|
||||
seg = *buf;
|
||||
old = buf[1] + 256*buf[2];
|
||||
new = old + reldiff(seg);
|
||||
if (verbose > 1) {
|
||||
printf("%s:%s: old=%04x, seg=%d, rel=%04x, new=%04x\n",
|
||||
fp->fname, name, old, seg, reldiff(seg), new);
|
||||
}
|
||||
/*printf("old=%04x, seg=%d, rel=%04x, new=%04x\n", old, seg, reldiff(seg), new);*/
|
||||
buf[1] = new & 255;
|
||||
buf[2] = (new>>8) & 255;
|
||||
buf +=3;
|
||||
@ -857,7 +831,7 @@ int write_nglobals(FILE *fp, char **globdef, int nglobal) {
|
||||
|
||||
for(i=0;i<g;i++) {
|
||||
if (gp[i].name != NULL) {
|
||||
fprintf(fp,"%s%c%c%c%c",gp[i].name,0,gp[i].seg,
|
||||
fprintf(fp,"%s%c%c%c%c",gp[i].name,0,gp[i].seg,
|
||||
gp[i].val & 255, (gp[i].val>>8)&255);
|
||||
}
|
||||
}
|
||||
|
1078
xa/misc/ldo65.c.orig
Normal file
1078
xa/misc/ldo65.c.orig
Normal file
File diff suppressed because it is too large
Load Diff
@ -931,7 +931,7 @@ static void usage(int default816, FILE *fp)
|
||||
" -M allow ``:'' to appear in comments for MASM compatibility\n"
|
||||
" (deprecated: prefer -XMASM)\n"
|
||||
" -Xcompatset set compatibility flags for other assemblers, known values are:\n"
|
||||
" MASM, CA65, XA23 (deprecated: for better 2.3 compatibility)\n"
|
||||
" C, MASM, CA65, XA23 (deprecated: for better 2.3 compatibility)\n"
|
||||
" -R start assembler in relocating mode\n"
|
||||
" -U allow all undefined labels in relocating mode\n");
|
||||
fprintf(fp,
|
||||
@ -992,7 +992,7 @@ static char *ertxt[] = {
|
||||
"Illegal quantity", // E_ILLQUANT =-35
|
||||
".bin", // E_BIN =-36
|
||||
"#error directive", // E_UERROR =-37
|
||||
"Assertion", // E_AERROR =-38
|
||||
"Assertion", // E_AERROR =-38
|
||||
"DSB has negative length", // E_NEGDSBLEN =-39
|
||||
/* placeholders for future fatal errors */
|
||||
"", // -40
|
||||
|
@ -213,7 +213,7 @@ printf("pointer: v=%04x, afl=%04x\n",*v,afl);
|
||||
/* subtract pointer from constant */
|
||||
errout(W_SUBTRACT);
|
||||
}
|
||||
/* allow math in the same segment */
|
||||
/* allow math in the same segment */
|
||||
if(segment!=SEG_ABS && segment != afl) {
|
||||
if(!dsb_len) {
|
||||
/*printf("ILLPOINTER=dsb_len=%d,segment=%d\n",dsb_len, segment);*/
|
||||
|
@ -141,7 +141,6 @@ typedef struct {
|
||||
#define E_UERROR -37 /* #error */
|
||||
#define E_AERROR -38 /* .assert failed */
|
||||
#define E_NEGDSBLEN -39 /* .dsb has negative length */
|
||||
|
||||
/* errors thru 64 are placeholders available for use */
|
||||
|
||||
#define W_ADRRELOC -65 /* word relocation in byte value */
|
||||
|
23
xa/src/xal.c
23
xa/src/xal.c
@ -707,9 +707,6 @@ int ll_pdef(char *t)
|
||||
return(E_NODEF);
|
||||
}
|
||||
|
||||
/*
|
||||
* Write out the list of global labels in an o65 file
|
||||
*/
|
||||
int l_write(FILE *fp)
|
||||
{
|
||||
int i, afl, n=0;
|
||||
@ -719,39 +716,25 @@ int l_write(FILE *fp)
|
||||
fputc(0, fp);
|
||||
return 0;
|
||||
}
|
||||
// calculate number of global labels
|
||||
for (i=0;i<afile->la.lti;i++) {
|
||||
ltp=afile->la.lt+i;
|
||||
if((!ltp->blk) && (ltp->fl==1)) {
|
||||
n++;
|
||||
}
|
||||
}
|
||||
// write number of globals to file
|
||||
fputc(n&255, fp);
|
||||
fputc((n>>8)&255, fp);
|
||||
// iterate over labels and write out label
|
||||
for (i=0;i<afile->la.lti;i++)
|
||||
{
|
||||
ltp=afile->la.lt+i;
|
||||
if((!ltp->blk) && (ltp->fl==1)) {
|
||||
// write global name
|
||||
fprintf(fp, "%s",ltp->n);
|
||||
fputc(0,fp);
|
||||
|
||||
// segment byte
|
||||
afl = ltp->afl;
|
||||
// hack to switch undef and abs flag from internal to file format
|
||||
// if asolute of undefined (< SEG_TEXT, i.e. 0 or 1)
|
||||
// then invert bit 0 (0 = absolute)
|
||||
if( (afl & (A_FMASK>>8)) < SEG_TEXT) {
|
||||
afl^=1;
|
||||
}
|
||||
// remove residue flags, only write out real segment number
|
||||
// according to o65 file format definition
|
||||
afl = afl & (A_FMASK >> 8);
|
||||
/* hack to switch undef and abs flag from internal to file format */
|
||||
/*printf("label %s, afl=%04x, A_FMASK>>8=%04x\n", ltp->n, afl, A_FMASK>>8);*/
|
||||
if( (afl & (A_FMASK>>8)) < SEG_TEXT) afl^=1;
|
||||
fputc(afl,fp);
|
||||
|
||||
// value
|
||||
fputc(ltp->val&255, fp);
|
||||
fputc((ltp->val>>8)&255, fp);
|
||||
}
|
||||
|
@ -132,6 +132,11 @@ static char *html_escape(char *toescape) {
|
||||
strcpy(q, "&");
|
||||
q+=5;
|
||||
p++;
|
||||
} else
|
||||
if (*p == '>') {
|
||||
strcpy(q, ">");
|
||||
q+=4;
|
||||
p++;
|
||||
} else {
|
||||
*q = *p;
|
||||
q++;
|
||||
|
2831
xa/src/xat.c.orig
Normal file
2831
xa/src/xat.c.orig
Normal file
File diff suppressed because it is too large
Load Diff
52
xa/src/xat.c.rej
Normal file
52
xa/src/xat.c.rej
Normal file
@ -0,0 +1,52 @@
|
||||
--- src/xat.c
|
||||
+++ src/xat.c
|
||||
@@ -632,45 +632,45 @@
|
||||
dsb_len = 0;
|
||||
} else
|
||||
if(n==Ktext) {
|
||||
+ r_mode(RMODE_RELOC); // use of segments restores previous segment / reloc mode
|
||||
segment = relmode ? SEG_TEXT : SEG_ABS;
|
||||
t[0]=Ksegment;
|
||||
t[1]=segment;
|
||||
*ll=2;
|
||||
er=E_OKDEF;
|
||||
- r_mode(RMODE_RELOC); // use of segments always switches of ABS reloc mode
|
||||
} else
|
||||
if(n==Kdata) {
|
||||
if(relmode) {
|
||||
+ r_mode(RMODE_RELOC); // use of segments restores previous segment / reloc mode
|
||||
segment = SEG_DATA;
|
||||
t[0]=Ksegment;
|
||||
t[1]=SEG_DATA;
|
||||
*ll=2;
|
||||
er=E_OKDEF;
|
||||
- r_mode(RMODE_RELOC); // use of segments always switches of ABS reloc mode
|
||||
} else {
|
||||
er=E_ILLSEGMENT;
|
||||
}
|
||||
} else
|
||||
if(n==Kbss) {
|
||||
if(relmode) {
|
||||
+ r_mode(RMODE_RELOC); // use of segments restores previous segment / reloc mode
|
||||
segment = SEG_BSS;
|
||||
t[0]=Ksegment;
|
||||
t[1]=SEG_BSS;
|
||||
*ll=2;
|
||||
er=E_OKDEF;
|
||||
- r_mode(RMODE_RELOC); // use of segments always switches of ABS reloc mode
|
||||
} else {
|
||||
er=E_ILLSEGMENT;
|
||||
}
|
||||
} else
|
||||
if(n==Kzero) {
|
||||
if(relmode) {
|
||||
+ r_mode(RMODE_RELOC); // use of segments restores previous segment / reloc mode
|
||||
segment = SEG_ZERO;
|
||||
t[0]=Ksegment;
|
||||
t[1]=SEG_ZERO;
|
||||
*ll=2;
|
||||
er=E_OKDEF;
|
||||
- r_mode(RMODE_RELOC); // use of segments always switches of ABS reloc mode
|
||||
} else {
|
||||
er=E_ILLSEGMENT;
|
||||
}
|
@ -34,5 +34,5 @@ escape2: escape2.a65
|
||||
../hextool -cmp=escape2.ca65 < $@
|
||||
|
||||
clean:
|
||||
rm -f a.err a.o65 $(OBJS)
|
||||
rm -f *.err a.o65 $(OBJS)
|
||||
|
||||
|
@ -1,3 +0,0 @@
|
||||
unnamed2.a65:line 9: 4007:Label '(null)' not defined
|
||||
unnamed2.a65:line 13: 400e:Label '(null)' not defined
|
||||
Break after 2 errors
|
Binary file not shown.
@ -1,10 +0,0 @@
|
||||
|
||||
all: test1 clean
|
||||
|
||||
test1: test1.s
|
||||
../../xa -R -o $@.o65 $<
|
||||
../hextool -cmp=$@.o65 < $@.ok
|
||||
|
||||
clean:
|
||||
rm -f *.o65
|
||||
|
Binary file not shown.
@ -1,8 +0,0 @@
|
||||
|
||||
.(
|
||||
foo lda #0
|
||||
jmp bar
|
||||
|
||||
&bar =foo
|
||||
.)
|
||||
|
@ -5,7 +5,7 @@ ptr .word 0
|
||||
|
||||
foo =$1234
|
||||
|
||||
lda ptr2
|
||||
lda ptr2
|
||||
loop: jmp loop
|
||||
|
||||
.data
|
||||
|
@ -1,4 +1,4 @@
|
||||
jsr loop
|
||||
jsr loop
|
||||
bla: lda ptr
|
||||
lda #ptr
|
||||
|
||||
|
@ -58,32 +58,26 @@ linked62.o65: 60.o65 61.o65
|
||||
|
||||
t1: linked.o65
|
||||
../../reloc65 -bt 32768 -xt -o $@ $<
|
||||
../hextool $@ > $@.hex
|
||||
../hextool -cmp=$@ < t1.ok
|
||||
|
||||
t2: linked2.o65
|
||||
../../reloc65 -bt 32768 -xt -o $@ $<
|
||||
../hextool $@ > $@.hex
|
||||
../hextool -cmp=$@ < t2.ok
|
||||
|
||||
t10: linked10.o65
|
||||
../../reloc65 -bt 32768 -xt -o $@ $<
|
||||
../hextool $@ > $@.hex
|
||||
../hextool -cmp=$@ < t10.ok
|
||||
|
||||
t11: linked11.o65
|
||||
../../reloc65 -bt 32768 -xt -o $@ $<
|
||||
../hextool $@ > $@.hex
|
||||
../hextool -cmp=$@ < t11.ok
|
||||
|
||||
t20: linked20.o65
|
||||
../../reloc65 -bt 32768 -xt -o $@ $<
|
||||
../hextool $@ > $@.hex
|
||||
../hextool -cmp=$@ < t20.ok
|
||||
|
||||
t21: linked21.o65
|
||||
../../reloc65 -bt 32768 -xt -o $@ $<
|
||||
../hextool $@ > $@.hex
|
||||
../hextool -cmp=$@ < t21.ok
|
||||
|
||||
t22: linked22.o65
|
||||
@ -91,46 +85,38 @@ t22: linked22.o65
|
||||
|
||||
t30: linked30.o65
|
||||
../../reloc65 -bt 32768 -xt -o $@ $<
|
||||
../hextool $@ > $@.hex
|
||||
../hextool -cmp=$@ < t30.ok
|
||||
|
||||
t31: linked31.o65
|
||||
../../reloc65 -bt 32768 -xt -o $@ $<
|
||||
../hextool $@ > $@.hex
|
||||
../hextool -cmp=$@ < t31.ok
|
||||
|
||||
t40: linked40.o65
|
||||
../../reloc65 -bt 32768 -xt -o $@ $<
|
||||
../hextool $@ > $@.hex
|
||||
../hextool -cmp=$@ < t40.ok
|
||||
|
||||
t41: linked41.o65
|
||||
../../reloc65 -bt 32768 -xt -o $@ $<
|
||||
../hextool $@ > $@.hex
|
||||
../hextool -cmp=$@ < t41.ok
|
||||
|
||||
t50: linked50.o65
|
||||
../../reloc65 -bt 32768 -bd 40960 -o $@ $<
|
||||
../hextool $@ > $@.hex
|
||||
../hextool -cmp=$@ < t50.ok
|
||||
|
||||
t51: linked51.o65
|
||||
../../reloc65 -bt 32768 -bd 40960 -o $@ $<
|
||||
../hextool $@ > $@.hex
|
||||
../hextool -cmp=$@ < t51.ok
|
||||
|
||||
t60: linked60.o65
|
||||
../../reloc65 -bt 32768 -bd 40960 -o $@ $<
|
||||
../hextool $@ > $@.hex
|
||||
../hextool -cmp=$@ < t60.ok
|
||||
|
||||
t61: linked61.o65
|
||||
../../reloc65 -bt 32768 -bd 40960 -o $@ $<
|
||||
../hextool $@ > $@.hex
|
||||
../hextool -cmp=$@ < t61.ok
|
||||
|
||||
t62: linked62.o65
|
||||
|
||||
clean:
|
||||
rm -f *.o65 *.hex t1 t2 t10 t11 t20 t21 t30 t31 t40 t41 t50 t51 t60 t61 t62
|
||||
rm -f *.o65 *.hex t1 t2 t10 t11 t20 t21 t30 t31 t40 t41 t50 t51 t60 t61
|
||||
|
||||
|
@ -7,33 +7,41 @@ XA=../../xa
|
||||
CA65=ca65
|
||||
LD65=ld65
|
||||
|
||||
tests: linebreak.out include1.out listblocks.html listca65.html listca65_2.html
|
||||
tests: assertx.out assertx.html linebreakx.out include1x.out listblocksx.html listca65x.html listca65_2x.html
|
||||
|
||||
assertx.out: assert.a65
|
||||
${XA} -P- -o assertx.o65 $< > $@
|
||||
../hextool -cmp=assert.out < $@
|
||||
../hextool -cmp=assert.o65 < assertx.o65
|
||||
|
||||
include1.out: include1.a65
|
||||
${XA} -P- $< > a.out
|
||||
../hextool -cmp=include1.out < a.out
|
||||
assertx.html: assert.a65
|
||||
${XA} -P- -Fhtml -o assertx.o65 $< > $@
|
||||
../hextool -cmp=assert.html < $@
|
||||
|
||||
linebreak.out: linebreak.a65
|
||||
${XA} -P- $< > a.out
|
||||
../hextool -cmp=linebreak.out < a.out
|
||||
include1x.out: include1.a65
|
||||
${XA} -P- $< > $@
|
||||
../hextool -cmp=include1.out < $@
|
||||
|
||||
listblocks.html: listblocks.a65
|
||||
${XA} -P- -Fhtml listblocks.a65 > a.out
|
||||
../hextool -cmp=listblocks.html < a.out
|
||||
linebreakx.out: linebreak.a65
|
||||
${XA} -P- $< > $@
|
||||
../hextool -cmp=linebreak.out < $@
|
||||
|
||||
listca65.html: listca65.a65
|
||||
${XA} -XCA65 -P- -Fhtml listca65.a65 > a.out
|
||||
listblocksx.html: listblocks.a65
|
||||
${XA} -P- -Fhtml listblocks.a65 > $@
|
||||
../hextool -cmp=listblocks.html < $@
|
||||
|
||||
listca65x.html: listca65.a65
|
||||
${XA} -XCA65 -P- -Fhtml -o listca65x.o65 listca65.a65 > $@
|
||||
#${CA65} $<; ${LD65} -t none -o listca65.ca65 listca65.o; rm listca65.o
|
||||
../hextool -cmp=listca65.html < a.out
|
||||
../hextool -cmp=listca65.ca65 < a.o65
|
||||
../hextool -cmp=listca65.html < $@
|
||||
../hextool -cmp=listca65.ca65 < listca65x.o65
|
||||
|
||||
listca65_2.html: listca65_2.a65
|
||||
${XA} -XCA65 -P- -Fhtml listca65_2.a65 > a.out
|
||||
listca65_2x.html: listca65_2.a65
|
||||
${XA} -XCA65 -P- -Fhtml -o listca65_2x.o65 listca65_2.a65 > $@
|
||||
#${CA65} $<; ${LD65} -t none -o listca65_2.ca65 listca65_2.o; rm listca65_2.o
|
||||
../hextool -cmp=listca65_2.html < a.out
|
||||
../hextool -cmp=listca65_2.ca65 < a.o65
|
||||
../hextool -cmp=listca65_2.html < $@
|
||||
../hextool -cmp=listca65_2.ca65 < listca65_2x.o65
|
||||
|
||||
clean:
|
||||
rm -f a.err a.o65 a.out
|
||||
rm -f *.err *x.out *x.html *x.o65
|
||||
|
||||
|
BIN
xa/tests/listing/a.o65
Normal file
BIN
xa/tests/listing/a.o65
Normal file
Binary file not shown.
8
xa/tests/listing/assert.a65
Normal file
8
xa/tests/listing/assert.a65
Normal file
@ -0,0 +1,8 @@
|
||||
*=$0400
|
||||
|
||||
.assert *<$17e6, "routine too long"
|
||||
|
||||
lda #<$17e6 >> 2
|
||||
|
||||
lda *-2
|
||||
|
12
xa/tests/listing/assert.html
Normal file
12
xa/tests/listing/assert.html
Normal file
@ -0,0 +1,12 @@
|
||||
<html><head><title>(null)</title></head><body><pre>
|
||||
|
||||
assert.a65
|
||||
|
||||
1 A:1000 *= $0400
|
||||
|
||||
3 A:0400 .assert *<$17e6,"routine too long"
|
||||
|
||||
5 A:0400 a9 f9 lda #<$17e6>>2
|
||||
|
||||
7 A:0402 ad 00 04 lda *-2
|
||||
</pre></body></html>
|
BIN
xa/tests/listing/assert.o65
Normal file
BIN
xa/tests/listing/assert.o65
Normal file
Binary file not shown.
10
xa/tests/listing/assert.out
Normal file
10
xa/tests/listing/assert.out
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
assert.a65
|
||||
|
||||
1 A:1000 *= $0400
|
||||
|
||||
3 A:0400 .assert *<$17e6,"routine too long"
|
||||
|
||||
5 A:0400 a9 f9 lda #<$17e6>>2
|
||||
|
||||
7 A:0402 ad 00 04 lda *-2
|
@ -1,8 +0,0 @@
|
||||
|
||||
*=$0400
|
||||
|
||||
.assert *<$17e6, "routine too long"
|
||||
|
||||
lda #<$17e6 >> 2
|
||||
|
||||
lda *-2
|
@ -4,7 +4,7 @@
|
||||
|
||||
XA=../../xa
|
||||
|
||||
tests: mixabs1 mixabs2 mix1 mix2 clean
|
||||
tests: mixabs1 mixabs2 mix1 mix2
|
||||
|
||||
|
||||
mixabs1: mixabsolute.a65
|
||||
@ -13,22 +13,22 @@ mixabs1: mixabsolute.a65
|
||||
|
||||
mixabs2: mixabsolute.a65
|
||||
${XA} -R $< -o $@.tmp
|
||||
../../file65 -V $@.tmp
|
||||
../../file65 -v $@.tmp
|
||||
../../reloc65 -bt 40960 -o $@ $@.tmp
|
||||
../hextool -cmp=b.ok < $@
|
||||
|
||||
mix1: mix1.a65
|
||||
${XA} -R -o $@.o65 $<
|
||||
file65 -V $@.o65
|
||||
reloc65 -X -o $@ $@.o65
|
||||
../../file65 -v $@.o65
|
||||
../../reloc65 -X -o $@ $@.o65
|
||||
../hextool -cmp=$@.ok < $@.o65
|
||||
|
||||
mix2: mix2.a65
|
||||
${XA} -R -o $@.o65 $<
|
||||
file65 -V $@.o65
|
||||
reloc65 -X -o $@ $@.o65
|
||||
../../file65 -v $@.o65
|
||||
../../reloc65 -X -o $@ $@.o65
|
||||
../hextool -cmp=$@.ok < $@.o65
|
||||
|
||||
clean:
|
||||
rm -f a.err *.o65 a.hex mixabs2* mix1 mix2
|
||||
rm -f a.err *.o65 a.hex mixabs2* mix1 mix2 *.tmp
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
|
||||
.text
|
||||
|
||||
.word $0401
|
||||
*=$0401
|
||||
*=
|
||||
|
||||
.data
|
||||
NextPacketPtr: .byte 0,0 ; word
|
||||
|
||||
.text
|
||||
|
||||
.word $0401
|
||||
*=$0401
|
||||
*=
|
||||
|
||||
.data
|
||||
NextPacketPtr: .byte 0,0 ; word
|
||||
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
|
||||
.text
|
||||
|
||||
.word $0401
|
||||
*=$0401
|
||||
|
||||
|
||||
.data
|
||||
NextPacketPtr: .byte 0,0 ; word
|
||||
|
||||
.text
|
||||
|
||||
.word $0401
|
||||
*=$0401
|
||||
|
||||
|
||||
.data
|
||||
NextPacketPtr: .byte 0,0 ; word
|
||||
|
||||
|
||||
|
BIN
xa/tests/relmode/testseg.ok
Normal file
BIN
xa/tests/relmode/testseg.ok
Normal file
Binary file not shown.
@ -1,14 +1,8 @@
|
||||
default: test1.a65 test2.a65 test1.o65 test2.o65
|
||||
../../xa -XC -R -U test1.a65
|
||||
../hextool -cmp=test1.o65 < a.o65
|
||||
../../xa -R -U test2.a65
|
||||
../hextool -cmp=test2.o65 < a.o65
|
||||
|
||||
XA=../../xa
|
||||
|
||||
all: test1 test2 test3
|
||||
|
||||
test1: test1.a65
|
||||
${XA} -XC -R -U $<
|
||||
|
||||
test2: test2.a65
|
||||
${XA} -R -U $<
|
||||
|
||||
test3: test3.a65
|
||||
${XA} -R -U $<
|
||||
|
||||
clean:
|
||||
rm -f a.o65
|
||||
|
@ -5,7 +5,7 @@
|
||||
#define max3421e_enable() \
|
||||
lda #MAX3421E_EnMask :\
|
||||
jsr spi_enable
|
||||
|
||||
|
||||
#define max3421e_disable() \
|
||||
jsr spi_disable
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
spi_wra() :\
|
||||
lda #(val) :\
|
||||
spi_wra() :\
|
||||
max3421e_disable()
|
||||
max3421e_disable()
|
||||
|
||||
/********************************************************************/
|
||||
|
||||
@ -38,5 +38,5 @@
|
||||
max3421e_disable()
|
||||
|
||||
; macro used o give syntax...
|
||||
wreg(rPINCTL, bmFDUPSPI+bmINTLEVEL)
|
||||
wreg(rPINCTL, bmFDUPSPI+bmINTLEVEL)
|
||||
|
||||
|
BIN
xa/tests/usb65/test1.o65
Normal file
BIN
xa/tests/usb65/test1.o65
Normal file
Binary file not shown.
@ -8,9 +8,9 @@ single jmp single
|
||||
jmp lenerr
|
||||
|
||||
bne lenerr
|
||||
|
||||
|
||||
lenerr jsr lenerr
|
||||
|
||||
|
||||
|
||||
.)
|
||||
|
||||
|
BIN
xa/tests/usb65/test2.o65
Normal file
BIN
xa/tests/usb65/test2.o65
Normal file
Binary file not shown.
@ -1,28 +0,0 @@
|
||||
|
||||
|
||||
;#define DEBUG
|
||||
;#undef DEBUG_POLL
|
||||
;#define DEBUG_HW
|
||||
;
|
||||
;printc=$ffd2
|
||||
|
||||
.(
|
||||
|
||||
;#include "hostmsg.i65"
|
||||
|
||||
; .word $0401
|
||||
*=$0401
|
||||
|
||||
; .word eol
|
||||
; .word 10
|
||||
; .byt $9e, "1040"
|
||||
; .byt 0
|
||||
;eol .word 0
|
||||
.dsb 1040-*, $00
|
||||
; jmp start
|
||||
|
||||
;irqvec =$90
|
||||
;irqsave .word 0
|
||||
|
||||
.)
|
||||
|
Loading…
x
Reference in New Issue
Block a user