1
0
mirror of https://github.com/fachat/xa65.git synced 2025-04-04 22:30:16 +00:00

fix a bug in operand size optimization

This commit is contained in:
A. Fachat 2013-10-06 16:37:28 +02:00
parent f4d97d6fd6
commit c7477d2f1b
4 changed files with 52 additions and 4 deletions

@ -1691,9 +1691,12 @@ fprintf(stderr,
/* terrible KLUDGE!!!! OH NOES!!!1!
due to the way this is constructed, you must absolutely always specify @ to
get an absolute long or it will absolutely always be optimized down */
if(bl && am>16 &&
!er && !(vv[0]&0xff0000) && opt[am]>=0)
/* now also checks for negative overflow, resp. not-overflow */
if(bl
&& am>16
&& !er
&& (((vv[0]&0xff8000)==0xff8000) || !(vv[0]&0xff0000))
&& opt[am]>=0)
if(ct[n][opt[am]]>=0)
am=opt[am];
#ifdef DEBUG_AM
@ -1746,8 +1749,10 @@ fprintf(stderr, "byte length is now %d\n", bl);
er=E_CMOS;
} else {
n65816++;
if(!w65816)
if(!w65816) {
fprintf(stderr,"n=%d, am=%d\n", n, am);
er=E_65816;
}
}
}
if(am!=0)

@ -20,6 +20,7 @@ binclude/ Binary include code with some weird casing
chppch/ Changing preprocessor characters (-p)
charset/ Tests of when charsets should be honoured and when not
cc65/ Compatibility tests for ca65 compatibility
relmode/ tests concerning switches between segments and absolute mode
Cameron Kaiser, André Fachat

24
xa/tests/relmode/Makefile Normal file

@ -0,0 +1,24 @@
#
# Makefile for tests
#
XA=../../xa
tests: mixabs1 mixabs2 clean
mixabs1: mixabsolute.a65
${XA} $<
hexdump -C a.o65 > a.hex
cmp mixabs1.out a.hex
mixabs2: mixabsolute.a65
${XA} -R $<
file65 -V a.o65
reloc65 -bt 40960 -o b.o65 a.o65
hexdump -C b.o65 > b.hex
cmp mixabs2.out b.hex
clean:
# rm -f a.err a.o65 a.hex b.o65 b.hex

@ -0,0 +1,18 @@
.text
l1 lda l1
*=$2000
l2 lda l2
.data
l3 .word l3
.text
l4 lda l4