Navigation
Home & news
Random page
All pages
Site search:
Databases
Fortune cookies
Haikus
SID themes
Page collections
Blag
Chip music
Games
Hardware projects
Music downloads
Obfuscated programming
Piano music
Sane programming
Scene productions
SID related pages
Software downloads
Video downloads
Featured pages
Allt under himmelens fäste
Autosokoban
Binary Art
Brainfuck
Chimney claw
Chopin romance
Craft
Fratres
Freecell
Hardware chiptune
Nymphaea
One man and his piano
Paraforce
Pot plant monitor
Remote control
Reverberations
SID septet
Stranded
Syntax highlighting
TTY demystified
Townwoofer
Warpfruit
Where's the man's hat?
Forum
Register
Log in
Latest comments
Feedback
  • Swedish content
  • Personal content
  • Offensive content

Getting string input

Back to the TI-83 page

First of all, we put a prompt at 821ch. Max 16 chars.

        ld      de,821ch                ;put the prompt here
        ld      hl,prompt
        ld      bc,prompt_len           ;length of prompt, max = 16
        ldir

Then we call PGMIO_EXEC with the String Input command.

        ld      a,0                     ;code for STRING input
        ld      (ASM_IND_CALL),a

        call    PGMIO_EXEC              ;defined in squish.inc"}

Now OP1 contains the name of a temporary string variable. The string contains tokens, but if you're only interested in alphanumeric input that doesn't matter, because uppercase letters and digits are still ascii.

This routine is an example of how to display the string without checking for tokens like sin(.

        call    _CHKFINDSYM

        ex      de,hl                   ;hl is start of string data
        ld      c,(hl)
        inc     hl
        ld      b,(hl)
        inc     hl                      ;bc is length of string

        ld      a,b
        or      c                       ;length = 0 ?
        ret     z                       ;return if so

loop:
        push    bc
        ld      a,(hl)                  ;get a character
        call    _putc
        pop     bc
        dec     bc
        ld      a,b
        or      c                       ;done yet?
        jr      nz,loop                 ;no -> loop back

        call    _newline
        ret

And of course:

prompt:         .db \"Inp:\",0
prompt_len      =   $-prompt

Discuss this page

There are no comments here yet.