1
0
mirror of https://github.com/fachat/xa65.git synced 2025-01-01 10:29:19 +00:00

finished first set of listing features

This commit is contained in:
Andre Fachat 2011-12-16 23:40:05 +01:00
parent 1691f5fb46
commit 314660fb76
8 changed files with 415 additions and 160 deletions

View File

@ -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 -ansi -O2
CFLAGS=-g
CFLAGS=-g -std=c99
#LD = ${CC}
#LDFLAGS = "-lc"

View File

@ -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);
afile->mn.tmpe+=3;
list_line(datei.fline); /* set line number of next listing output */
} else
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));
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);
if(!datei.fname) {
@ -692,7 +695,9 @@ static int pass2(void)
} else
{
/* 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)
{

View File

@ -137,7 +137,7 @@ static int ag_term(signed char *s, int p, int *v, int *nafl, int *label)
if(s[pp]==T_VALUE)
{
*v=lval(s+pp+1);
pp+=4;
pp+=5;
/* printf("value: v=%04x\n",*v); */
}
else
@ -145,7 +145,7 @@ static int ag_term(signed char *s, int p, int *v, int *nafl, int *label)
{
afl = s[pp+1];
*v=cval(s+pp+2);
pp+=4;
pp+=6;
/* printf("pointer: v=%04x, afl=%04x\n",*v,afl); */
}
else
@ -161,7 +161,7 @@ static int ag_term(signed char *s, int p, int *v, int *nafl, int *label)
*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);

View File

@ -31,11 +31,12 @@
#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 wval(i, v) do { \
#define wval(i, v, f) do { \
t[i++] = T_VALUE; \
t[i++] = v & 255; \
t[i++] = (v >> 8) & 255; \
t[i++] = (v >> 16) & 255; \
t[i++] = f & 255; \
} while (0)
#endif /* __XA65_XAD_H__ */

View File

@ -148,6 +148,7 @@ typedef struct {
#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_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_LOR 1 /* of any two operations, the one with */

View File

@ -66,7 +66,7 @@ void o_write(FILE *fp) {
l=afile->fo.olist[i].len;
t=afile->fo.olist[i].text;
/* do not optimize */
t_p2_l(t, &l, 1, &afl);
t_p2_l(t, &l, &afl);
if(l>254) {
errout(E_OPTLEN);

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,10 @@ extern int dsb_len;
void list_setfile(FILE *fp);
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);
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__ */