small cleanup in BASIC
This commit is contained in:
1 parent
37b32759dc
commit
524d532433
8 files changed
+63
-47
No files matched your search
@@ -15,17 +15,11 @@ cmd_verify:
|
|||||||
cmd_load:
|
cmd_load:
|
||||||
|
|
||||||
lda #$00 // mark operation as LOAD
|
lda #$00 // mark operation as LOAD
|
||||||
sta VERCKB
|
jsr helper_load_init_params
|
||||||
|
|
||||||
// Set default device and secondary address; channel is not important now
|
|
||||||
|
|
||||||
jsr select_device
|
|
||||||
ldy #$00 // secondary address
|
|
||||||
jsr JSETFLS
|
|
||||||
|
|
||||||
// Fetch the file name
|
// Fetch the file name
|
||||||
|
|
||||||
jsr fetch_filename
|
jsr helper_load_fetch_filename
|
||||||
bcs cmd_load_no_filename
|
bcs cmd_load_no_filename
|
||||||
|
|
||||||
// Try to fetch device and secondary address
|
// Try to fetch device and secondary address
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ cmd_save:
|
|||||||
|
|
||||||
// Fetch the file name
|
// Fetch the file name
|
||||||
|
|
||||||
jsr fetch_filename
|
jsr helper_load_fetch_filename
|
||||||
bcs_16 do_MISSING_FILENAME_error
|
bcs_16 do_MISSING_FILENAME_error
|
||||||
|
|
||||||
// Try to fetch device
|
// Try to fetch device
|
||||||
|
|||||||
+3
-4
@@ -7,12 +7,12 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
fetch_filename:
|
helper_load_fetch_filename:
|
||||||
|
|
||||||
// Check if end of statement
|
// Check if end of statement
|
||||||
|
|
||||||
jsr end_of_statement_check
|
jsr end_of_statement_check
|
||||||
bcs fetch_filename_done
|
bcs !+
|
||||||
|
|
||||||
// Call the expression parser, make sure it returned a string
|
// Call the expression parser, make sure it returned a string
|
||||||
|
|
||||||
@@ -37,6 +37,5 @@ fetch_filename:
|
|||||||
|
|
||||||
// FALLTROUGH
|
// FALLTROUGH
|
||||||
|
|
||||||
fetch_filename_done:
|
!:
|
||||||
|
|
||||||
rts
|
rts
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// #LAYOUT# STD * #TAKE
|
||||||
|
// #LAYOUT# * BASIC_0 #TAKE
|
||||||
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
//
|
||||||
|
// Sets initial parameters for LOAD and simiar commands
|
||||||
|
//
|
||||||
|
// Input:
|
||||||
|
// - VERCKB content in .A
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
helper_load_init_params:
|
||||||
|
|
||||||
|
// Set LOAD/VERIFY flag
|
||||||
|
|
||||||
|
sta VERCKB
|
||||||
|
|
||||||
|
// Set default device, set secondary address to 0
|
||||||
|
|
||||||
|
jsr select_device
|
||||||
|
ldy #$00 // secondary address
|
||||||
|
jmp JSETFLS
|
||||||
@@ -14,17 +14,11 @@ cmd_bverify:
|
|||||||
cmd_bload:
|
cmd_bload:
|
||||||
|
|
||||||
lda #$00 // mark operation as LOAD
|
lda #$00 // mark operation as LOAD
|
||||||
sta VERCKB
|
jsr helper_load_init_params
|
||||||
|
|
||||||
// Set default device and secondary address; channel is not important now
|
|
||||||
|
|
||||||
jsr select_device
|
|
||||||
ldy #$00 // secondary address 0 - it has to be loaded precisely where we want
|
|
||||||
jsr JSETFLS
|
|
||||||
|
|
||||||
// Fetch the file name
|
// Fetch the file name
|
||||||
|
|
||||||
jsr fetch_filename
|
jsr helper_load_fetch_filename
|
||||||
bcc !+
|
bcc !+
|
||||||
|
|
||||||
// No filename supplied - this should only be allowed for tape (device number below 8)
|
// No filename supplied - this should only be allowed for tape (device number below 8)
|
||||||
|
|||||||
@@ -6,17 +6,11 @@
|
|||||||
cmd_merge:
|
cmd_merge:
|
||||||
|
|
||||||
lda #$00 // mark operation as LOAD
|
lda #$00 // mark operation as LOAD
|
||||||
sta VERCKB
|
jsr helper_load_init_params
|
||||||
|
|
||||||
// Set default device and secondary address; channel is not important now
|
|
||||||
|
|
||||||
jsr select_device
|
|
||||||
ldy #$00 // secondary address 0 - it has to be loaded precisely where we want
|
|
||||||
jsr JSETFLS
|
|
||||||
|
|
||||||
// Fetch the file name
|
// Fetch the file name
|
||||||
|
|
||||||
jsr fetch_filename
|
jsr helper_load_fetch_filename
|
||||||
bcc !+
|
bcc !+
|
||||||
|
|
||||||
// No filename supplied - this should only be allowed for tape (device number below 8)
|
// No filename supplied - this should only be allowed for tape (device number below 8)
|
||||||
@@ -30,7 +24,7 @@ cmd_merge:
|
|||||||
!:
|
!:
|
||||||
// Fetch device number
|
// Fetch device number
|
||||||
|
|
||||||
jsr fetch_device_secondary_uint8
|
jsr fetch_coma_uint8
|
||||||
bcs !+
|
bcs !+
|
||||||
|
|
||||||
sta FA
|
sta FA
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ fetch_device_secondary:
|
|||||||
|
|
||||||
// Fetch the device number
|
// Fetch the device number
|
||||||
|
|
||||||
jsr fetch_device_secondary_uint8
|
jsr fetch_coma_uint8
|
||||||
bcs fetch_device_secondary_done
|
bcs fetch_device_secondary_done
|
||||||
|
|
||||||
sta FA
|
sta FA
|
||||||
@@ -22,7 +22,7 @@ fetch_secondary:
|
|||||||
|
|
||||||
// Fetch secondary address
|
// Fetch secondary address
|
||||||
|
|
||||||
jsr fetch_device_secondary_uint8
|
jsr fetch_coma_uint8
|
||||||
bcs fetch_device_secondary_done
|
bcs fetch_device_secondary_done
|
||||||
|
|
||||||
sta SA
|
sta SA
|
||||||
@@ -32,18 +32,3 @@ fetch_secondary:
|
|||||||
fetch_device_secondary_done:
|
fetch_device_secondary_done:
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
fetch_device_secondary_uint8: // also called by 'cmd_merge'
|
|
||||||
|
|
||||||
jsr injest_comma
|
|
||||||
bcs !+
|
|
||||||
|
|
||||||
jsr injest_spaces
|
|
||||||
jsr basic_parse_line_number
|
|
||||||
lda LINNUM+1
|
|
||||||
bne_16 do_ILLEGAL_QUANTITY_error
|
|
||||||
lda LINNUM+0
|
|
||||||
clc
|
|
||||||
!:
|
|
||||||
rts
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
// #LAYOUT# STD * #TAKE
|
||||||
|
// #LAYOUT# * BASIC_0 #TAKE
|
||||||
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fetches 8-bit unsigned integer
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
fetch_coma_uint8:
|
||||||
|
|
||||||
|
jsr injest_comma
|
||||||
|
bcs !+
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
fetch_uint8:
|
||||||
|
|
||||||
|
jsr injest_spaces
|
||||||
|
jsr basic_parse_line_number
|
||||||
|
// XXX this should also detect errors
|
||||||
|
lda LINNUM+1
|
||||||
|
bne_16 do_ILLEGAL_QUANTITY_error
|
||||||
|
lda LINNUM+0
|
||||||
|
clc
|
||||||
|
!:
|
||||||
|
rts
|
||||||
Reference in new issue
Block a user