RE: A86: Why doesn't this work?
[Prev][Next][Index][Thread]
RE: A86: Why doesn't this work?
Actually, what he did was pretty smart. The codes for the arrow keys are 1,
2, 3, and 4, so if you dec it each time and check if it's zero it will work.
dec a is smaller and faster than cp with a value.
It works fine if you add a ret after the ED label.
Later,
Jeremy G.
> -----Original Message-----
> From: owner-assembly-86@lists.ticalc.org
> [mailto:owner-assembly-86@lists.ticalc.org]On Behalf Of Chicane
> Sent: Sunday, August 16, 1998 12:55 PM
> To: assembly-86@lists.ticalc.org
> Subject: Re: A86: Why doesn't this work?
>
>
>
> Refer to the coments below to fix the code so it will work corectly.
> Explanation:
> You dont decriment a. You compare a to a key, since a keycode is returned
> in a.
> For a list of keycodes, refer to ti86asm.inc.
> If you need anymore help, mail me or the list.
>
> At 02:17 PM 8/16/98 -0400, you wrote:
> >
> >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 ;this returns a keypress in a
> > dec a ;replace with "cp kRight"
> > jr z,Right ;this code is fine
> > dec a ;replace this with "cp kLeft"
> > jr z,Left ;fine
> > dec a ;"cp kUp"
> > jr z,Up ;fine
> > dec a ;"cp kDown
> > jr z,Down ;fine
> > jr Keyloop ;fine
> >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
> >
> >
> >
> >
> >
> CHICANE
> ICQ: #14727618
> chicane on EFNET #ti
> Homepage: Under Construction.
>
References: