fixes and optimizations of BASIC error reporting

This commit is contained in:
FeralChild64 committed 2020-06-06 12:57:03 +02:00
1 parent f5b4e554ac
commit 6b8c9ded30
8 files changed
+49 -71

No files matched your search

-41
View File
@@ -1,41 +0,0 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
// Computes Mapping the 64 p93
basic_do_error:
// Save error number
phx_trash_a
#if ROM_LAYOUT_M65
// Restore normal memory map
jsr map_NORMAL
#endif
// Print ? at start
jsr print_return
lda #$3F
jsr JCHROUT
// Print main part of error message
plx_trash_a
jsr print_packed_message
// Print ERROR at end
jsr print_space
ldx #33
jsr print_packed_message
// XXX print IN if not in direct mode
// XXX print line number if not in direct mode
jsr print_return
jsr print_return
// Reset stack, and go back to main loop
ldx #$FE
txs
jmp basic_main_loop
+1 -1
View File
@@ -31,7 +31,7 @@ read_line_loop:
bcc !+
// Report STRING TOO LONG error (Computes Mapping the 64 p93)
ldx #22
jmp basic_do_error
jmp do_basic_error
!:
sta BUF,x
inx
+1 -10
View File
@@ -61,16 +61,7 @@ cmd_load_got_params: // input for tape wedge
jsr print_return
pla
plp
bcc cmd_load_no_error
// .A = KERNAL error code, also almost matches BASIC error codes
tax
dex
bpl !+
ldx #B_ERR_BREAK
!:
jmp do_basic_error
bcs_16 do_kernal_error
cmd_load_no_error:
@@ -32,6 +32,22 @@
// message. This compares favourably to the 3 bytes per error
// message that the $2C method would result in.
do_kernal_error: // .A = KERNAL error code, also almost matches BASIC error codes
// Convert to BASIC error code
tax
dex
bpl do_basic_error
// FALLTROUGN
do_BREAK_error:
ldx #B_ERR_BREAK
bpl do_basic_error // branch always
do_NOT_IMPLEMENTED_error:
.byte $E6
do_MEMORY_CORRUPT_error:
@@ -107,7 +123,8 @@ do_FILE_OPEN_error:
do_TO_MANY_FILES_error:
.byte $EA
// Now get the error # and restore $E6 to its correct value
// Now get the error id and restore $E6 to its correct value
lda $E6
pha
and #$80
@@ -121,39 +138,39 @@ do_TO_MANY_FILES_error:
// Restore $EA to correct value in case the NOP above is used
// as an argument to the preceeding INC $nn (opcode $E6).
lda $EA
and #$80
sta $EA
// FALL THROUGH
// FALLTHROUGH
// Error # in X
do_basic_error: // error code in .X
do_basic_error:
// "?"
txa
pha
jsr print_return
lda #$3f
lda #$3F
jsr JCHROUT
pla
tax
// Error message text
// Error message text + " ERROR"
jsr print_packed_message
// A space between error name and word error
jsr print_space
// "ERROR"
ldx #33
jsr print_packed_message
// Check if direct mode
lda CURLIN+1
cmp #$ff
cmp #$FF
beq !+
// We were in a program, so show IN <line>
ldx #31
jsr print_packed_message
@@ -162,10 +179,14 @@ do_basic_error:
jsr print_integer
!:
// New lines
jsr print_return
lda #$00
jsr JCHROUT
// XXX - Restore stack depth first?
// Reset stack, and go back to main loop
ldx #$FE
txs
jmp basic_main_loop
+10 -1
View File
@@ -28,8 +28,17 @@ consume_character:
// Advance basic text pointer
#if !HAS_OPCODES_65CE02
inc TXTPTR+0
bne !+
inc TXTPTR+1
!:
rts
#else // HAS_OPCODES_65CE02
inw TXTPTR
#endif
rts
+2 -3
View File
@@ -241,9 +241,8 @@ wedge_dos_clean_exit:
wedge_dos_basic_error:
pha
jsr JCLALL
plx_trash_a
dex
jmp do_basic_error
pla
jmp do_kernal_error
wedge_dos_setnam:
// Now determine the length of the 'file' name
+1 -2
View File
@@ -58,8 +58,7 @@ wedge_arrow_H:
jsr tape_head_align
jsr print_return
ldx #B_ERR_BREAK
jmp do_basic_error
jmp do_BREAK_error
#endif
+1 -1
View File
@@ -162,7 +162,7 @@ char *error_list[]={
"BREAK", // #30
" IN ", // #31
"BRK AT $", // #32
"ERROR", // #33 // Simply the word error that is attached to the other parts of messages https://fjkraan.home.xs4all.nl/comp/apple2faq/app2asoftfaq.html
" ERROR", // #33 // Simply the word error that is attached to the other parts of messages https://fjkraan.home.xs4all.nl/comp/apple2faq/app2asoftfaq.html
" BASIC BYTES FREE", // #34 // https://github.com/stefanhaustein/expressionparser
"MEMORY CORRUPT", // #35
"NOT IMPLEMENTED", // #36