Re: LZ: RE: string input help
[Prev][Next][Index][Thread]
That is exactly what it was. Thank you very much!
Nathan
At 00:45 11/26/96 UT, you wrote:
>Put 'push HL' before all GET_KEY calls and 'pop HL' after. GET_KEY modifies
>HL.
>
>At least, I think....
>
>--MZB
>
>----------
>From: owner-list-zshell@lists.ticalc.org on behalf of Nathan Adams
>Sent: Sunday, November 24, 1996 9:09 PM
>To: list-zshell@lists.ticalc.org
>Subject: LZ: string input help
>
>I've been trying to write a string input routine and have been having some
>trouble. This is my first shot at zshell/asm. Here is the code that I am
>working on:
>
>For size purposes I'm going to change the code. Let's say I am writing a
>program to input the letter t, store it and then print it out somewhere else
>
>;beginning of "t" program
>
>#include "TI-85.H"
>
>.org 0
>.db "Input String", 0
>
>TextIn = $80DF ;address to store string of t's
>
>Start:
> ld hl,TextIn ;load hl with address of TextIn
> CALL_(KeyLoop) ;Input t's
> ld hl,TextIn ;load hl with address of TextIn
> ld b,5 ;load b with number of t's to be displayed
> CALL_(DispTxt) ;Display t's
>
>Waitforkey: ;Wait for key to be pressed & return to zshell
> call GET_KEY
> cp 0
> ret nz
> jr Waitforkey
>
>KeyLoop:
> call GET_KEY ;get scancode of last key
> cp $0B ;compare it with t key scancode
> JUMP_Z(TKey) ;if they are equal goto TKey
>
> cp $09 ;compare it with enter key
> ret z ;return if equal
> jr KeyLoop
>
>TKey:
> ld (hl),'t' ;load current address in hl with 't'
> inc hl ;increment address in hl
> ld a,'t'
> ROM_CALL(M_CHARPUT) ;Output 't'
> JUMP_(KeyLoop) ;jump back to keyloop to input more t's
>
>DispTxt:
> ld a,(hl) ;ld a with char in address in hl
> ROM_CALL(M_CHARPUT) ;display it
> inc hl ;increment address
> djnz DispTxt ;jump to DispTxt if value in b is not 0
> ret ;return if b is 0
>
>.end
>
>When I try to run a program similar to this I can't get the characters to
>display correctly. What I would like to know is what is wrong with this,
>how I can fix it and if there is a better way to input strings.
>
>Any help would be greatly appreciated, I've been working on this for hours.
>
>Nathan Adams
>
>
>
>
References: