Tried to use CR sub buit it didn't work

This commit is contained in:
Bill Chatfield 2024-02-25 13:53:21 -05:00
parent 8ace07d469
commit 0add3cc9d7

View File

@ -38,79 +38,80 @@
* BVC - BRANCH OVERVLOW CLEAR (V=0) * BVC - BRANCH OVERVLOW CLEAR (V=0)
* BVS - BRANCH OVERFLOW SET (V=1) * BVS - BRANCH OVERFLOW SET (V=1)
DSK MORE ;WRITE ASSEMBLED FILE TO DISK DSK MORE ;WRITE ASSEMBLED FILE TO DISK
TYP $06 ;$FF=SYSTEM, $06=BINARY TYP $06 ;$FF=SYSTEM, $06=BINARY
ORG $2000 ;ASSEMBLE START ADDRESS ORG $2000 ;ASSEMBLE START ADDRESS
* *
* SYSTEM VARIABLES * SYSTEM VARIABLES
* *
PTR EQU $06 ;ONLY FREE 0-PAGE LOCATION PTR EQU 06 ;ONLY FREE 0-PAGE LOCATION
CH EQU $24 ;40-COL HORZ CURS POSITION CH EQU $24 ;40-COL HORZ CURS POSITION
CV EQU $25 ;40-COL VERT CURS POSITION CV EQU $25 ;40-COL VERT CURS POSITION
PROMPT EQU $33 ;PROMPT CHARACTER PROMPT EQU $33 ;PROMPT CHARACTER
ZP_A1L EQU $3C ;MONITOR GENERAL PURPOSE ZP_A1L EQU $3C ;MONITOR GENERAL PURPOSE
ZP_A1H EQU $3D ;MONITOR GENERAL PURPOSE ZP_A1H EQU $3D ;MONITOR GENERAL PURPOSE
IN EQU $200 ;256-CHAR INPUT BUF IN EQU $200 ;256-CHAR INPUT BUF
* *
* SLOT 3 SCRATCHPAD RAM - TEXT PAGE 0 SCREEN HOLE * SLOT 3 SCRATCHPAD RAM - TEXT PAGE 0 SCREEN HOLE
* http://yesterbits.com/media/books/apple/heiserman-1983-intermediate-level-apple-ii-handbook.pdf * http://yesterbits.com/media/books/apple/heiserman-1983-intermediate-level-apple-ii-handbook.pdf
* *
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
* *
* SUBROUTINES IN MONITOR ROM: $F800 - $FFFF * SUBROUTINES IN MONITOR ROM: $F800 - $FFFF
* *
RDKEY EQU $FD0C ;READS A CHARACTER CR EQU $FC62 ;CURSOR TO BEG OF NEXT LINE
GETLN EQU $FD6A ;READS A LINE, WITH PROMPT($33) RDKEY EQU $FD0C ;READS A CHARACTER
GETLN1 EQU $FD6F ;READS A LINE, NO PROMPT GETLN EQU $FD6A ;READS A LINE, WITH PROMPT($33)
CROUT EQU $FD8E GETLN1 EQU $FD6F ;READS A LINE, NO PROMPT
COUT EQU $FDED CROUT EQU $FD8E
PRBYTE EQU $FDDA COUT EQU $FDED
PRBYTE EQU $FDDA
* *
* SUBROUTINES IN BASIC.SYSTEM ROM: * SUBROUTINES IN BASIC.SYSTEM ROM:
* *
GETBUFR EQU $BEF5 ;BCC=OKAY & A=HIBYTE OF BUF GETBUFR EQU $BEF5 ;BCC=OKAY & A=HIBYTE OF BUF
;BCS=FAIL & A=ERRCODE ;BCS=FAIL & A=ERRCODE
;X & Y ARE DESTROYED ;X & Y ARE DESTROYED
FREEBUFR EQU $BEF8 ;FREE BUFFER FREEBUFR EQU $BEF8 ;FREE BUFFER
* *
* PRODOS ENTRY POINT * PRODOS ENTRY POINT
* *
PRODOS_MLI EQU $BF00 ;MACHINE LANG IFACE (MLI) PRODOS_MLI EQU $BF00 ;MACHINE LANG IFACE (MLI)
* *
* MEMORY MAPPED I/O: $C000 - $CFFF * MEMORY MAPPED I/O: $C000 - $CFFF
* *
RD80VID EQU $C01F ;<=128->40COL, >128->80COL RD80VID EQU $C01F ;<=128->40COL, >128->80COL
* *
* PRODOS COMMAND CODES * PRODOS COMMAND CODES
* *
GET_PREFIX EQU $C7 GET_PREFIX EQU $C7
OPEN EQU $C8 OPEN EQU $C8
READ EQU $CA READ EQU $CA
CLOSE EQU $CC CLOSE EQU $CC
* *
* PRODOS MLI PARAMETER COUNTS * PRODOS MLI PARAMETER COUNTS
* *
GETPRFXPARMCNT EQU 1 GETPRFXPARMCNT EQU 1
OPENPARMCNT EQU 3 OPENPARMCNT EQU 3
READPARMCNT EQU 4 READPARMCNT EQU 4
CLOSEPARMCNT EQU 1 CLOSEPARMCNT EQU 1
* *
* ASCII * ASCII
* *
CR EQU $0D ;ASCII CARRIAGE RETURN CR_CHAR EQU $0D ;ASCII CARRIAGE RETURN
CR_HIBIT EQU $8D ;CARRIAGE RET WITH HIGH BIT SET CR_HIBIT EQU $8D ;CARRIAGE RET WITH HIGH BIT SET
* *
* CONSTANTS * CONSTANTS
* *
EOFERR EQU $4C ;ERROR CODE FOR END-OF-FILE EOFERR EQU $4C ;ERROR CODE FOR END-OF-FILE
MAXERCDE EQU $5A ;LARGEST ERROR CODE MAXERCDE EQU $5A ;LARGEST ERROR CODE
BUFSIZE EQU $00FF BUFSIZE EQU $00FF
SCR_HGHT EQU 24 ;SCREEN HEIGHT SCR_HGHT EQU 24 ;SCREEN HEIGHT
* *
* DEBUGGING * DEBUGGING
* *
TRACE EQU 0 TRACE EQU 0
******************************** ********************************
* * * *
@ -153,7 +154,7 @@ CPIN MAC
LOOP CPY ]1 ;COMPARE Y WITH LENGTH BYTE LOOP CPY ]1 ;COMPARE Y WITH LENGTH BYTE
BEQ ENDLOOP ;DONE IF LENGTH IS REACHED BEQ ENDLOOP ;DONE IF LENGTH IS REACHED
LDA IN,Y ;LOAD IN[Y] INTO ACCUMULATOR LDA IN,Y ;LOAD IN[Y] INTO ACCUMULATOR
CMP #CR ;COMPARE WITH CARRIAGE RETURN CMP #CR_CHAR ;COMPARE WITH CARRIAGE RETURN
BEQ ENDLOOP ;STOP AT CARRIAGE RETURN BEQ ENDLOOP ;STOP AT CARRIAGE RETURN
INY ;DEST STR IS 1 AHEAD OF IN BUF INY ;DEST STR IS 1 AHEAD OF IN BUF
STA ]1,Y ;COPY CHAR TO DEST STR ]1 STA ]1,Y ;COPY CHAR TO DEST STR ]1
@ -350,6 +351,7 @@ GET_SCRN_WDTH LDA #128
JMP :END JMP :END
:EIGHTY_COLUMNS LDA #80 :EIGHTY_COLUMNS LDA #80
STA SCR_WDTH STA SCR_WDTH
JSR PRBYTE
:END NOP :END NOP
RTS RTS
@ -504,6 +506,7 @@ VIEWFILE
PUTS ENVIEW PUTS ENVIEW
FIN FIN
COPY_B SCRNLINE;#1 ;INIT SCREEN LINE NUMBER
COPY_B LINEIDX;#1 ;POSITION IN LINE COPY_B LINEIDX;#1 ;POSITION IN LINE
:LOOP JSR PRODOS_MLI ;CALL PRODOS TO READ FILE :LOOP JSR PRODOS_MLI ;CALL PRODOS TO READ FILE
DB READ ;SPECIFY PRODOS READ COMMAND DB READ ;SPECIFY PRODOS READ COMMAND
@ -534,7 +537,7 @@ WRITEBUF PUSHY
* *
* CHECK AT END OF PAGE * CHECK AT END OF PAGE
* *
LDA CV ;CURSOR VERTICAL SCREEN LINE LDA SCRNLINE ;CURSOR VERTICAL SCREEN LINE
CMP #SCR_HGHT ;AT BOTTOM OF SCREEN? CMP #SCR_HGHT ;AT BOTTOM OF SCREEN?
BNE :CONT ;NO? THEN NEXT CHAR BNE :CONT ;NO? THEN NEXT CHAR
JSR STATBAR ;YES? THEN SHOW THE STATUS BAR JSR STATBAR ;YES? THEN SHOW THE STATUS BAR
@ -556,22 +559,30 @@ WRITEBUF PUSHY
* * * *
* WRITE CHAR TO SCREEN * * WRITE CHAR TO SCREEN *
* CLIPS TO SCREEN WIDTH * * CLIPS TO SCREEN WIDTH *
* PRESERVES ACCUMULATOR *
* * * *
******************************** ********************************
WRITECHAR STA CHAR ;DON'T LOOSE THE CHARACTER WRITECHAR STA CHAR ;DON'T LOOSE THE CHARACTER
CMP #CR_HIBIT ;COMPARE TO CARRIAGE RETURN CMP #CR_HIBIT ;COMPARE TO CARRIAGE RETURN
BNE :NOT_EOL ;IF NOT END OF LINE, PRINT BNE :NOT_EOL ;IF NOT END OF LINE, PRINT
INC CV ;FORCE DOWN 1 LINE ON SCREEN JSR DOWN1LINE
COPY_B LINEIDX;#1 ;RESET TO BEGINNING OF LINE
JMP :ENDSUB ;NOTHING MORE TO DO FOR EOL JMP :ENDSUB ;NOTHING MORE TO DO FOR EOL
:NOT_EOL LDA LINEIDX ;GET CURSOR HORIZ COL :NOT_EOL LDA LINEIDX ;GET CURSOR HORIZ COL
CMP SCR_WDTH ;COMPARE WITH SCREEN WIDTH CMP SCR_WDTH ;COMPARE WITH SCREEN WIDTH
BPL :ENDSUB ;DON'T PRINT IF OFF SCREEN BPL :FORWARD ;DON'T PRINT IF OFF SCREEN
LDA CHAR ;ON SCREEN, SO PRINT IT LDA CHAR ;ON SCREEN, SO PRINT IT
JSR COUT JSR COUT
INC LINEIDX :FORWARD INC LINEIDX
:ENDSUB LDA CHAR :ENDSUB RTS
********************************
* *
* GO TO BEGINNING OF NEXT LINE *
* *
********************************
DOWN1LINE INC SCRNLINE ;KEEP TRACK OF LINE NUMBER
COPY_B LINEIDX;#1 ;RESET TO BEGINNING OF LINE
;COPY_B OURCH;#0
JSR CROUT ;LINE DOWN & SCROLL IF NEEDED
RTS RTS
******************************** ********************************
@ -607,11 +618,11 @@ STATBAR
:LOOP JSR RDKEY ;GET A KEY FROM THE USER :LOOP JSR RDKEY ;GET A KEY FROM THE USER
CMP #" " ;CHECK IF SPACE ENTERED CMP #" " ;CHECK IF SPACE ENTERED
BNE :CHKCR ;IF NOT FORWARD TO NEXT CHECK BNE :CHKCR ;IF NOT FORWARD TO NEXT CHECK
SET1 LINENUM ;ADVANCE ONE PAGE, STORE 1 SET1 SCRNLINE ;ADVANCE ONE PAGE, STORE 1
JMP :ENDLOOP ;PROCESSED SPACE SO DONE JMP :ENDLOOP ;PROCESSED SPACE SO DONE
:CHKCR CMP #CR_HIBIT ;CHECK FOR CARRIAGE RETURN :CHKCR CMP #CR_HIBIT ;CHECK FOR CARRIAGE RETURN
BNE :CHKQUIT BNE :CHKQUIT
SET23 LINENUM SET23 SCRNLINE
JMP :ENDLOOP JMP :ENDLOOP
:CHKQUIT CMP #"Q" ;USER WANTS TO QUIT :CHKQUIT CMP #"Q" ;USER WANTS TO QUIT
BEQ :QUITTING ;NO RECOGNIZED INPUT BEQ :QUITTING ;NO RECOGNIZED INPUT
@ -844,7 +855,7 @@ ERRTXT STR "ERROR:"
FILENAME DS $FF FILENAME DS $FF
PREFIX DS 64 PREFIX DS 64
ERRCODE DS 1 ERRCODE DS 1
LINENUM DS 1 SCRNLINE DS 1
LINEIDX DS 1 LINEIDX DS 1
CHAR DS 1 CHAR DS 1
BAR STR '[RET] LINE [SPC] PAGE [Q]UIT' BAR STR '[RET] LINE [SPC] PAGE [Q]UIT'