title: ti-83+ assembly pixel moving program not working
body: <p>I made this code to move a pixel around in the screen area using the arrow keys and the enter button to stop the program. It does seem to work better with all the suggestions so far, but its placement of the pixel is messed up.</p>
  
  <pre><code>#include    "ti83plus.inc"
  .org $9D95
    ld a,$2D ;9D95,9D96
    ld ($9872),a ;9D98,9D99,9D9A
    ld a,$1F ;9D97,9D98
    ld ($9873),a ;9D9B,9D9C,9D9D
    jp main
  main:
    call clrScreen
    bcall(_getKey)
    ld ($987D),a
    cp $03
    call z,decY
    ld a,($987D)
    cp $04
    call z,incY
    ld a,($987D)
    cp $01
    call z,incX
    ld a,($987D)
    cp $02
    call z,decX
    ld a,($987D)
    cp $05
    ret z
    call dot
    call BTN ;byte to 9874 and 9875
    ld hl,($9874)
    ld (hl),e
    bcall(_GrBufCpy)
    jp main
  BTN:
    call BTM
    ld b, 0
    ld a, ($9873);a=y
    ld c,a;c=y
    sll c;leftshift with a 1 added
    rl b;leftshift for 0?
    sll c
    rl b
    sll c
    rl b
    ld h, 0
    ld a, ($9872);a=x
    ld l,a;l=a
    srl l; l/8
    srl l
    srl l
    add hl, bc
    ld bc, $9340
    add hl, bc
    ld ($9874), hl
    ret
  srt:
    call HTBC
    djnz srt
    ret
  BTM:
    dec l
    ld a,l
    cp $00
    ld e,$80
    ret z
    dec l
    ld a,l
    cp $00
    ld e,$40
    ret z
    dec l
    ld a,l
    cp $00
    ld e,$20
    ret z
    dec l
    ld a,l
    cp $00
    ld e,$10
    ret z
    dec l
    ld a,l
    cp $00
    ld e,$08
    ret z
    dec l
    ld a,l
    cp $00
    ld e,$04
    ret z
    dec l
    ld a,l
    cp $00
    ld e,$02
    ret z
    dec l
    ld a,l
    cp $00
    ld e,$01
    ret z
    jp BTM
  HTBC:
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    inc bc
    ret
  dot:
    ld hl,$0000
    ld a,($9873)
    ld b,a
    cp $00
    ld a,($9872)
    ld l,a
    ret z
    inc b
    call mult
    ret
  mult:
    inc hl
    inc hl
    inc hl
    inc hl
    inc hl
    inc hl
    inc hl
    inc hl
    inc hl
    inc hl
    inc hl
    inc hl
    djnz mult
    ret
  incX:
    ld a,($9872)
    inc a
    cp $95
    ret z
    ld ($9872),a
    ret
  decX:
    ld a,($9872)
    dec a
    cp $FF
    ret z
    ld ($9872),a
    ret
  incY:
    ld a,($9873)
    inc a
    cp $63
    ret z
    ld ($9873),a
    ret
  decY:
    ld a,($9873)
    dec a
    cp $FF
    ret z
    ld ($9873),a
    ret
  clrScreen:
    ld hl,$9340
    ld b,$00
    call clrloop
    ld hl,$9343
    call clrloop
    call clrloop
    call clrloop
    ret
  clrloop:
    inc hl
    ld (hl),$00
    djnz clrloop
    ret
  </code></pre>
  
  <p>it's easiest for me if you say which code block needs to be replaced and with what.</p>