Author Topic: Number too large to fit?  (Read 3894 times)

0 Members and 1 Guest are viewing this topic.

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Number too large to fit?
« on: January 27, 2019, 08:33:39 pm »
So I have this.

Code: [Select]
#include "ti83plus.inc"
.org $9D93
.db t2ByteTok, tAsmCmp
bcall(_ClrLCDFull)
bcall(_getKey)
ld (Keystore),a
ld a,0
ld (curCol),a
ld (curRow),a
ld hl,Hello
bcall(_PutS)
ld a,1
ld (curRow),a
ld a,Keystore
ld h,0
ld l,a
bcall(_DispHL)
bcall(_getKey)
bcall(_ClrLCDFull)

ret
Hello:
.db "You pressed",0
Keystore:
.db 0

The compiler throws a warning at "ld a,Keystore" part, saying that the number is too big for 8-bit and is being truncated.
What am I doing wrong here?
Sig wipe!

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Number too large to fit?
« Reply #1 on: January 27, 2019, 08:44:42 pm »
You need to do ld a,(Keystore). The way you currently have it, you are trying to store the pointer, Keystore, to the 8-bit register A, but pointers are 16-bit for the Z80. By using (Keystore) instead, you are loading the byte at keystone.

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Number too large to fit?
« Reply #2 on: January 27, 2019, 09:07:26 pm »
Oof, just when I thought that I was no longer confusing (pointer) and pointer, I had it backwards.
The program worked as intended after the parenthesis. Thanks.
Sig wipe!