Closed zu2 closed 1 month ago
compile this program:
unsigned char board[16];
int main(int argc, char *argv[])
{
unsigned char i,j;
for (i = 0; i < 16; i++) {
board[i] = 0;
}
return 0;
}
I get following code. Something is wrong with the adda/adcb part, so the array address is not calculated correctly.
.setcpu 6800
.code
.export _main
.code
_main:
des
des
;make local ptr off 0, rlim 254 noff 0
tsx
clr 1,x
clr 0,x
;
L1_l:
;make local ptr off 0, rlim 255 noff 0
tsx
ldb 0,x
clra
pshb
psha
ldab #16
jsr __cclt
;
jeq L1_b
jmp L1_n
L1_c:
ldab #1
;make local ptr off 0, rlim 252 noff 0
tsx
jsr __xplusplusuc
;
jmp L1_l
L1_n:
;make local ptr off 0, rlim 255 noff 0
tsx
ldb 0,x
clra
adda #>_board+0
adcb #<_board+0
pshb
psha
clrb
tsx
ldx ,x
ins
ins
stb 0,x
;
jmp L1_c
L1_b:
clra
clrb
;
L0_r:
ins
ins
jmp __cleanup4
.export _board
.bss
_board:
.ds 16