AppleIIAsm-Collection/disks/disk5_fileio/T.FILEIO.FINPUT
nathanriggs d1e8429d80 added disk 5, file input and output, rwts routines
This will be the last addition to the library before going through major revisions and then a major demo of libraries so far.
2018-11-16 21:47:02 -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
*