A86: Some stupid error I can't seem to find!


[Prev][Next][Index][Thread]

A86: Some stupid error I can't seem to find!



Well, this is a short piece of code that i am using to get me into the key detection part of the games, but i can't make this thing loop. For some reason, when i jump back to the start of the loop, it does something crazy. But since i'm jumping and not calling, then ret does not get me back, only exits. I've never tested this on a ti-86, only on the ti-86 emulator. I hope someone can tell me what i'm doing wrong...
 
Thanks
  Damnation / Alan Wong
 
------------------------------------
#include "asm86.h"
#include "ti86asm.inc"
 
.org _asm_exec_ram
 
 call _clrLCD
 call _runindicoff    
 ld hl, $0000
 ld (_penCol), hl
 ld hl,start
 call _vputs       
loop:
 xor a
 ld a,%01111110      
 out (1),a        
 nop               
 nop            
 in a,(1)         
 bit 3,a           
 jr z, up           
 bit 2,a
 jr z, right
 bit 1,a
 jr z, left
 bit 0,a
 jr z, down
 ld a,%00111111
 out (1),a
 nop
 nop
 in a,(1)
 bit 6,a
 jr z, exit
 jr loop           
up:
 ld hl,mup
 call _vputs
 jr loop
down:
 ld hl,mdown
 call _vputs
 jr loop
left:
 ld hl,mleft
 call _vputs
 jr loop
right:
 ld hl,mright
 call _vputs
 jr loop
exit:
 call _clrLCD
 ret
 
start:
 .db "START: ",0
mup:
 .db "UP",0
mdown:
 .db "DOWN",0
mleft:
 .db "LEFT",0
mright:
 .db "RIGHT",0
.end

Follow-Ups: