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

@ -44,7 +44,7 @@
* *
* 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
@ -60,6 +60,7 @@ OURCV EQU $05FB ;VERTICAL CURSOR POSITION
* *
* SUBROUTINES IN MONITOR ROM: $F800 - $FFFF * SUBROUTINES IN MONITOR ROM: $F800 - $FFFF
* *
CR EQU $FC62 ;CURSOR TO BEG OF NEXT LINE
RDKEY EQU $FD0C ;READS A CHARACTER RDKEY EQU $FD0C ;READS A CHARACTER
GETLN EQU $FD6A ;READS A LINE, WITH PROMPT($33) GETLN EQU $FD6A ;READS A LINE, WITH PROMPT($33)
GETLN1 EQU $FD6F ;READS A LINE, NO PROMPT GETLN1 EQU $FD6F ;READS A LINE, NO PROMPT
@ -98,7 +99,7 @@ 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
@ -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'