Re: A86: Sending user input to LCD
[Prev][Next][Index][Thread]
Re: A86: Sending user input to LCD
Comments below...
In a message dated 10/14/99 13:41:33 Eastern Daylight Time,
Kumba12345@aol.com writes:
> I'm slowly experimenting with TI-86 asm when I get bored, and I'm currently
> trying to get the calculator to get the value of a key pressed by the User
> and display it on the LCD, and be able to switch between numbers and
> caps...any clues on how to pull this off?. I write a small proggy below
> that
> I think does...soemthing..If anyone could help, it'd be...well, helpful,
> hehe
> =)
>
> I've fully commented it (as a newbie should)..
>
> #include "asm86.h"
> #include "ti86asm.inc"
>
> .org _asm_exec_ram
>
> mainProg:
> call _clrLCD ; Clears LCD
>
> ld a,0 ; load 0 into a
> ld (_penRow),a ; load a into penRow
> ld (_penCol),a ; load a into penCol
> ld hl,l1 ; load label l1 into hl (a prompt)
> call _vputs ; spit it onscreen
> call _getkey ; get a keypress
> cp kEnter ; is it the Enter key?
> jp nz,progDis ; if not, goto label progDis
> ret ; return
>
> l1: .db "& ",0 ; prompt
>
This is the problem. You can't use _vputs to display a numeric value. What
you need to do is call _dispAHL like this:
progDis:
ld l,a
xor a ;ld a,0
ld h,a
;ahl=getkey value
call _dispAHL ;display value returned by _getkey
Now you can call getkey again or whatever, but skip the junk about blah.
> progDis:
> ld hl,blah ; just a test, load label 'blah' into hl
> call _vputs ; spit the result onscreen
> call _getkey ; get another keypress
> cp kEnter ; is it the Enter key again?
> jp z,quit ; if so, goto 'quit'
> jp nz,progDis ; if not, loop back into progDis
> ret ; return
>
> blah: .dw _getkey,0 ; define word to be getkey value (doubt this is
right,
>
> help pls)
>
> quit:
> .end ; quit
> ret ; return
>
> .end ; quit the whole bloody program
> END
>
>
> Output looks like the following after several keypresses:
>
> & uuuuuuuuuu
>
> Each hit of a key that isn't the enter key prints a 'uu' after the last
> one...mind boggling. The '&' is my Prompt...
----
Jonah Cohen
<ComAsYuAre@aol.com>
http://linux.hypnotic.org/~jonah/