refactored LOAD routine so that it's parts are reuseable

This commit is contained in:
FeralChild64 committed 2019-07-19 17:23:11 +02:00
1 parent 66047996bb
commit da4cc3a89b
12 files changed
+269 -231

No files matched your search

+1 -31
View File
@@ -52,33 +52,13 @@
.alias memmove_dst $6b
.alias memmove_size $6d
.alias TXTTAB $2B
.alias IOSTATUS $90
; Keys down clears bits. STOP=bit 7, C= bit 6, SPACE bit 4, CTRL bit 2
.alias BUCKYSTATUS $91
.alias load_or_verify_flag $93
.alias C3PO $94 ; flag - is BSOUR content valid
.alias BSOUR $95 ; serial bus buffered output byte
.alias current_file_num $98
.alias LDTND $98 ; number of entries in LAT / FAT / SAT tables
.alias DFLTN $99
.alias input_device_number DFLTN
.alias MSGFLG $9D ; bit 6 = error messages, bit 7 = control message
.alias jiffy_clock_24bits $a0
.alias cassette_buffer_bytes_used $A6
.alias load_or_scroll_temp_pointer $AC
;; We also use the following for temp colour pointer when scrolling
.alias load_save_verify_end_address $AE
;; 2-byte location below seems to be a good place for temporary storage,
;; it seems used for timing during tape reads only - see:
;; - 'C64 Programmer's Reference Guide', page 314
;; - 'Compute's Mapping the Commodore 64', page 32
.alias CMP0 $B0 ;; $B0-$B1
.alias cassette_buffer_ptr $B2
.alias current_filename_length $B7
.alias current_logical_filenum $B8
.alias current_secondary_address $B9
.alias current_device_number $BA
@@ -112,19 +92,11 @@
.alias rs232_tx_buffer_ptr $F9
.alias basic_input_buffer $0200
;; Kernal tables for opened files, 10 entries each
.alias LAT $0259 ; logical file numbers
.alias FAT $0263 ; device numbers
.alias SAT $026D ; secondary addresses
; "Compute's Mapping the 64" book
.alias keyboard_buffer $0277
.alias MEMSTR $0281
.alias MEMSIZ $0283 ; NOTE: Mapping the 64 erroniously has the hex as $282, while the DEC is correct
.alias text_colour $0286 ; p55
.alias colour_under_cursor $0287 ; p56
.alias HIBASE $0288 ; p56 (high byte of start of screen)
.alias key_buffer_size $0289 ; p57
;; 0 = cursor keys, insert, delete and space repeat, but nothing else
@@ -140,8 +112,6 @@
.alias keyboard_decoding_ptr $028F
.alias enable_case_switch $0291
.alias screen_scroll_disable $0292
.alias RSSTAT $0297 ; RS-232 status
.alias pal_or_ntsc $02A6
;; BASIC uses some extra bytes for memory access under ROMs located at $2A7 onwards
;; IRQs are disabled when doing such accesses, and a default NMI handler only increments
+1 -1
View File
@@ -29,7 +29,7 @@ no_space_to_skip:
basic_execute_statement:
;; Check for RUN/STOP
lda BUCKYSTATUS
lda STKEY
bpl basic_do_break
;; Skip over any white space and :
+1 -1
View File
@@ -22,7 +22,7 @@ list_loop:
jmp basic_main_loop
list_more_lines:
lda BUCKYSTATUS
lda STKEY
bmi +
jmp basic_do_break
*
+2 -2
View File
@@ -26,7 +26,7 @@ cmd_load:
;; Set filename and length
lda #$00
sta current_filename_length
sta FNLEN
;; Without tape support, LOAD must have a filename
;; (This also skips any leading spaces)
@@ -57,7 +57,7 @@ getting_filename:
jmp got_filename
*
inc current_filename_length
inc FNLEN
jmp getting_filename
got_filename:
+9 -9
View File
@@ -10,22 +10,22 @@ cmd_sys:
jsr basic_parse_line_number
;; setup call
lda #$4c ;JMP
sta sys_jmp
lda #$4C ;JMP
sta USRPOK
lda basic_line_number+0
sta sys_jmp+1
sta USRADD+0
lda basic_line_number+1
sta sys_jmp+2
sta USRADD+1
;; Setup the register values
lda sys_reg_p
lda SPREG
pha
ldy sys_reg_y
ldx sys_reg_x
lda sys_reg_a
ldy SYREG
ldx SXREG
lda SAREG
plp
;; Call the routine.
jsr sys_jmp
jsr USRPOK
jmp basic_execute_statement