mirror of
https://github.com/gungwald/prodos-more.git
synced 2024-12-11 09:49:29 +00:00
Back to latest version
This commit is contained in:
parent
b0b2510a96
commit
c7ca984275
88
more.s
88
more.s
@ -1,8 +1,11 @@
|
|||||||
|
pr#1
|
||||||
|
|
||||||
|
:p
|
||||||
|
|
||||||
********************************
|
********************************
|
||||||
* *
|
* *
|
||||||
* MORE - UN*X MORE COMMAND *
|
* MORE - UN*X MORE COMMAND *
|
||||||
* ASSEMBLES WITH MERLIN *
|
* ASSEMBLES WITH MERLIN *
|
||||||
* BILL CHATFIELD *
|
|
||||||
* *
|
* *
|
||||||
********************************
|
********************************
|
||||||
|
|
||||||
@ -23,6 +26,11 @@ CROUT EQU $FD8E
|
|||||||
COUT EQU $FDED
|
COUT EQU $FDED
|
||||||
PRBYTE EQU $FDDA
|
PRBYTE EQU $FDDA
|
||||||
|
|
||||||
|
* SUBROUTINES IN BASIC.SYSTEM ROM:
|
||||||
|
|
||||||
|
GETBUFR EQU $BEF5 ;ALLOCATE BUFFER, DESTROYS X & Y
|
||||||
|
FREEBUFR EQU $BEF8 ;FREE BUFFER
|
||||||
|
|
||||||
* PRODOS ENTRY POINT
|
* PRODOS ENTRY POINT
|
||||||
|
|
||||||
MLI EQU $BF00
|
MLI EQU $BF00
|
||||||
@ -32,6 +40,11 @@ MLI EQU $BF00
|
|||||||
OURCH EQU $057B ;80-COL HORIZ CURSOR POSITION
|
OURCH EQU $057B ;80-COL HORIZ CURSOR POSITION
|
||||||
OURCV EQU $05FB ;VERTICAL CURSOR POSITION
|
OURCV EQU $05FB ;VERTICAL CURSOR POSITION
|
||||||
|
|
||||||
|
* ZERO-PAGE ADDRESSES
|
||||||
|
|
||||||
|
ZP_A1L EQU $3C ;MONITOR GENERAL PURPOSE
|
||||||
|
ZP_A1H EQU $3D ;MONITOR GENERAL PURPOSE
|
||||||
|
|
||||||
* PRODOS COMMAND CODES
|
* PRODOS COMMAND CODES
|
||||||
|
|
||||||
OPENCMD EQU $C8
|
OPENCMD EQU $C8
|
||||||
@ -161,6 +174,15 @@ MAIN CLD ;CLEAR DECIMAL FLG, AVOID CRASH
|
|||||||
BEQ :END ;USER JUST PRESSED RETURN
|
BEQ :END ;USER JUST PRESSED RETURN
|
||||||
CPIN FILENAME ;COPY "IN" BUF TO FILENAME
|
CPIN FILENAME ;COPY "IN" BUF TO FILENAME
|
||||||
*
|
*
|
||||||
|
* GET FILE I/O BUFFER FOR OPEN CALL
|
||||||
|
*
|
||||||
|
LDA #4 ;FOUR 256 BYTE PAGES = 1KB
|
||||||
|
JSR GETBUFR ;GET BUF FROM BASIC.SYSTEM
|
||||||
|
BCS :ERRFWDR ;CARRY SET INDICATES AN ERROR
|
||||||
|
STA OBUFADDR+1 ;GETBUFR RETURNS HIBYTE IN A
|
||||||
|
LDA #0 ;PREPARE
|
||||||
|
STA OBUFADDR ;LOBYTE IS 0 B/C ADDR OF PAGE
|
||||||
|
*
|
||||||
* OPEN FILE
|
* OPEN FILE
|
||||||
*
|
*
|
||||||
JSR MLI
|
JSR MLI
|
||||||
@ -174,10 +196,25 @@ MAIN CLD ;CLEAR DECIMAL FLG, AVOID CRASH
|
|||||||
STA READFNUM
|
STA READFNUM
|
||||||
STA CLOSFNUM
|
STA CLOSFNUM
|
||||||
*
|
*
|
||||||
|
* GET BUFFER FOR READ OPERATION FROM BASIC.SYSTEM
|
||||||
|
*
|
||||||
|
LDA #1 ;ONE 256 BYTE BUFFER
|
||||||
|
JSR GETBUFR ;CALL BASIC.SYSTEM SUB
|
||||||
|
BCS :ERRFWDR ;CARRY SET MEANS ERROR
|
||||||
|
STA RBADDR+1 ;STORE HI-BYTE
|
||||||
|
STA ZP_A1H ;AGAIN, FOR 0-PAGE INDIRECTION
|
||||||
|
LDA #0 ;0 FOR LO-BYTE
|
||||||
|
STA RBADDR ;STORE IT
|
||||||
|
STA ZP_A1L ;AGAIN, FOR 0-PAGE INDIRECTION
|
||||||
|
*
|
||||||
* PRINT THE FILE
|
* PRINT THE FILE
|
||||||
*
|
*
|
||||||
JSR VIEWFILE ;MUST CLOSE BEFORE ERR HANDLING
|
JSR VIEWFILE ;MUST CLOSE BEFORE ERR HANDLING
|
||||||
*
|
*
|
||||||
|
* FREE READ BUFFER
|
||||||
|
*
|
||||||
|
JSR FREEBUFR
|
||||||
|
*
|
||||||
* CLOSE FILE
|
* CLOSE FILE
|
||||||
*
|
*
|
||||||
JSR MLI
|
JSR MLI
|
||||||
@ -185,6 +222,10 @@ MAIN CLD ;CLEAR DECIMAL FLG, AVOID CRASH
|
|||||||
DA CLOSPRMS
|
DA CLOSPRMS
|
||||||
STA CLOSERR
|
STA CLOSERR
|
||||||
*
|
*
|
||||||
|
* FREE FILE BUFFER USED IN OPEN CALL
|
||||||
|
*
|
||||||
|
JSR FREEBUFR
|
||||||
|
*
|
||||||
* CHECK FOR ERRORS
|
* CHECK FOR ERRORS
|
||||||
*
|
*
|
||||||
LDA READERR ;RELOAD THE READ RESULT CODE
|
LDA READERR ;RELOAD THE READ RESULT CODE
|
||||||
@ -234,18 +275,17 @@ VIEWFILE
|
|||||||
********************************
|
********************************
|
||||||
|
|
||||||
WRITEBUF
|
WRITEBUF
|
||||||
|
PUSHY
|
||||||
LDY #0 ;INIT CHAR COUNTER VARIABLE
|
LDY #0 ;INIT CHAR COUNTER VARIABLE
|
||||||
:LOOP CPY READCNT ;COMPARE TO MAX CHARS
|
:LOOP CPY READCNT ;COMPARE TO MAX CHARS
|
||||||
BEQ :ENDLOOP
|
BEQ :ENDLOOP
|
||||||
LDA READBUF,Y ;GET CHAR FROM BUFFER
|
LDA (ZP_A1L),Y ;GET CHAR FROM BUFFER
|
||||||
ORA #%10000000 ;TURN ON HIGH BIT FOR PRINTING
|
ORA #%10000000 ;TURN ON HIGH BIT FOR PRINTING
|
||||||
JSR COUT ;WRITE IT TO THE SCREEN
|
JSR COUT ;COUT PRESERVES ACCUM
|
||||||
*
|
*
|
||||||
* CHECK END OF LINE
|
* CHECK END OF LINE
|
||||||
*
|
*
|
||||||
LDA READBUF,Y ;LOAD AGAIN, WITHOUT HIBIT
|
CMP #CR_HIBIT ;COMPARE TO CARRIAGE RETURN
|
||||||
AND #%01111111 ;TURN OFF HIBIT, IF SET
|
|
||||||
CMP #CR ;COMPARE TO CR WITHOUT HIBIT
|
|
||||||
BNE :CONT ;IF NOT END OF LINE, NEXT CHAR
|
BNE :CONT ;IF NOT END OF LINE, NEXT CHAR
|
||||||
INC LINENUM ;NEXT LINE HAS BEEN REACHED
|
INC LINENUM ;NEXT LINE HAS BEEN REACHED
|
||||||
*
|
*
|
||||||
@ -261,6 +301,7 @@ WRITEBUF
|
|||||||
:CONT INY ;STATBAR HAS ADJUSTED LINENUM
|
:CONT INY ;STATBAR HAS ADJUSTED LINENUM
|
||||||
JMP :LOOP
|
JMP :LOOP
|
||||||
:ENDLOOP NOP
|
:ENDLOOP NOP
|
||||||
|
POPY
|
||||||
|
|
||||||
DO TRACE
|
DO TRACE
|
||||||
PUTS EXVIEW
|
PUTS EXVIEW
|
||||||
@ -377,11 +418,10 @@ ERRCODE DS 1
|
|||||||
READERR DS 1
|
READERR DS 1
|
||||||
CLOSERR DS 1
|
CLOSERR DS 1
|
||||||
LINENUM DS 1
|
LINENUM DS 1
|
||||||
BAR STR '[RET] NEXT LINE [SPC] NEXT PAGE [Q]UIT'
|
BAR STR '[RET] NEXT LINE / [SPC] NEXT PAGE / [Q]UIT'
|
||||||
USRQUIT DS 1
|
USRQUIT DS 1
|
||||||
BUFCHAR DS 1
|
BUFCHAR DS 1
|
||||||
USRCHAR DS 1
|
USRCHAR DS 1
|
||||||
I DS 1
|
|
||||||
|
|
||||||
ENVIEW STR 'ENTERING VIEWFILE'
|
ENVIEW STR 'ENTERING VIEWFILE'
|
||||||
EXVIEW STR 'EXITING VIEWFILE'
|
EXVIEW STR 'EXITING VIEWFILE'
|
||||||
@ -389,37 +429,33 @@ ENSTATB STR 'ENTERING STATUSBAR'
|
|||||||
EXSTATB STR 'EXITING STATUSBAR'
|
EXSTATB STR 'EXITING STATUSBAR'
|
||||||
ENERASEB STR 'ENTERING ERASEBAR'
|
ENERASEB STR 'ENTERING ERASEBAR'
|
||||||
EXERASEB STR 'EXITING ERASEBAR'
|
EXERASEB STR 'EXITING ERASEBAR'
|
||||||
|
*
|
||||||
|
|
||||||
* OPEN PARAMETERS
|
* OPEN PARAMETERS
|
||||||
|
*
|
||||||
OPENPRMS DB 3
|
OPENPRMS DB 3
|
||||||
DA FILENAME
|
DA FILENAME
|
||||||
DA OPENBUF
|
OBUFADDR DS 2
|
||||||
OPENFNUM DS 1
|
OPENFNUM DS 1
|
||||||
|
*
|
||||||
* READ PARAMETERS
|
* READ PARAMETERS
|
||||||
|
*
|
||||||
READPRMS DB 4
|
READPRMS DB 4
|
||||||
READFNUM DS 1
|
READFNUM DS 1
|
||||||
DA READBUF
|
RBADDR DS 2
|
||||||
REQCNT DW BUFSIZE
|
REQCNT DW BUFSIZE
|
||||||
READCNT DS 2
|
READCNT DS 2
|
||||||
|
*
|
||||||
* CLOSE PARAMETERS
|
* CLOSE PARAMETERS
|
||||||
|
*
|
||||||
CLOSPRMS DB 1
|
CLOSPRMS DB 1
|
||||||
CLOSFNUM DS 1
|
CLOSFNUM DS 1
|
||||||
|
*
|
||||||
* REST GOES HERE
|
|
||||||
|
|
||||||
|
|
||||||
* BUFFERS
|
* BUFFERS
|
||||||
|
*
|
||||||
* CONSUME ALL BYTES UP TO THE NEXT PAGE BOUNDRY
|
* CONSUME ALL BYTES UP TO THE NEXT PAGE BOUNDRY
|
||||||
FILLER DS \,$00
|
FILLER DS \,$00
|
||||||
* MUST START ON PAGE BOUNDRY
|
* MUST START ON PAGE BOUNDRY
|
||||||
OPENBUF DS 1024
|
*OPENBUF DS 1024
|
||||||
READBUF DS BUFSIZE
|
*READBUF DS BUFSIZE
|
||||||
|
|
||||||
:
|
:
|
Loading…
Reference in New Issue
Block a user