AppleIIAsm-Collection/source/disk1_stdio/T.SINPUT.SUB
nathanriggs 82d0e74c1a 0.3.1 updates
some minor bugfixes, directory shuffling, added demo and utility disks
2019-01-26 21:02:17 -05:00

83 lines
1.9 KiB
Plaintext

*
*``````````````````````````````*
* SINPUT :: SPECIAL INPUT *
* *
* INPUTS A STRING OF TEXT VIA *
* MONITOR HOOKS. MAX 255 CHARS *
*- -*
* CLOBBERS: *
* *
* FLAGS: ???----- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* JSR SINPUT *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* LOW BYTE OF INPUT ADDRESS *
* HI BYTE OF INPUT ADDRESS *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* A = LOW BYTE OF ADDRESS *
* X = LENGTH OF STRING *
* Y = LENGTH OF STRING *
* *
* [RETURN] = STRING TYPED *
* [RETLEN] = LENGTH OF STRING *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
SINPUT
*
** SAVE RETURN ADDRESS
*
PLA
STA RETADR
PLA
STA RETADR+1
*
LDX #$00
JSR GETLN
STX :STRLEN ; STORE STR LENGTH
CPX #0
BEQ :EXIT
*
:INP_CLR
LDY #0
LDA :STRLEN ; LENGTH OF STRING
STA RETLEN,Y ; PUT LENGTH
:LOOP
LDA KEYBUFF,Y ; PUT STR INTO NEW LOC
STA RETURN,Y
INY
CPY :STRLEN ; IF Y < STR LENGTH
BNE :LOOP ; LOOP; ELSE, CONTINUE
*
:EXIT
*
** RESTORE RETURN ADDRESS
*
LDA RETADR+1
PHA
LDA RETADR
PHA
*
RTS
*
** DATA
*
:STRLEN DS 1
*