AppleIIAsm-Collection/source/disk1_stdio/T.SUB.SINPUT
nathanriggs c8cac53c5e Rev 0.4 updates
Massive updates that changes the way most subroutines are handled. Major bugfixes, various utilities added, started higher-level libraries.
2019-04-26 18:49:10 -04:00

76 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
*
LDX #$00
JSR GETLN
STX :STRLEN ; STORE STR LENGTH
CPX #0
BEQ :ZEXIT
*
:INP_CLR
LDY #0
LDA :STRLEN ; LENGTH OF STRING
STA RETLEN ; PUT LENGTH + 1 HERE
STA RETURN ; STRING LENGTH FIRST BYTE
INC RETLEN
:LOOP
LDA KEYBUFF,Y ; PUT STR INTO NEW LOC
INY
STA RETURN,Y
CPY :STRLEN ; IF Y < STR LENGTH
BNE :LOOP ; LOOP; ELSE, CONTINUE
JMP :EXIT
:ZEXIT
LDA #0
STA RETLEN
STA RETURN
:EXIT
RTS
*
** DATA
*
:STRLEN DS 1
*