AppleIIAsm-Collection/disks/disk6_fileio/T.FILEIO.FINPUT
nathanriggs 875dd80998 stdio 0.2.0 updates
- fixed a bunch of bugs
- separated common and stdio libraries
- commenting upgrades
- created min versions of each library
2018-12-14 21:23:32 -05:00

101 lines
2.3 KiB
Plaintext

*
*``````````````````````````````*
* FINPUT: READ LINE FROM TFILE *
*- -*
* INPUTS A LINE FROM A TEXT *
* FILE AND STORES IT AS A *
* STRING AT THE SPECIFIED *
* MEMORY LOCATION. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* *
* JSR CMD *
* ASC "OPEN TEXT1" *
* HEX 8D00 *
* JSR CMD *
* ASC "READ TEXT1" *
* HEX 8D00 *
* LDA #>STRLOC ; STRING LOC *
* PHA *
* LDA #<STRLOC *
* PHA *
* JSR FINPUT *
* JSR CMD *
* ASC "CLOSE TEXT1" *
* HEX 8D00 *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* Y = CLOBBERED *
* X = CLOBBERED *
* A = CLOBBERED *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
FINPUT
*
** SAVE RETURN ADDRESS
*
PLA
STA RETADR
PLA
STA RETADR+1
*
** GET PARAMETERS
*
PLA
STA ADDR1
PLA
STA ADDR1+1
*
LDX #0
JSR FGETLN
STX :SLEN
CPX #0
BEQ :EXIT
*
:INP_CLR
LDY #0
LDA :SLEN
STA (ADDR1),Y ; PUT LENGTH AT START
:LP
LDA $0200,Y ; KEYBOARD BUFFER
INY
STA (ADDR1),Y
CPY :SLEN
BNE :LP
*
:EXIT
*
** RESTORE RETURN ADDRESS
*
LDA RETADR+1
PHA
LDA RETADR
PHA
*
RTS
*
** DATA
*
:SLEN DS 1
*