mirror of
https://github.com/fachat/xa65.git
synced 2025-03-18 05:29:30 +00:00
Fix a one-liner that broke the first pp replacement when it had
parameters
This commit is contained in:
parent
ecdf4f78b9
commit
a09aa0df40
13
xa/src/xap.c
13
xa/src/xap.c
@ -377,7 +377,7 @@ int pp_define(char *k)
|
||||
i++;
|
||||
t+=i;
|
||||
|
||||
pp_replace(h,t,-1,0);
|
||||
pp_replace(h,t,-1,rlist);
|
||||
|
||||
t=h;
|
||||
|
||||
@ -659,7 +659,7 @@ static int pp_replace_part(char *to, char *t, int n, int sl, int recursive, int
|
||||
mem = saved_mem;
|
||||
return(er);
|
||||
}
|
||||
}
|
||||
} // end if(liste[n].p_anz), i.e. if it has parameters
|
||||
|
||||
int d=(int)strlen(rs)-sl;
|
||||
|
||||
@ -688,10 +688,12 @@ static int pp_replace_part(char *to, char *t, int n, int sl, int recursive, int
|
||||
|
||||
int i=0;
|
||||
char c;
|
||||
while((c=rs[i]))
|
||||
while((c=rs[i])) {
|
||||
t[i++]=c;
|
||||
}
|
||||
// other change from recursive. there sl is missing from add
|
||||
*l=(recursive ? 0 : sl) + d;/*=0;*/
|
||||
//*l=(recursive ? 0 : sl) + d;/*=0;*/
|
||||
*l=sl + d;/*=0;*/
|
||||
|
||||
mem = saved_mem;
|
||||
|
||||
@ -791,6 +793,9 @@ int pp_replace(char *to, char *ti, int a,int b)
|
||||
if(sl && (sl==l) && check_name(t, n))
|
||||
{
|
||||
er = pp_replace_part(to, t, n, sl, 0, &l, b);
|
||||
if (er != E_OK) {
|
||||
return er;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(!n)
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
XA=../../xa
|
||||
|
||||
all: test1 test2 test3 test4 test5 test6 clean
|
||||
all: test1 test2 test3 test4 test5 test6 test6a test6b test7 clean
|
||||
|
||||
clean:
|
||||
rm a.o65
|
||||
|
@ -25,14 +25,6 @@ l_ bit SPISR :\
|
||||
#define max3420e_disable() \
|
||||
spi_disable(MAX3420E_EnMask)
|
||||
|
||||
#define wreg(reg, val) \
|
||||
max3420e_enable() :\
|
||||
lda #(reg) | 0x02 :\
|
||||
spi_wra() :\
|
||||
lda #(val) :\
|
||||
spi_wra() :\
|
||||
max3420e_disable()
|
||||
|
||||
#define wrac(reg) \
|
||||
pha :\
|
||||
max3420e_enable() :\
|
||||
|
0
xa/tests/ppdefines/test6.o65
Normal file
0
xa/tests/ppdefines/test6.o65
Normal file
28
xa/tests/ppdefines/test6a.a65
Normal file
28
xa/tests/ppdefines/test6a.a65
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
// testing some more complicated defines
|
||||
|
||||
|
||||
#define max3420e_enable() \
|
||||
spi_enable(MAX3420E_EnMask)
|
||||
|
||||
#define max3420e_disable() \
|
||||
spi_disable(MAX3420E_EnMask)
|
||||
|
||||
#define wrac(reg) \
|
||||
pha :\
|
||||
max3420e_enable() :\
|
||||
lda #(reg) | 0x02 :\
|
||||
spi_wra() :\
|
||||
pla :\
|
||||
spi_wra() :\
|
||||
max3420e_disable()
|
||||
|
||||
// just the definition of this macro hangs the xa indefinitely...
|
||||
|
||||
#define CLRBIT(reg, val) \
|
||||
rreg(reg) :\
|
||||
and #255-val :\
|
||||
wrac(reg)
|
||||
|
||||
|
||||
|
0
xa/tests/ppdefines/test6a.o65
Normal file
0
xa/tests/ppdefines/test6a.o65
Normal file
20
xa/tests/ppdefines/test6b.a65
Normal file
20
xa/tests/ppdefines/test6b.a65
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
// testing some more complicated defines
|
||||
// this is the minimum I found to trigger the hang symptom
|
||||
|
||||
|
||||
#define max3420e_enable() nop
|
||||
|
||||
#define wrac(reg) \
|
||||
max3420e_enable() :\
|
||||
lda #(reg)
|
||||
|
||||
// just the definition of this macro hangs the xa indefinitely...
|
||||
|
||||
#define CLRBIT(reg, val) \
|
||||
wrac(reg)
|
||||
|
||||
|
||||
// *=$c000
|
||||
// CLRBIT(1,2)
|
||||
|
0
xa/tests/ppdefines/test6b.o65
Normal file
0
xa/tests/ppdefines/test6b.o65
Normal file
23
xa/tests/ppdefines/test7.a65
Normal file
23
xa/tests/ppdefines/test7.a65
Normal file
@ -0,0 +1,23 @@
|
||||
|
||||
// due to a bug, the first definition was not behaving correct with the
|
||||
// parameters during evaluation (which wasn't tested in test6*).
|
||||
// With max3420e_enable2() first, the code would work, as it
|
||||
// was not used, with the used max3420e_enable() first it would break.
|
||||
|
||||
#define max3420e_enable() nop
|
||||
|
||||
#define max3420e_enable2() nop
|
||||
|
||||
#define wrac(reg) \
|
||||
max3420e_enable() :\
|
||||
lda #(reg)
|
||||
|
||||
// just the definition of this macro hangs the xa indefinitely...
|
||||
|
||||
#define CLRBIT(reg, val) \
|
||||
wrac(reg)
|
||||
|
||||
|
||||
*=$c000
|
||||
CLRBIT(1,2)
|
||||
|
1
xa/tests/ppdefines/test7.o65
Normal file
1
xa/tests/ppdefines/test7.o65
Normal file
@ -0,0 +1 @@
|
||||
<EFBFBD>
|
Loading…
x
Reference in New Issue
Block a user