Re: A83: > How to do INPUT <


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

Re: A83: > How to do INPUT <




I'll be darned if I understand this.  See below.  Pardon my stupidness


On Fri, 24 Jul 1998 12:26:17 +0100 Linus Akesson <lairfight@softhome.net>
writes:
>
>Allright, I'll tell you... But if you use this in your programs, I 
>would be
>very grateful if you mentioned my name (as a credit, greeting or 
>whatever)
>because it wasn't the easiest thing to figure out...
>
>---
>
>Getting String Input
>==============================================================
>                                              by Linus Akesson
>
>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

How can I set the legnth limit to 8 chars?

>        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

What the heck is this?

>
>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.

Where did it get the input?

>
>This routine is an example of how to display the string without 
>checking for
>tokens line sin(.
>
>        call    _CHKFINDSYM

What is this for?

>
>        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 ofcourse:
>
>prompt:         .db "Inp:",0
>prompt_len      =   $-prompt
>
>
>---
>
>Getting Numeric Input
>==============================================================
>                                              by Linus Akesson
>
>This is done in about the same way. Start by putting the
>prompt at 821ch:
>
>        ld      de,821ch                ;put the prompt here
>        ld      hl,prompt
>        ld      bc,prompt_len           ;length of prompt, max = 16
>        ldir
>
>Then call PGMIO_EXEC, but with a different command in ASM_IND_CALL:
>
>        ld      a,1                     ;code for NUMERIC input
>        ld      (ASM_IND_CALL),a
>
>        call    PGMIO_EXEC
>
>The input is automatically parsed as an expression, and the result is 
>placed
>in OP1.
>
>        call    _formDisp               ;display it
>        ret
>
>prompt:         .db "Inp:",0
>prompt_len      =   $-prompt
>
>---
>
>Now go on and write a killer application,
>Linus
>
>

_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]


Follow-Ups: References: