06-22-2010, 06:39 PM
It's a bug. I got the same thing. (though at different addresses)
I think the new label-offset code that Boriel put in isn't quite working correctly.
Looking at the asm:
Which does indeed get the byte from gal-2 (albeit in a very strange fashion - what's wrong with ld a,(hl) instead of copying hl to bc ?)
So you get the return value of 8 bits of the ADDRESS of galeon02Charset-2 not the value at this address. Your address was 36714 - which in HEX terms is 8F6A - and you are getting the 6A part (106 in decimal) returned to you.
Also, you may possibly get an extra opcode stuck in - because LD A,N only requires 2 bytes (62,N) and I'm thinking the assembler might be dropping LD A,NN in - which means the second "N" would be read as an instruction. This could quite easily crash if it was. I'm not sure looking at the disassembly though - it does look as though it isn't doing this - the LD,CALL,CALL structure seems intact.
I think it should be:
I think the new label-offset code that Boriel put in isn't quite working correctly.
Looking at the asm:
Code:
print peek(gal-2)
Turns into:
ld hl, (_gal)
dec hl
dec hl
ld b, h
ld c, l
ld a, (bc)
call __PRINTU8
Code:
print peek(@galeon02Charset-2)
Looks like it seems to turn into:
ld a, __LABEL__galeon02Charset - 2
call __PRINTU8
So you get the return value of 8 bits of the ADDRESS of galeon02Charset-2 not the value at this address. Your address was 36714 - which in HEX terms is 8F6A - and you are getting the 6A part (106 in decimal) returned to you.
Also, you may possibly get an extra opcode stuck in - because LD A,N only requires 2 bytes (62,N) and I'm thinking the assembler might be dropping LD A,NN in - which means the second "N" would be read as an instruction. This could quite easily crash if it was. I'm not sure looking at the disassembly though - it does look as though it isn't doing this - the LD,CALL,CALL structure seems intact.
I think it should be:
Code:
ld a, ( __LABEL__galeon02Charset - 2 )