A86: Re: Why doesn't this work?


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

A86: Re: Why doesn't this work?




Eeek! Well, doesnt get_key return the character in A? I dont recall
exactly.. but what are all those 'dec a' for? Wouldnt a 'cp' statement
work? And, you are using a lot of unnecessary code. For example, move the
'call _puts' after the ED: lablel and the 'call _homeup' after the 'call
_puts'. Saves space, easier to read.

Later,
    Matt

>I'm writing a program that will eventually move something around the
screen,
>to learn asm. This won't work for some reason.  However a version I made
>that only says Left and Right works, this works the same way, it just looks
>for Up and Down too.
>
>#include "ti86asm.inc"
>
>.org _asm_exec_ram
>
> call _clrLCD
>Keyloop:
> call _getkey
> dec a
> jr z,Right
> dec a
> jr z,Left
> dec a
> jr z,Up
> dec a
> jr z,Down
> jr Keyloop
>Left:
> call _homeup
> ld hl,LFT
> call _puts
> jr ED
>Right:
> call _homeup
> ld hl,RTE
> call _puts
> jr ED
>Up:
> call _homeup
> ld hl,UPP
> call _puts
> jr ED
>Down:
> call _homeup
> ld hl,DWN
> call _puts
> jr ED
>LFT:
> .db "Left",0
>RTE:
> .db "Right",0
>UPP:
> .db "Up",0
>DWN:
> .db "Down",0
>ED:
>.end
>
>Thanks,
>JEI
>
>
>
>