Re: LZ: string input help


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

Re: LZ: string input help



Nathan Adams wrote:
> 
> 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


Well, I don't know if this is what is causing a problem, but you never 
set your menu text cursor, ($8333) for x coord and ($8334) for y coord


<pre>
-- 
Compliments of:
_-_-_-_-_-_-_-_
  Alan Bailey
  mailto:bailala@mw.sisna.com
  IRC:Abalone
  Web:http://www.mw.sisna.com/users/bailala/home.htm
</pre>


References: