fixes and optimizations of BASIC error reporting
This commit is contained in:
1 parent
f5b4e554ac
commit
6b8c9ded30
8 files changed
+49
-71
No files matched your search
@@ -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
|
|
||||||
@@ -31,7 +31,7 @@ read_line_loop:
|
|||||||
bcc !+
|
bcc !+
|
||||||
// Report STRING TOO LONG error (Computes Mapping the 64 p93)
|
// Report STRING TOO LONG error (Computes Mapping the 64 p93)
|
||||||
ldx #22
|
ldx #22
|
||||||
jmp basic_do_error
|
jmp do_basic_error
|
||||||
!:
|
!:
|
||||||
sta BUF,x
|
sta BUF,x
|
||||||
inx
|
inx
|
||||||
|
|||||||
@@ -61,16 +61,7 @@ cmd_load_got_params: // input for tape wedge
|
|||||||
jsr print_return
|
jsr print_return
|
||||||
pla
|
pla
|
||||||
plp
|
plp
|
||||||
bcc cmd_load_no_error
|
bcs_16 do_kernal_error
|
||||||
|
|
||||||
// .A = KERNAL error code, also almost matches BASIC error codes
|
|
||||||
|
|
||||||
tax
|
|
||||||
dex
|
|
||||||
bpl !+
|
|
||||||
ldx #B_ERR_BREAK
|
|
||||||
!:
|
|
||||||
jmp do_basic_error
|
|
||||||
|
|
||||||
cmd_load_no_error:
|
cmd_load_no_error:
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,22 @@
|
|||||||
// message. This compares favourably to the 3 bytes per error
|
// message. This compares favourably to the 3 bytes per error
|
||||||
// message that the $2C method would result in.
|
// 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:
|
do_NOT_IMPLEMENTED_error:
|
||||||
.byte $E6
|
.byte $E6
|
||||||
do_MEMORY_CORRUPT_error:
|
do_MEMORY_CORRUPT_error:
|
||||||
@@ -107,7 +123,8 @@ do_FILE_OPEN_error:
|
|||||||
do_TO_MANY_FILES_error:
|
do_TO_MANY_FILES_error:
|
||||||
.byte $EA
|
.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
|
lda $E6
|
||||||
pha
|
pha
|
||||||
and #$80
|
and #$80
|
||||||
@@ -121,39 +138,39 @@ do_TO_MANY_FILES_error:
|
|||||||
|
|
||||||
// Restore $EA to correct value in case the NOP above is used
|
// Restore $EA to correct value in case the NOP above is used
|
||||||
// as an argument to the preceeding INC $nn (opcode $E6).
|
// as an argument to the preceeding INC $nn (opcode $E6).
|
||||||
|
|
||||||
lda $EA
|
lda $EA
|
||||||
and #$80
|
and #$80
|
||||||
sta $EA
|
sta $EA
|
||||||
|
|
||||||
// FALL THROUGH
|
// FALLTHROUGH
|
||||||
|
|
||||||
// Error # in X
|
do_basic_error: // error code in .X
|
||||||
|
|
||||||
do_basic_error:
|
|
||||||
// "?"
|
// "?"
|
||||||
txa
|
txa
|
||||||
pha
|
pha
|
||||||
jsr print_return
|
jsr print_return
|
||||||
lda #$3f
|
lda #$3F
|
||||||
jsr JCHROUT
|
jsr JCHROUT
|
||||||
pla
|
pla
|
||||||
tax
|
tax
|
||||||
|
|
||||||
// Error message text
|
// Error message text + " ERROR"
|
||||||
|
|
||||||
jsr print_packed_message
|
jsr print_packed_message
|
||||||
|
|
||||||
// A space between error name and word error
|
|
||||||
jsr print_space
|
|
||||||
|
|
||||||
// "ERROR"
|
|
||||||
ldx #33
|
ldx #33
|
||||||
jsr print_packed_message
|
jsr print_packed_message
|
||||||
|
|
||||||
|
// Check if direct mode
|
||||||
|
|
||||||
lda CURLIN+1
|
lda CURLIN+1
|
||||||
cmp #$ff
|
cmp #$FF
|
||||||
beq !+
|
beq !+
|
||||||
|
|
||||||
// We were in a program, so show IN <line>
|
// We were in a program, so show IN <line>
|
||||||
|
|
||||||
ldx #31
|
ldx #31
|
||||||
jsr print_packed_message
|
jsr print_packed_message
|
||||||
|
|
||||||
@@ -162,10 +179,14 @@ do_basic_error:
|
|||||||
jsr print_integer
|
jsr print_integer
|
||||||
!:
|
!:
|
||||||
// New lines
|
// New lines
|
||||||
|
|
||||||
jsr print_return
|
jsr print_return
|
||||||
lda #$00
|
lda #$00
|
||||||
jsr JCHROUT
|
jsr JCHROUT
|
||||||
|
|
||||||
// XXX - Restore stack depth first?
|
// Reset stack, and go back to main loop
|
||||||
|
|
||||||
|
ldx #$FE
|
||||||
|
txs
|
||||||
|
|
||||||
jmp basic_main_loop
|
jmp basic_main_loop
|
||||||
@@ -28,8 +28,17 @@ consume_character:
|
|||||||
|
|
||||||
// Advance basic text pointer
|
// Advance basic text pointer
|
||||||
|
|
||||||
|
#if !HAS_OPCODES_65CE02
|
||||||
|
|
||||||
inc TXTPTR+0
|
inc TXTPTR+0
|
||||||
bne !+
|
bne !+
|
||||||
inc TXTPTR+1
|
inc TXTPTR+1
|
||||||
!:
|
!:
|
||||||
rts
|
|
||||||
|
#else // HAS_OPCODES_65CE02
|
||||||
|
|
||||||
|
inw TXTPTR
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
rts
|
||||||
@@ -241,9 +241,8 @@ wedge_dos_clean_exit:
|
|||||||
wedge_dos_basic_error:
|
wedge_dos_basic_error:
|
||||||
pha
|
pha
|
||||||
jsr JCLALL
|
jsr JCLALL
|
||||||
plx_trash_a
|
pla
|
||||||
dex
|
jmp do_kernal_error
|
||||||
jmp do_basic_error
|
|
||||||
|
|
||||||
wedge_dos_setnam:
|
wedge_dos_setnam:
|
||||||
// Now determine the length of the 'file' name
|
// Now determine the length of the 'file' name
|
||||||
|
|||||||
@@ -58,8 +58,7 @@ wedge_arrow_H:
|
|||||||
jsr tape_head_align
|
jsr tape_head_align
|
||||||
|
|
||||||
jsr print_return
|
jsr print_return
|
||||||
ldx #B_ERR_BREAK
|
jmp do_BREAK_error
|
||||||
jmp do_basic_error
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ char *error_list[]={
|
|||||||
"BREAK", // #30
|
"BREAK", // #30
|
||||||
" IN ", // #31
|
" IN ", // #31
|
||||||
"BRK AT $", // #32
|
"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
|
" BASIC BYTES FREE", // #34 // https://github.com/stefanhaustein/expressionparser
|
||||||
"MEMORY CORRUPT", // #35
|
"MEMORY CORRUPT", // #35
|
||||||
"NOT IMPLEMENTED", // #36
|
"NOT IMPLEMENTED", // #36
|
||||||
|
|||||||
Reference in new issue
Block a user