Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wrong PEEKed value from @label (*solved*)
#1
I have a label beetwen to pieces of machine code data:

Code:
asm
    defb 12,8 ; width and heigth (in characters)
end asm

galeon02Charset:

asm
    defb 0,0,0,0,0,0 ; many graphic data
end asm

I tried to access the first two bytes (before the label) from BASIC, PEEKing the label address plus an offset, but I got strange results. In order to find out the problem, I wrote the following:

Code:
    cls
    dim gal as uinteger
    let gal = @galeon02Charset
    print gal ' prints 36716, OK!
    print gal-2,peek(gal-2) ' prints 36714 and 12, OK!
    print gal-1,peek(gal-1) ' prints 36715 and 8, OK!

    print @galeon02Charset ' prints 36716, OK!
    print @galeon02Charset-2,peek(@galeon02Charset-2) ' prints 36714, 106 !!!
    print @galeon02Charset-1,peek(@galeon02Charset-1) ' prints 36715, 107 !!!

    print @galeon02Charset-2,peek(ubyte,@galeon02Charset-2) ' prints 36714, 106 !!!
    print @galeon02Charset-1,peek(ubyte,@galeon02Charset-1) ' prints 36715, 107 !!!

    print @galeon02Charset-2,peek((@galeon02Charset)-2) ' prints 36714, 106 !!!
    print @galeon02Charset-1,peek((@galeon02Charset)-1) ' prints 36715, 107 !!!

I don't understand why the address of the label is printed with PRINT but returns a wrong value with PEEK. Any issue about the type? But the address of a label is supposed to be uinteger, isn't it?

I don't understand why PEEK works with the uinteger variable, initialized to @label, but doesn't work directly with @label.

Is this a bug or am I missing something?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)