mirror of
https://github.com/fachat/xa65.git
synced 2025-08-19 01:27:27 +00:00
finished first set of listing features
This commit is contained in:
@@ -2,7 +2,7 @@ OBJ = xa.o xaa.o xal.o xap.o xat.o xar.o xar2.o xao.o xau.o xam.o xacharset.o
|
|||||||
|
|
||||||
#CFLAGS=-W -Wall -pedantic -ansi -g
|
#CFLAGS=-W -Wall -pedantic -ansi -g
|
||||||
#CFLAGS=-W -Wall -ansi -O2
|
#CFLAGS=-W -Wall -ansi -O2
|
||||||
CFLAGS=-g
|
CFLAGS=-g -std=c99
|
||||||
#LD = ${CC}
|
#LD = ${CC}
|
||||||
#LDFLAGS = "-lc"
|
#LDFLAGS = "-lc"
|
||||||
|
|
||||||
|
@@ -672,6 +672,7 @@ static int pass2(void)
|
|||||||
{
|
{
|
||||||
datei.fline=(afile->mn.tmp[afile->mn.tmpe+1]&255)+(afile->mn.tmp[afile->mn.tmpe+2]<<8);
|
datei.fline=(afile->mn.tmp[afile->mn.tmpe+1]&255)+(afile->mn.tmp[afile->mn.tmpe+2]<<8);
|
||||||
afile->mn.tmpe+=3;
|
afile->mn.tmpe+=3;
|
||||||
|
list_line(datei.fline); /* set line number of next listing output */
|
||||||
} else
|
} else
|
||||||
if(afile->mn.tmp[afile->mn.tmpe]==T_FILE)
|
if(afile->mn.tmp[afile->mn.tmpe]==T_FILE)
|
||||||
{
|
{
|
||||||
@@ -679,6 +680,8 @@ static int pass2(void)
|
|||||||
|
|
||||||
memcpy(&datei.fname, afile->mn.tmp+afile->mn.tmpe+3, sizeof(datei.fname));
|
memcpy(&datei.fname, afile->mn.tmp+afile->mn.tmpe+3, sizeof(datei.fname));
|
||||||
afile->mn.tmpe+=3+sizeof(datei.fname);
|
afile->mn.tmpe+=3+sizeof(datei.fname);
|
||||||
|
|
||||||
|
list_filename(datei.fname); /* set file name of next listing output */
|
||||||
/*
|
/*
|
||||||
datei.fname = malloc(strlen((char*) afile->mn.tmp+afile->mn.tmpe+3)+1);
|
datei.fname = malloc(strlen((char*) afile->mn.tmp+afile->mn.tmpe+3)+1);
|
||||||
if(!datei.fname) {
|
if(!datei.fname) {
|
||||||
@@ -692,7 +695,9 @@ static int pass2(void)
|
|||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
/* do not attempt address mode optimization on pass 2 */
|
/* do not attempt address mode optimization on pass 2 */
|
||||||
er=t_p2_l(afile->mn.tmp+afile->mn.tmpe,&ll,1,&al);
|
|
||||||
|
/* t_p2_l() includes the listing call to do_listing() */
|
||||||
|
er=t_p2_l(afile->mn.tmp+afile->mn.tmpe,&ll,&al);
|
||||||
|
|
||||||
if(er==E_NOLINE)
|
if(er==E_NOLINE)
|
||||||
{
|
{
|
||||||
|
@@ -137,7 +137,7 @@ static int ag_term(signed char *s, int p, int *v, int *nafl, int *label)
|
|||||||
if(s[pp]==T_VALUE)
|
if(s[pp]==T_VALUE)
|
||||||
{
|
{
|
||||||
*v=lval(s+pp+1);
|
*v=lval(s+pp+1);
|
||||||
pp+=4;
|
pp+=5;
|
||||||
/* printf("value: v=%04x\n",*v); */
|
/* printf("value: v=%04x\n",*v); */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -145,7 +145,7 @@ static int ag_term(signed char *s, int p, int *v, int *nafl, int *label)
|
|||||||
{
|
{
|
||||||
afl = s[pp+1];
|
afl = s[pp+1];
|
||||||
*v=cval(s+pp+2);
|
*v=cval(s+pp+2);
|
||||||
pp+=4;
|
pp+=6;
|
||||||
/* printf("pointer: v=%04x, afl=%04x\n",*v,afl); */
|
/* printf("pointer: v=%04x, afl=%04x\n",*v,afl); */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -161,7 +161,7 @@ static int ag_term(signed char *s, int p, int *v, int *nafl, int *label)
|
|||||||
|
|
||||||
*v *= mf;
|
*v *= mf;
|
||||||
|
|
||||||
while(!er && s[pp]!=')' && s[pp]!=']' && s[pp]!=',' && s[pp]!=T_END)
|
while(!er && s[pp]!=')' && s[pp]!=']' && s[pp]!=',' && s[pp]!=T_END && s[pp]!=T_COMMENT)
|
||||||
{
|
{
|
||||||
er=get_op(s,&o);
|
er=get_op(s,&o);
|
||||||
|
|
||||||
|
@@ -31,11 +31,12 @@
|
|||||||
|
|
||||||
#define cval(s) 256 * ((s)[1] & 255) + ((s)[0]&255)
|
#define cval(s) 256 * ((s)[1] & 255) + ((s)[0]&255)
|
||||||
#define lval(s) 65536 * ((s)[2] & 255) + 256 * ((s)[1] & 255) + ((s)[0] & 255)
|
#define lval(s) 65536 * ((s)[2] & 255) + 256 * ((s)[1] & 255) + ((s)[0] & 255)
|
||||||
#define wval(i, v) do { \
|
#define wval(i, v, f) do { \
|
||||||
t[i++] = T_VALUE; \
|
t[i++] = T_VALUE; \
|
||||||
t[i++] = v & 255; \
|
t[i++] = v & 255; \
|
||||||
t[i++] = (v >> 8) & 255; \
|
t[i++] = (v >> 8) & 255; \
|
||||||
t[i++] = (v >> 16) & 255; \
|
t[i++] = (v >> 16) & 255; \
|
||||||
|
t[i++] = f & 255; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#endif /* __XA65_XAD_H__ */
|
#endif /* __XA65_XAD_H__ */
|
||||||
|
@@ -148,6 +148,7 @@ typedef struct {
|
|||||||
#define T_COMMENT -8 /* unused */
|
#define T_COMMENT -8 /* unused */
|
||||||
#define T_DEFINE -9 /* define a label; inserted at conversion and discarded in pass1, only used in listing output */
|
#define T_DEFINE -9 /* define a label; inserted at conversion and discarded in pass1, only used in listing output */
|
||||||
#define T_LISTING -10 /* meta token, inserted after conversion before pass1, used after pass2 to create listing */
|
#define T_LISTING -10 /* meta token, inserted after conversion before pass1, used after pass2 to create listing */
|
||||||
|
#define T_CAST -11 /* token inserted for a cast */
|
||||||
|
|
||||||
#define P_START 0 /* arithmetic operation priorities */
|
#define P_START 0 /* arithmetic operation priorities */
|
||||||
#define P_LOR 1 /* of any two operations, the one with */
|
#define P_LOR 1 /* of any two operations, the one with */
|
||||||
|
@@ -66,7 +66,7 @@ void o_write(FILE *fp) {
|
|||||||
l=afile->fo.olist[i].len;
|
l=afile->fo.olist[i].len;
|
||||||
t=afile->fo.olist[i].text;
|
t=afile->fo.olist[i].text;
|
||||||
/* do not optimize */
|
/* do not optimize */
|
||||||
t_p2_l(t, &l, 1, &afl);
|
t_p2_l(t, &l, &afl);
|
||||||
|
|
||||||
if(l>254) {
|
if(l>254) {
|
||||||
errout(E_OPTLEN);
|
errout(E_OPTLEN);
|
||||||
|
549
xa/src/xat.c
549
xa/src/xat.c
File diff suppressed because it is too large
Load Diff
@@ -23,7 +23,10 @@ extern int dsb_len;
|
|||||||
|
|
||||||
void list_setfile(FILE *fp);
|
void list_setfile(FILE *fp);
|
||||||
int t_p1(signed char *s, signed char *t, int *ll, int *al);
|
int t_p1(signed char *s, signed char *t, int *ll, int *al);
|
||||||
int t_p2_l(signed char *t, int *ll, int fl, int *al);
|
int t_p2_l(signed char *t, int *ll, int *al);
|
||||||
int b_term(char *s, int *v, int *l, int pc);
|
int b_term(char *s, int *v, int *l, int pc);
|
||||||
|
|
||||||
|
void list_line(int l); /* set line number for the coming listing output */
|
||||||
|
void list_filename(char *fname);/* set file name for the coming listing output */
|
||||||
|
|
||||||
#endif /* __XA65_XAT_H__ */
|
#endif /* __XA65_XAT_H__ */
|
||||||
|
Reference in New Issue
Block a user