more work towards making LOAD command accept filename
This commit is contained in:
1 parent
2824abafd9
commit
4958ad696f
5 files changed
+147
-28
No files matched your search
@@ -17,6 +17,17 @@ cmd_load:
|
||||
lda #$00 ; LOAD not verify
|
||||
ldx #<$0801 ; LOAD address = $0801
|
||||
ldy #>$0801
|
||||
|
||||
;; Set filename and length
|
||||
lda #$24
|
||||
sta $0400
|
||||
lda #$01
|
||||
sta current_filename_length
|
||||
lda #<$0400
|
||||
sta current_filename_ptr+0
|
||||
lda #>$0401
|
||||
sta current_filename_ptr+1
|
||||
|
||||
jsr $ffd5
|
||||
bcc +
|
||||
|
||||
|
||||
@@ -23,9 +23,45 @@ install_ram_routines:
|
||||
|
||||
ram_routines_start:
|
||||
|
||||
;; XXX - Routine order must match that of the KERNAL version of the file.
|
||||
;; (since it has fewer routines)
|
||||
tiny_nmi_handler_routine:
|
||||
inc missed_nmi_flag
|
||||
rti
|
||||
peek_under_roms_routine:
|
||||
php
|
||||
; Offset of arg of lda ($00),y
|
||||
stx peek_under_roms+pa-peek_under_roms_routine+1
|
||||
jsr memmap_allram
|
||||
pa: lda ($00),y
|
||||
jsr memmap_normal
|
||||
plp
|
||||
rts
|
||||
|
||||
poke_under_roms_routine:
|
||||
php
|
||||
; Offset of arg of lda ($00),y
|
||||
stx poke_under_roms+pb-poke_under_roms_routine+1
|
||||
jsr memmap_allram
|
||||
pb: sta ($00),y
|
||||
jsr memmap_normal_routine
|
||||
plp
|
||||
rts
|
||||
|
||||
memmap_normal_routine:
|
||||
pha
|
||||
lda #$37
|
||||
sta $01
|
||||
pla
|
||||
rts
|
||||
|
||||
memmap_allram_routine:
|
||||
sei
|
||||
pha
|
||||
lda #$04
|
||||
sta $01
|
||||
pla
|
||||
rts
|
||||
|
||||
shift_mem_up_routine:
|
||||
;; Move memmove_size bytes from memmove_src to memmove_dst,
|
||||
@@ -68,33 +104,6 @@ smd1:
|
||||
jmp memmap_normal
|
||||
|
||||
|
||||
peek_under_roms_routine:
|
||||
stx peek_under_roms+7 ;Offset of arg of lda ($00),y
|
||||
jsr memmap_allram
|
||||
lda ($00),y
|
||||
jmp memmap_normal
|
||||
|
||||
poke_under_roms_routine:
|
||||
stx poke_under_roms+7 ;Offset of arg of lda ($00),y
|
||||
jsr memmap_allram
|
||||
sta ($00),y
|
||||
;; FALL THROUGH
|
||||
memmap_normal_routine:
|
||||
pha
|
||||
lda #$37
|
||||
sta $01
|
||||
pla
|
||||
cli
|
||||
rts
|
||||
|
||||
memmap_allram_routine:
|
||||
sei
|
||||
pha
|
||||
lda #$04
|
||||
sta $01
|
||||
pla
|
||||
rts
|
||||
|
||||
ram_routines_end:
|
||||
.alias ram_routines_len ram_routines_end-ram_routines_start
|
||||
|
||||
@@ -75,3 +75,14 @@
|
||||
.alias enable_case_switch $0291
|
||||
.alias screen_scroll_disable $0292
|
||||
.alias pal_or_ntsc $02A6
|
||||
|
||||
;; Under-ROM routines
|
||||
;; (BASIC also includes them. XXX - We should de-duplicate them in a safe manner)
|
||||
.alias missed_nmi_flag $2A7
|
||||
.alias tiny_nmi_handler $2A8
|
||||
.alias peek_under_roms tiny_nmi_handler+peek_under_roms_routine-tiny_nmi_handler_routine
|
||||
.alias poke_under_roms tiny_nmi_handler+poke_under_roms_routine-tiny_nmi_handler_routine
|
||||
.alias memmap_allram tiny_nmi_handler+memmap_allram_routine-tiny_nmi_handler_routine
|
||||
.alias memmap_normal tiny_nmi_handler+memmap_normal_routine-tiny_nmi_handler_routine
|
||||
|
||||
|
||||
+23
-1
@@ -22,6 +22,9 @@ load:
|
||||
;; Store start address of LOAD
|
||||
stx load_save_start_ptr+0
|
||||
sty load_save_start_ptr+1
|
||||
|
||||
;; We need our helpers to get to filenames under ROMs or IO area
|
||||
jsr install_ram_routines
|
||||
|
||||
;; Disable IRQs, since timing matters!
|
||||
SEI
|
||||
@@ -62,9 +65,28 @@ load:
|
||||
jsr iec_release_atn
|
||||
|
||||
;; Send filename (p16)
|
||||
lda #$24 ; $ = directory
|
||||
ldy #0
|
||||
|
||||
send_filename:
|
||||
cpy current_filename_length
|
||||
beq sent_filename
|
||||
|
||||
ldx #<current_filename_ptr
|
||||
jsr peek_under_roms
|
||||
|
||||
;; Save Y because iec_tx_byte will corrupt it
|
||||
tax
|
||||
tya
|
||||
pha
|
||||
txa
|
||||
|
||||
jsr iec_tx_byte
|
||||
|
||||
pla
|
||||
tay
|
||||
jmp send_filename
|
||||
|
||||
sent_filename:
|
||||
;; Command device to unlisten to indicate end of file name. (p16)
|
||||
jsr iec_assert_atn
|
||||
lda #$3f
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
;; IMPORTANT:
|
||||
;; These routines lengths cannot be changed without changing
|
||||
;; the aliases for peek_under_roms, poke_under_roms etc
|
||||
;; in ,aliases.s.
|
||||
;; Thus those addresses are expressed using formulae.
|
||||
|
||||
install_ram_routines:
|
||||
;; Copy routines into place
|
||||
ldx #ram_routines_len-1
|
||||
*
|
||||
lda ram_routines_start,x
|
||||
sta tiny_nmi_handler,x
|
||||
dex
|
||||
bpl -
|
||||
|
||||
;; Point NMI handler to tiny_nmi_handler
|
||||
lda #<tiny_nmi_handler
|
||||
sta $FFFE
|
||||
lda #>tiny_nmi_handler
|
||||
sta $FFFF
|
||||
|
||||
rts
|
||||
|
||||
ram_routines_start:
|
||||
|
||||
tiny_nmi_handler_routine:
|
||||
inc missed_nmi_flag
|
||||
rti
|
||||
peek_under_roms_routine:
|
||||
php
|
||||
; Offset of arg of lda ($00),y
|
||||
stx peek_under_roms+pa-peek_under_roms_routine+1
|
||||
jsr memmap_allram
|
||||
pa: lda ($00),y
|
||||
jsr memmap_normal
|
||||
plp
|
||||
rts
|
||||
|
||||
poke_under_roms_routine:
|
||||
php
|
||||
; Offset of arg of lda ($00),y
|
||||
stx poke_under_roms+pb-poke_under_roms_routine+1
|
||||
jsr memmap_allram
|
||||
pb: sta ($00),y
|
||||
jsr memmap_normal_routine
|
||||
plp
|
||||
rts
|
||||
|
||||
memmap_normal_routine:
|
||||
pha
|
||||
lda #$37
|
||||
sta $01
|
||||
pla
|
||||
rts
|
||||
|
||||
memmap_allram_routine:
|
||||
sei
|
||||
pha
|
||||
lda #$04
|
||||
sta $01
|
||||
pla
|
||||
rts
|
||||
|
||||
ram_routines_end:
|
||||
.alias ram_routines_len ram_routines_end-ram_routines_start
|
||||
|
||||
Reference in new issue
Block a user