LOAD command understands device number and secondary address

This commit is contained in:
FeralChild64 committed 2019-07-20 17:59:24 +02:00
1 parent 2613553ef3
commit c7727d4f0f
3 files changed
+60 -11

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@ Here are the features of the Open ROMs not found in the original ROMs from the 8
* banking in the BASIC interpreter: 61436 bytes free
* LOAD start/end addresses are displayed, in the Final cartridge style
* LOAD command with just the file name tries to use the last device if it's number seems sane; otherwise uses 8
* LOAD secondary address over 255 is considered a start address; NOTE: syntax will most likely change here in the future!
# Features missing
+39 -10
View File
@@ -19,10 +19,6 @@ cmd_load:
lda #$00 ; direct mode - don't display anything
*
jsr JSETMSG
;; XXX handle device number from arguments, if not present, use the call below
jsr select_device
stx current_device_number
;; Set filename and length
lda #$00
@@ -47,7 +43,7 @@ cmd_load:
;; Now search for end of line or closing quote
;; so that we know the length of the filename
getting_filename:
getting_filename:
jsr basic_fetch_and_consume_character
cmp #$22
beq got_filename
@@ -60,15 +56,48 @@ getting_filename:
inc FNLEN
jmp getting_filename
got_filename:
got_filename:
;; Try to load an IEC file
lda #0 ; use supplied load address, not the one from the file
;; Now fetch the file number, start from the default one
jsr select_device
stx current_device_number
jsr injest_comma
bcs got_devicenumber
jsr basic_parse_line_number
lda basic_line_number+1
bne do_ILLEGAL_QUANTITY_error
lda basic_line_number+0
sta current_device_number
got_devicenumber:
;; Now fetch the secondary address
lda #$00
sta current_secondary_address
lda #$00 ; LOAD not verify
ldx #<$0801 ; LOAD address = $0801
jsr injest_comma
bcs got_secondaryaddress
jsr basic_parse_line_number
lda basic_line_number+1
bne +
lda basic_line_number+0
sta current_secondary_address
jmp got_secondaryaddress
*
;; Second parameter is above 255, this can't be a secondary address
;; Use it as load address instead
;; XXX temporary syntax, it would be better to use something
;; XXX like 'LOAD"FILE",8 TO 49152'
ldx basic_line_number+0
ldy basic_line_number+1
bne got_loadaddress
got_secondaryaddress:
ldx #<$0801
ldy #>$0801
got_loadaddress:
lda #$00 ; LOAD not verify
jsr JLOAD
bcc +
+20
View File
@@ -0,0 +1,20 @@
;; Consummes a comma in a BASIC code, C set for no coma found
injest_comma:
jsr basic_fetch_and_consume_character
cmp #$2C ; comma character
beq injest_comma_found
cmp #$20
beq injest_comma ; space, can always be skipped
;; not found
jsr basic_unconsume_character
sec
rts
injest_comma_found:
clc
rts