LIST command is now more foolproof

This commit is contained in:
FeralChild64 committed 2020-06-28 17:25:40 +02:00
1 parent c88cce6045
commit ba704cc5a7
5 files changed
+76 -11

No files matched your search

+1
View File
@@ -22,6 +22,7 @@ Here are the features of the Open ROMs not found in the original ROMs from the 8
* start/end addresses are displayed, in the Final cartridge style
* command with just the file name tries to use the last device if it's number seems sane; otherwise uses 8
* command without parameters tries to load first file from drive chosen as above
* `LIST` command should never damage the screen if trying to list memory content which is not a BASIC program
* uses RAM under ROM and I/O: 51199 bytes free (up to `$CFFF`) by default, but 61438 is also possible
* cold/warm start silences multiple SID chips
+1
View File
@@ -10,6 +10,7 @@
// print string routine
STROUT:
// Setup pointer
sty FRESPC+1
sta FRESPC+0
+9
View File
@@ -0,0 +1,9 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
// String - question mark in reverse
str_rev_question:
.byte $12, $3F, $92, $00
+1
View File
@@ -23,3 +23,4 @@
.label print_features = BASIC_0.proxy_B1_print_features
#endif
.label do_STRING_TOO_LONG_error = BASIC_0.do_STRING_TOO_LONG_error
.label str_rev_question = BASIC_0.str_rev_question
+64 -11
View File
@@ -67,7 +67,9 @@ list_print_loop:
lda (OLDTXT),y
#endif
beq list_end_of_line
bne !+
rts // end of line
!:
cmp #$22
bne list_not_quote
lda QTSW
@@ -118,6 +120,10 @@ list_display_token_CC:
// Subtract $1 from token to get offset in token list
dex
// Check if token is known
cpx #TK__MAXTOKEN_keywords_CC
bcs list_display_unknown_token // XXX consider displaying two question marks here
// Now ask for it to be printed
jsr print_packed_keyword_CC
@@ -156,6 +162,10 @@ list_display_token_CD:
// Subtract $1 from token to get offset in token list
dex
// Check if token is known
cpx #TK__MAXTOKEN_keywords_CD
bcs list_display_unknown_token // XXX consider displaying two question marks here
// Now ask for it to be printed
jsr print_packed_keyword_CD
@@ -174,9 +184,13 @@ list_display_token_V2:
// Subtract $80 from token to get offset in token list
txa
and #$7f
and #$7F
tax
// Check if token is known
cpx #TK__MAXTOKEN_keywords_V2
bcs list_display_unknown_token
// Now ask for it to be printed
jsr print_packed_keyword_V2
@@ -188,12 +202,14 @@ list_token_displayed:
ply_trash_a
pla
cmp #$8f
cmp #$8F
bne list_not_rem
// REM command locks quote flag on until the end of the line, allowing
// funny characters in REM statements without problem.
sta QTSW // Any value other than $00 or $FF will lock quote mode on, so the token value of REM is fine here
// FALL THROUGH
// FALLTHROUGH
list_not_rem:
iny
@@ -205,13 +221,50 @@ list_is_pi:
// FALLTROUGH
list_is_literal:
jsr JCHROUT
iny
bne list_print_loop
list_end_of_line:
rts
pha
and #$7F
cmp #$12
beq list_is_literal_known // branch if quote mode on/off
and #%01100000
bne list_is_literal_known
pla
// FALLTROUGH
list_is_unknown:
phy_trash_a
lda #<str_rev_question
ldy #>str_rev_question
jsr STROUT
ply_trash_a
#if HAS_OPCODES_65C02
bra !+
#else
jmp !+
#endif
list_is_literal_known:
pla
jsr JCHROUT
!:
iny
bne_16 list_print_loop
rts // end of line
list_display_unknown_token:
pla
pla
#if HAS_OPCODES_65C02
bra list_is_unknown
#else
jmp list_is_unknown
#endif
#endif // ROM layout