prodos-more/more.sc.s

814 lines
22 KiB
ArmAsm
Raw Normal View History

2024-01-31 00:11:51 +00:00
********************************
* *
* MORE - UN*X MORE COMMAND *
* ASSEMBLES WITH S-C *
2024-01-31 00:11:51 +00:00
* *
********************************
2024-02-15 15:29:51 +00:00
* Memory Map
*
2024-02-15 15:29:51 +00:00
* $0000 - $00FF Zero Page
* $0100 - $01FF Stack
* $0200 - $03FF Mostly Free, Input Buffer, Interrupt Vectors
* $0400 - $07FF Lo-res/Text Page1
* $0800 - $0BFF Lo-res/Text Page2 (BASIC programs load here)
* $0C00 - $1FFF Free
* $2000 - $3FFF Hi-res Page1
* $4000 - $5FFF Hi-res Page2
* $6000 - $95FF Free
* $9600 - $BFFF DOS3.3 and Buffers
* $C000 - $CFFF Soft Switches, Expansion Card I/O and ROM
* $D000 - $F7FF BASIC ROM (can be bankswitched later models)
* $F800 - $FFFF Machine Language Monitor ROM (also can be bankswitched)
DSK MORE ;WRITE ASSEMBLED FILE TO DISK
TYP $06 ;$FF=SYSTEM, $06=BINARY
ORG $2000 ;ASSEMBLE START ADDRESS
2024-01-31 00:11:51 +00:00
* SYSTEM VARIABLES
*
IN .EQ $200 ;256-CHAR INPUT BUF
*
2024-01-31 00:11:51 +00:00
* SUBROUTINES IN MONITOR ROM: $F800 - $FFFF
*
RDKEY .EQ $FD0C ;READS A CHARACTER
GETLN .EQ $FD6A ;READS A LINE, WITH PROMPT($33)
GETLN1 .EQ $FD6F ;READS A LINE, NO PROMPT
CROUT .EQ $FD8E
COUT .EQ $FDED
PRBYTE .EQ $FDDA
*
2024-01-31 00:12:31 +00:00
* SUBROUTINES IN BASIC.SYSTEM ROM:
2024-02-04 00:26:06 +00:00
GETBUFR EQU $BEF5 ;BCC=OKAY & A=HIBYTE OF BUF
;BCS=FAIL & A=ERRCODE
;X & Y ARE DESTROYED
FREEBUFR EQU $BEF8 ;FREE BUFFER
2024-01-31 00:11:51 +00:00
* PRODOS ENTRY POINT
2024-02-04 00:26:06 +00:00
2024-02-05 18:14:58 +00:00
PRODOS_MLI EQU $BF00 ;MACHINE LANG IFACE (MLI)
*
2024-02-10 16:26:12 +00:00
* MEMORY MAPPED I/O: $C000 - $CFFF
*
RD80VID EQU $C01F ;<=128->40COL, >128->80COL
*
2024-02-10 16:26:12 +00:00
* SLOT 3 SCRATCHPAD RAM - TEXT PAGE 0 SCREEN HOLE
* http://yesterbits.com/media/books/apple/heiserman-1983-intermediate-level-apple-ii-handbook.pdf
*
OURCH EQU $057B ;80-COL HORIZ CURSOR POSITION
OURCV EQU $05FB ;VERTICAL CURSOR POSITION
2024-01-31 00:12:31 +00:00
* ZERO-PAGE ADDRESSES
*
ZP.A1L .EQ $3C ;MONITOR GENERAL PURPOSE
ZP.A1H .EQ $3D ;MONITOR GENERAL PURPOSE
*
2024-01-31 00:11:51 +00:00
* PRODOS COMMAND CODES
*
OPENCMD .EQ $C8
READCMD .EQ $CA
CLOSCMD .EQ $CC
*
2024-01-31 00:11:51 +00:00
* CONSTANTS
*
EOFERR .EQ $4C ;ERROR CODE FOR END-OF-FILE
PTR .EQ $06 ;ONLY FREE 0-PAGE LOCATION
MAXERCDE .EQ $5A ;LARGEST ERROR CODE
CR .EQ $0D ;ASCII CARRIAGE RETURN
CR.HIBIT .EQ $8D ;CARRIAGE RET WITH HIGH BIT SET
BUFSIZE .EQ $00FF
SCR.HGHT .EQ 24 ;SCREEN HEIGHT
*
2024-01-31 00:11:51 +00:00
* DEBUGGING
2024-02-05 18:14:58 +00:00
2024-02-07 08:15:27 +00:00
TRACE EQU 0
2024-01-31 00:11:51 +00:00
********************************
* *
* PUSH Y ONTO THE STACK *
* DESTROYS A *
* *
********************************
PUSHY .MA
2024-01-31 00:11:51 +00:00
TYA
PHA
.EM
2024-01-31 00:11:51 +00:00
********************************
* *
* POP Y FROM THE STACK *
* DESTROYS A *
* *
********************************
POPY .MA
2024-01-31 00:11:51 +00:00
PLA
TAY
.EM
2024-01-31 00:11:51 +00:00
********************************
* *
* COPY IN BUF TO STRING *
* *
* X CONTAINS LENGTH OF "IN" *
* ]1 IS DEST STRING (LEN BYT) *
* A IS DESTROYED *
* *
********************************
CPIN .MA
2024-01-31 00:11:51 +00:00
PUSHY ;SAVE Y
STX ]1 ;COPY LENGTH TO FIRST BYTE OF ]1
LDY #0 ;INIT Y TO ZERO
:1 CPY ]1 ;COMPARE Y WITH LENGTH BYTE
BEQ :2 ;DONE IF LENGTH IS REACHED
2024-01-31 00:11:51 +00:00
LDA IN,Y ;LOAD IN[Y] INTO ACCUMULATOR
CMP #CR ;COMPARE WITH CARRIAGE RETURN
BEQ :2 ;STOP AT CARRIAGE RETURN
2024-01-31 00:11:51 +00:00
INY ;DEST STR IS 1 AHEAD OF IN BUF
STA ]1,Y ;COPY CHAR TO DEST STR ]1
JMP :1 ;LOOP TO NEXT CHAR
:2 POPY ;RESTORE Y
.EM
2024-01-31 00:11:51 +00:00
********************************
* *
* WRITES A LENGTH PREFIXED *
* STRING TO THE SCREEN *
* A IS DESTROYED *
* *
********************************
PUTS .MA
2024-01-31 00:11:51 +00:00
PUSHY
LDY #0 ;INIT LOOP INDEX
:1 CPY ]1 ;HAS STR LENGTH BEEN REACHED
BEQ :2 ;IF SO THEN FINISH
2024-01-31 00:11:51 +00:00
INY ;MOVE TO INDEX OF NEXT CHAR
LDA ]1,Y ;GET THE CHAR TO BE WRITTEN
JSR COUT ;WRITE THE CHARACTER
JMP :1 ;LOOP
:2 POPY
.EM
2024-01-31 00:11:51 +00:00
********************************
* *
* SET TO #1 (IMMEDIATE 1) *
* ]1 DESTINATION *
* A IS DESTROYED *
* *
********************************
SET1 .MA
2024-01-31 00:11:51 +00:00
LDA #1
STA ]1
.EM
2024-01-31 00:11:51 +00:00
SET0 .MA
2024-01-31 00:11:51 +00:00
LDA #0
STA ]1
.EM
2024-01-31 00:11:51 +00:00
SET23 .MA
2024-01-31 00:11:51 +00:00
LDA #23
STA ]1
.EM
2024-01-31 00:11:51 +00:00
********************************
* *
* MAIN PROGRAM *
* *
********************************
MAIN CLD ;CLEAR DECIMAL FLG, AVOID CRASH
2024-02-01 05:17:42 +00:00
>SET0 USRQUIT ;INITIALIZE TO "NO"
2019-01-25 23:48:43 +00:00
*
2024-01-31 00:11:51 +00:00
* GET FILE NAME
2019-01-25 23:48:43 +00:00
*
2024-02-10 16:26:12 +00:00
PUTS INFOLINE
JSR CROUT
:ASKFILE PUTS PROMPT
2024-01-31 00:11:51 +00:00
JSR GETLN1 ;LENGTH IN X, CR AT END
CPX #0 ;IS THE LENGTH ZERO?
2024-02-10 16:26:12 +00:00
BNE :CONT0 ;USER JUST PRESSED RETURN
JMP :END
:CONT0 CPX #1
BNE :CONT1
LDA #"?"
CMP IN
BNE :CONT1
JSR HELPINFO
JMP :ASKFILE
2024-02-05 18:14:58 +00:00
:CONT1 CPIN FILENAME ;COPY "IN" BUF TO FILENAME
DO TRACE
JSR PRSTRBYTES
JSR GETLN
FIN
2019-01-25 23:48:43 +00:00
*
2024-01-31 00:12:31 +00:00
* GET FILE I/O BUFFER FOR OPEN CALL
*
LDA #4 ;FOUR 256 BYTE PAGES = 1KB
JSR GETBUFR ;GET BUF FROM BASIC.SYSTEM
2024-02-05 18:14:58 +00:00
BCC :CONT2 ;CARRY CLEAR MEANS NO ERROR
JSR OBUFERR
2024-02-10 16:26:12 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:CONT2 STA OBUFADDR+1 ;GETBUFR RETURNS HIBYTE IN A
2024-01-31 00:12:31 +00:00
LDA #0 ;PREPARE
STA OBUFADDR ;LOBYTE IS 0 B/C ADDR OF PAGE
2024-02-04 07:33:02 +00:00
*
* OPEN FILE
*
2024-02-05 18:14:58 +00:00
JSR PRODOS_MLI
2024-01-31 00:11:51 +00:00
DB OPENCMD
DA OPENPRMS
2024-02-10 16:26:12 +00:00
BEQ :CONT3
2024-02-05 18:14:58 +00:00
JSR OPENERR
2024-02-10 16:26:12 +00:00
JSR FREEBUFR ;CLEAN UP BEFORE TRY AGAIN
JMP :ASKFILE
2019-01-25 23:48:43 +00:00
*
2024-01-31 00:11:51 +00:00
* COPY FILE NUMBER FROM OPEN PARAMETERS TO READ AND CLOSE
2019-01-25 23:48:43 +00:00
*
2024-02-10 16:26:12 +00:00
:CONT3 LDA OPENFNUM
2024-01-31 00:11:51 +00:00
STA READFNUM
STA CLOSFNUM
2019-01-25 23:48:43 +00:00
*
2024-01-31 00:12:31 +00:00
* GET BUFFER FOR READ OPERATION FROM BASIC.SYSTEM
*
LDA #1 ;ONE 256 BYTE BUFFER
JSR GETBUFR ;CALL BASIC.SYSTEM SUB
2024-02-10 16:26:12 +00:00
BCC :CONT4
2024-02-05 18:14:58 +00:00
JSR RBUFERR ;CARRY SET MEANS ERROR
JMP :CLOSFILE
2024-02-10 16:26:12 +00:00
:CONT4 STA RBADDR+1 ;STORE HI-BYTE
2024-02-04 21:54:44 +00:00
STA ZP_A1H ;FOR 0-PAGE INDIRECTION
2024-01-31 00:12:31 +00:00
LDA #0 ;0 FOR LO-BYTE
STA RBADDR ;STORE IT
STA ZP.A1L ;AGAIN, FOR 0-PAGE INDIRECTION
2024-01-31 00:12:31 +00:00
*
2024-01-31 00:11:51 +00:00
* PRINT THE FILE
2019-01-25 23:48:43 +00:00
*
2024-02-04 00:26:06 +00:00
JSR VIEWFILE
2024-01-31 00:12:31 +00:00
*
2024-02-04 00:26:06 +00:00
* CLEANUP
2024-01-31 00:12:31 +00:00
*
2024-02-04 07:33:02 +00:00
JSR FREEBUFR ;FREE READ BUFFER
2024-02-10 16:26:12 +00:00
*
* Close file
*
2024-02-05 18:14:58 +00:00
:CLOSFILE JSR PRODOS_MLI ;CLOSE THE FILE
2024-01-31 00:11:51 +00:00
DB CLOSCMD
DA CLOSPRMS
2024-02-04 07:33:02 +00:00
BEQ :FREEOBUF
2024-02-05 18:14:58 +00:00
JSR CLOSERR
2024-02-04 07:33:02 +00:00
2024-02-05 18:14:58 +00:00
:FREEOBUF JSR FREEBUFR ;FREE OPEN I/O BUFFER
2024-02-10 16:26:12 +00:00
:END NOP
2024-02-05 18:14:58 +00:00
RTS
********************************
* *
* END OF MAIN - PROGRAM EXIT *
* *
********************************
2024-02-10 16:26:12 +00:00
********************************
* *
* PROGRAM INFO AND HELP *
* *
********************************
HELPINFO JSR CROUT
PUTS INFO0
JSR CROUT
PUTS INFO1
JSR CROUT
PUTS INFO2
JSR CROUT
PUTS INFO3
JSR CROUT
PUTS INFO4
JSR CROUT
JSR CROUT
RTS
2024-02-05 18:14:58 +00:00
********************************
* *
* HANDLE ERROR WHEN OPENING *
* FILE *
* *
********************************
OPENERR STA ERRCODE
2024-02-04 21:54:44 +00:00
PUTS OERRMSG
PUTS FILENAME
LDA #":"
JSR COUT
LDA ERRCODE
JSR ERRPROC
2024-01-31 00:11:51 +00:00
RTS
2024-02-05 18:14:58 +00:00
********************************
* *
* HANDLE ERROR WHEN CLOSING *
* FILE *
* *
********************************
CLOSERR STA ERRCODE
PUTS CERRMSG
PUTS FILENAME
LDA #"'"
JSR COUT
LDA #":"
JSR COUT
LDA ERRCODE
JSR ERRPROC
RTS
********************************
* *
* HANDLE ERROR WHEN REQUESTING *
* READ BUFFER *
* *
********************************
RBUFERR STA ERRCODE
PUTS RBERRMSG
LDA #":"
JSR COUT
LDA ERRCODE
JSR ERRPROC
RTS
********************************
* *
* HANDLE ERROR WHEN REQUESTING *
* READ BUFFER *
* *
********************************
OBUFERR STA ERRCODE
PUTS OBERRMSG
LDA #":"
JSR COUT
LDA ERRCODE
JSR ERRPROC
RTS
********************************
* *
* PRINT "IN" BUFFER *
* *
********************************
PRINT_IN
PUSHY
LDA #"X"
JSR COUT
LDA #"="
JSR COUT
TXA
JSR PRBYTE
JSR CROUT
LDY #0
:LOOP CPY #255
BEQ :ENDLOOP
LDA IN,Y
JSR PRBYTE
LDA #" "
JSR COUT
INY
JMP :LOOP
:ENDLOOP JSR CROUT
POPY
RTS
********************************
* *
* PRINT STRING BYTES *
* *
********************************
PRSTRBYTES
PUSHY
LDY #0
:LOOP CPY #255
BEQ :ENDLOOP
LDA FILENAME,Y
JSR PRBYTE
LDA #" "
JSR COUT
INY
JMP :LOOP
:ENDLOOP JSR CROUT
POPY
RTS
2024-01-31 00:11:51 +00:00
********************************
* *
* VIEW FILE SUB *
* *
********************************
VIEWFILE
DO TRACE
2024-02-01 05:17:42 +00:00
>PUTS ENVIEW
2024-01-31 00:11:51 +00:00
FIN
2024-02-04 00:26:06 +00:00
SET1 LINENUM ;INIT LINE NUMBER
2024-02-05 18:14:58 +00:00
:LOOP JSR PRODOS_MLI ;CALL PRODOS TO READ FILE
2024-01-31 00:11:51 +00:00
DB READCMD ;SPECIFY PRODOS READ COMMAND
DA READPRMS ;READ PARAMETERS
2024-02-04 00:26:06 +00:00
BNE :READERR
2024-01-31 00:11:51 +00:00
JSR WRITEBUF ;WRITE TO SCREEN WHAT WAS READ
LDA #1 ;PREPARE FOR NEXT OP
CMP USRQUIT ;IF USER WANTS TO QUIT, THEN
2024-02-04 00:26:06 +00:00
BEQ :ENDLOOP ;EXIT THE LOOP
JMP :LOOP ;ELSE, GET THE NEXT BUFFER
:READERR JSR ERRPROC
:ENDLOOP NOP
2024-01-31 00:11:51 +00:00
RTS
********************************
* *
* WRITE BUFFER TO SCREEN *
* *
********************************
WRITEBUF
2024-02-01 05:17:42 +00:00
>PUSHY
2024-01-31 00:11:51 +00:00
LDY #0 ;INIT CHAR COUNTER VARIABLE
.1 CPY READCNT ;COMPARE TO MAX CHARS
BEQ .3
2024-02-02 03:45:55 +00:00
LDA (ZP.A1L),Y ;GET CHAR FROM BUFFER
2024-01-31 00:11:51 +00:00
ORA #%10000000 ;TURN ON HIGH BIT FOR PRINTING
2024-01-31 00:12:31 +00:00
JSR COUT ;COUT PRESERVES ACCUM
2024-01-31 00:11:51 +00:00
*
* CHECK END OF LINE
*
2024-02-02 03:45:55 +00:00
CMP #CR.HIBIT ;COMPARE TO CARRIAGE RETURN
BNE .2 ;IF NOT END OF LINE, NEXT CHAR
2024-01-31 00:11:51 +00:00
INC LINENUM ;NEXT LINE HAS BEEN REACHED
*
* CHECK AT END OF PAGE
*
LDA LINENUM
2024-02-02 03:45:55 +00:00
CMP #SCR.HGHT ;AT BOTTOM OF SCREEN?
BNE .2 ;NO? THEN NEXT CHAR
2024-01-31 00:11:51 +00:00
JSR STATBAR ;YES? THEN SHOW THE STATUS BAR
LDA #1 ;SETUP FOR NEXT LINE
CMP USRQUIT ;DID USER ASK TO QUIT
BEQ .3 ;YES? THEN END SUB
.2 INY ;STATBAR HAS ADJUSTED LINENUM
JMP .1
2024-02-01 05:17:42 +00:00
.3 >POPY
2024-01-31 00:11:51 +00:00
DO TRACE
2024-02-05 18:14:58 +00:00
PUTS EXWRITEBUF
2024-01-31 00:11:51 +00:00
FIN
RTS
********************************
* *
* PRINT ASCII IN HEX *
* *
********************************
PRASCII PHA
LDA #"["
JSR COUT
PLA
JSR PRBYTE
LDA #"]"
JSR COUT
LDA #" "
JSR COUT
RTS
********************************
* *
* DO THE STATUS BAR *
* *
********************************
STATBAR
2024-02-01 05:17:42 +00:00
DO TRACE
>PUTS ENSTATB
2024-01-31 00:11:51 +00:00
FIN
2024-02-01 05:17:42 +00:00
>PUSHY
>PUTS BAR
.1 JSR RDKEY ;GET A KEY FROM THE USER
CMP #" " ;CHECK IF SPACE ENTERED
BNE .2 ;IF NOT FORWARD TO NEXT CHECK
>SET1 LINENUM ;ADVANCE ONE PAGE, STORE 1
JMP .4 ;PROCESSED SPACE SO DONE
2024-02-02 03:45:55 +00:00
.2 CMP #CR.HIBIT ;CHECK FOR CARRIAGE RETURN
2024-02-01 05:17:42 +00:00
BNE .3
>SET23 LINENUM
JMP .4
.3 CMP #"Q" ;USER WANTS TO QUIT
BNE .1 ;NO RECOGNIZED INPUT
>SET1 USRQUIT
.4 JSR ERASEBAR
>POPY
DO TRACE
>PUTS EXSTATB
2024-01-31 00:11:51 +00:00
FIN
RTS
********************************
* *
* ERASE STATUS BAR *
* *
********************************
ERASEBAR
2024-02-01 05:17:42 +00:00
DO TRACE
>PUTS ENERASEB
2024-01-31 00:11:51 +00:00
FIN
2024-02-01 05:17:42 +00:00
>PUSHY
>SET0 OURCH ;RESET CURSOR TO BEG OF LINE
LDY #0 ;INIT COUNTER FOR SPACES
.1 CPY BAR ;FIRST BYTE IS LENGTH
BEQ .2 ;IF Y=LEN THEN DONE
LDA #" " ;LOAD SPACE
JSR COUT ;WRITE TO SCREEN
INY ;MAKE PROGRESS
JMP .1 ;LOOP TO NEXT CHAR
.2 >SET0 OURCH ;RESET CURSON TO BEG OF LINE
2024-01-31 00:11:51 +00:00
POPY
2024-02-01 05:17:42 +00:00
DO TRACE
>PUTS EXERASEB
2024-01-31 00:11:51 +00:00
FIN
RTS
********************************
* *
* ERROR HANDLER *
2024-02-04 07:33:02 +00:00
* INPUT PARAM: A HOLDS ERRCODE *
2024-01-31 00:11:51 +00:00
* *
********************************
2024-02-04 00:26:06 +00:00
ERRPROC
2024-02-04 07:33:02 +00:00
STA ERRCODE
2024-02-04 00:26:06 +00:00
CMP #0
2024-02-05 18:14:58 +00:00
BNE :EEOF
JMP :END
2024-02-07 08:15:27 +00:00
2024-02-05 18:14:58 +00:00
:EEOF CMP #EOFERR
BNE :E01
JMP :END
2024-02-07 08:15:27 +00:00
2024-02-05 18:14:58 +00:00
:E01 CMP #1
BNE :E04
PUTS E01MSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E04 CMP #4
BNE :E25
PUTS E04MSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E25 CMP #$25
BNE :E27
PUTS E25MSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E27 CMP #$27
BNE :E28
PUTS E27MSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E28 CMP #$28
BNE :E2B
PUTS E28MSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E2B CMP #$2B
BNE :E2E
PUTS E2BMSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E2E CMP #$2E
BNE :E40
PUTS E2EMSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E40 CMP #$40
BNE :E42
PUTS E40MSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E42 CMP #$42
BNE :E43
PUTS E42MSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E43 CMP #$43
BNE :E44
PUTS E43MSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E44 CMP #$44
BNE :E45
PUTS E44MSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E45 CMP #$45
BNE :E46
PUTS E45MSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E46 CMP #$46
BNE :E47
PUTS E46MSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E47 CMP #$47
BNE :E48
PUTS E47MSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E48 CMP #$48
BNE :E49
PUTS E48MSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E49 CMP #$49
BNE :E4A
PUTS E49MSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E4A CMP #$4A
BNE :E4B
PUTS E4AMSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E4B CMP #$4B
BNE :E4C
PUTS E4BMSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E4C CMP #$4C
BNE :E4D
PUTS E4CMSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E4D CMP #$4D
BNE :E4E
PUTS E4DMSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E4E CMP #$4E
BNE :E50
PUTS E4EMSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E50 CMP #$50
BNE :E51
PUTS E50MSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E51 CMP #$51
BNE :E52
PUTS E51MSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E52 CMP #$52
BNE :E53
PUTS E52MSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E53 CMP #$53
BNE :E55
PUTS E53MSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E55 CMP #$55
BNE :E56
PUTS E55MSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E56 CMP #$56
BNE :E57
PUTS E56MSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E57 CMP #$57
BNE :E5A
PUTS E57MSG
2024-02-07 08:15:27 +00:00
JMP :END
2024-02-05 18:14:58 +00:00
:E5A CMP #$5A
BNE :E_UNK
PUTS E5AMSG
JMP :END
2024-02-07 08:15:27 +00:00
2024-02-05 18:14:58 +00:00
:E_UNK PUTS E_UNK_MSG
LDA #":"
JSR COUT
2024-02-04 00:26:06 +00:00
LDA ERRCODE
2024-02-05 18:14:58 +00:00
JSR PRBYTE
:END JSR CROUT
2024-02-04 00:26:06 +00:00
RTS
2024-01-31 00:11:51 +00:00
********************************
* *
* DATA DIVISION HAHA *
* *
********************************
2024-02-10 16:26:12 +00:00
INFOLINE STR "ENTER [?] FOR PROGRAM INFO AND HELP"
INFO0 STR "MORE - PAGES THROUGH TEXT FILE"
INFO1 STR "COPYRIGHT (C) 2024 BILL CHATFIELD"
INFO2 STR "DISTRIBUTED UNDER THE GPL VERSION 3"
INFO3 STR "https://github.com/gungwald/prodos-more"
INFO4 STR "PRESS RETURN TO QUIT"
2024-02-04 07:33:02 +00:00
PROMPT STR "FILE:"
ERRTXT STR "ERROR:"
FILENAME DS $FF
ERRCODE DS 1
LINENUM DS 1
BAR STR '[RET] LINE [SPC] PAGE [Q]UIT'
USRQUIT DS 1
BUFCHAR DS 1
USRCHAR DS 1
2024-01-31 00:11:51 +00:00
2024-02-10 16:26:12 +00:00
OERRMSG STR "CANNOT OPEN "
CERRMSG STR "CANNOT CLOSE "
RBERRMSG STR "CANNOT CREATE READ BUFFER"
OBERRMSG STR "CANNOT CREATE FILE BUFFER"
2024-02-05 18:14:58 +00:00
E00MSG STR "NO ERROR"
E01MSG STR "BAD SYSTEM CALL NUMBER"
E04MSG STR "BAD SYSTEM CALL PARAMETER COUNT"
E25MSG STR "INTERRUPT TABLE FULL"
E27MSG STR "I/O ERROR"
E28MSG STR "NO DEVICE CONNECTED"
E2BMSG STR "DISK WRITE PROTECTED"
E2EMSG STR "DISK SWITCHED"
E40MSG STR "INVALID PATHNAME"
E42MSG STR "MAXIMUM NUMBER OF FILES OPEN"
E43MSG STR "INVALID REFERENCE NUMBER"
E44MSG STR "DIRECTORY NOT FOUND"
E45MSG STR "VOLUME NOT FOUND"
E46MSG STR "FILE NOT FOUND"
E47MSG STR "DUPLICATE FILENAME"
E48MSG STR "VOLUME FULL"
E49MSG STR "VOLUME DIRECTORY FULL"
E4AMSG STR "INCOMPATIBLE FILE FORMAT OR PRODOS DIRECTORY"
E4BMSG STR "UNSUPPORTED STORAGE TYPE"
E4CMSG STR "END OF FILE ENCOUNTERED"
E4DMSG STR "POSITION OUT OF RANGE"
E4EMSG STR "FILE ACCESS ERROR OR FILE LOCKED"
E50MSG STR "FILE IS OPEN"
E51MSG STR "DIRECTORY STRUCTURE DAMAGED"
E52MSG STR "NOT A PRODOS VOLUME"
E53MSG STR "INVALID SYSTEM CALL PARAMETER"
E55MSG STR "VOLUME CONTROL BLOCK TABLE FULL"
E56MSG STR "BAD BUFFER ADDRESS"
E57MSG STR "DUPLICATE VOLUME"
E5AMSG STR "FILE STRUCTURE DAMAGED"
E_UNK_MSG STR "UNKNOWN ERROR CODE"
2024-02-04 21:54:44 +00:00
2024-01-31 00:11:51 +00:00
ENVIEW STR 'ENTERING VIEWFILE'
EXVIEW STR 'EXITING VIEWFILE'
2024-02-05 18:14:58 +00:00
EXWRITEBUF STR 'EXITING WRITEBUF'
2024-01-31 00:11:51 +00:00
ENSTATB STR 'ENTERING STATUSBAR'
EXSTATB STR 'EXITING STATUSBAR'
ENERASEB STR 'ENTERING ERASEBAR'
EXERASEB STR 'EXITING ERASEBAR'
2024-01-31 00:12:31 +00:00
*
2024-01-31 00:11:51 +00:00
* OPEN PARAMETERS
2024-01-31 00:12:31 +00:00
*
2024-02-02 03:45:55 +00:00
OPENPRMS .DA #3
.DA FILENAME
OBUFADDR .BS 2
OPENFNUM .BS 1
2024-01-31 00:12:31 +00:00
*
2024-01-31 00:11:51 +00:00
* READ PARAMETERS
2024-01-31 00:12:31 +00:00
*
2024-02-02 03:45:55 +00:00
READPRMS .DA #4
READFNUM .BS 1
RBADDR .BS 2
REQCNT .DA BUFSIZE
READCNT .BS 2
2024-01-31 00:12:31 +00:00
*
2024-01-31 00:11:51 +00:00
* CLOSE PARAMETERS
2024-01-31 00:12:31 +00:00
*
2024-02-02 03:45:55 +00:00
CLOSPRMS .DA #1
CLOSFNUM .BS 1
2024-01-31 00:12:31 +00:00
*
2024-01-31 00:11:51 +00:00
* BUFFERS
2024-01-31 00:12:31 +00:00
*
2024-01-31 00:11:51 +00:00
* CONSUME ALL BYTES UP TO THE NEXT PAGE BOUNDRY
*FILLER DS \,$00
2024-01-31 00:11:51 +00:00
* MUST START ON PAGE BOUNDRY
2024-02-04 00:26:06 +00:00
*OPENBUF DS 1024
*READBUF DS BUFSIZE