work towards Ultimate 64 LOAD support
This commit is contained in:
1 parent
355b63e2fe
commit
4a040ac935
9 files changed
+219
-15
No files matched your search
@@ -0,0 +1,6 @@
|
||||
|
||||
;; Platform-specific hooks
|
||||
|
||||
|
||||
.macro PLATFORM_HOOK_LOAD
|
||||
.macend
|
||||
Whitespace-only changes.
@@ -0,0 +1,6 @@
|
||||
|
||||
;; Platform-specific hooks
|
||||
|
||||
|
||||
.macro PLATFORM_HOOK_LOAD
|
||||
.macend
|
||||
Whitespace-only changes.
@@ -1,10 +1,57 @@
|
||||
|
||||
;; Registers according to Ultimate 64 Command Interface ddescription,
|
||||
;; Registers according to Ultimate 64 Command Interface description,
|
||||
;; https://1541u-documentation.readthedocs.io/en/latest/command%20interface.html
|
||||
;; and ultimate_dos_v1.0.pdf and command_interface_v1.0.pdf by Gideon Zweijtzer
|
||||
|
||||
.alias U64_CONTROL $DF1C ; write
|
||||
.alias U64_STATUS $DF1C ; read
|
||||
.alias U64_COMMAND_DATA $DF1D ; write
|
||||
.alias U64_IDENTIFICATION $DF1D ; read
|
||||
.alias U64_RESPONSE_DATA $DF1E ; read only
|
||||
.alias U64_STATUS_DATA $DF1F ; read only
|
||||
;; Command interface registers
|
||||
.alias U64_CONTROL $DF1C ; write
|
||||
.alias U64_STATUS $DF1C ; read
|
||||
.alias U64_COMMAND_DATA $DF1D ; write
|
||||
.alias U64_IDENTIFICATION $DF1D ; read
|
||||
.alias U64_RESPONSE_DATA $DF1E ; read only
|
||||
.alias U64_STATUS_DATA $DF1F ; read only
|
||||
|
||||
;; Constant for U64_IDENTIFICATION register
|
||||
.alias U64_MAGIC_ID $C9
|
||||
|
||||
;; Constants for U64_CONTROL register
|
||||
.alias U64_CTRL_BIT_PUSH_CMD $01
|
||||
.alias U64_CTRL_BIT_DATA_ACC $02
|
||||
.alias U64_CTRL_BIT_ABORT $04
|
||||
.alias U64_CTRL_BIT_CLR_ERR $08
|
||||
|
||||
;; Constants for U64_STATUS register
|
||||
.alias U64_STAT_BIT_CMD_BUSY $01
|
||||
.alias U64_STAT_BIT_DATA_ACC $02
|
||||
.alias U64_STAT_BIT_ABORT_P $04
|
||||
.alias U64_STAT_BIT_ERROR $08
|
||||
.alias U64_STAT_MASK_STATE $30 ; two bits!
|
||||
.alias U64_STAT_BIT_STAT_AV $40
|
||||
.alias U64_STAT_BIT_DATA_AV $80
|
||||
|
||||
;; Interface targets
|
||||
.alias U64_TARGET_DOS1 $01
|
||||
.alias U64_TARGET_DOS2 $02
|
||||
|
||||
;; DOS command codes
|
||||
.alias U64_DOS_CMD_IDENTIFY $01
|
||||
.alias U64_DOS_CMD_OPEN_FILE $02
|
||||
.alias U64_DOS_CMD_CLOSE_FILE $03
|
||||
.alias U64_DOS_CMD_READ_DATA $04
|
||||
.alias U64_DOS_CMD_WRITE_DATA $05
|
||||
.alias U64_DOS_CMD_FILE_SEEK $06
|
||||
.alias U64_DOS_CMD_FILE_INFO $07
|
||||
.alias U64_DOS_CMD_CHANGE_DIR $11
|
||||
.alias U64_DOS_CMD_GET_PATH $12
|
||||
.alias U64_DOS_CMD_OPEN_DIR $13
|
||||
.alias U64_DOS_CMD_READ_DIR $14
|
||||
.alias U64_DOS_CMD_COPY_UI_PATH $15
|
||||
.alias U64_DOS_CMD_LOAD_REU $21
|
||||
.alias U64_DOS_CMD_SAVE_REU $22
|
||||
.alias U64_DOS_CMD_ECHO $F0
|
||||
|
||||
;; DOS file opening constants
|
||||
.alias U64_FA_READ $01
|
||||
.alias U64_FA_WRITE $02
|
||||
.alias U64_FA_CREATE_NEW $03
|
||||
.alias U64_FA_CREATE_ALWAYS $04
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
;; Platform-specific hooks
|
||||
|
||||
|
||||
.macro PLATFORM_HOOK_LOAD
|
||||
jsr u64_load
|
||||
.macend
|
||||
@@ -0,0 +1,140 @@
|
||||
|
||||
;;
|
||||
;; LOAD routine hook for fast loading via UltiDOS
|
||||
;;
|
||||
|
||||
|
||||
u64_load:
|
||||
|
||||
jsr printf
|
||||
.byte "DGB: 0",$0D,0
|
||||
|
||||
;; First check whether the command interface is enabled
|
||||
;; XXX identification does not work, why?
|
||||
;; lda U64_IDENTIFICATION
|
||||
;; cmp U64_MAGIC_ID
|
||||
;; beq +
|
||||
|
||||
u64_load_skip:
|
||||
;; rts
|
||||
*
|
||||
jsr printf
|
||||
.byte "DGB: 1",$0D,0
|
||||
|
||||
;; XXX find out which device number softIEC is mapped to
|
||||
lda current_device_number
|
||||
cmp #$20 ; for now use device number 32
|
||||
beq u64_load_skip
|
||||
|
||||
.byte "DGB: 2",$0D,0
|
||||
|
||||
;; Takeover the flow completely
|
||||
pla
|
||||
pla
|
||||
|
||||
;; Display SEARCHING FOR + filename
|
||||
jsr lvs_display_searching_for
|
||||
|
||||
.byte "DGB: 3",$0D,0
|
||||
|
||||
;; Whatever the interface was doing - ask to abort it
|
||||
jsr u64_load_abort
|
||||
|
||||
.byte "DGB: 4",$0D,0
|
||||
|
||||
;; Send a command to open the file
|
||||
lda #U64_DOS_CMD_OPEN_FILE
|
||||
jsr u64_load_send_cmd
|
||||
lda #U64_FA_READ
|
||||
jsr u64_load_send_cmd
|
||||
jsr u64_load_send_filename
|
||||
jsr u64_load_finalize_cmd
|
||||
|
||||
.byte "DGB: 5",$0D,0
|
||||
|
||||
;; Check status
|
||||
jsr u64_load_check_status
|
||||
bcs lvs_file_not_found_error
|
||||
|
||||
;; Load first two bytes to determine start address
|
||||
|
||||
;; XXX
|
||||
|
||||
.byte "DGB: 6",$0D,0
|
||||
|
||||
jmp lvs_wrap_around_error
|
||||
rts
|
||||
|
||||
u64_load_abort:
|
||||
lda #U64_CTRL_BIT_ABORT
|
||||
sta U64_CONTROL
|
||||
*
|
||||
lda U64_STATUS
|
||||
bne -
|
||||
rts
|
||||
|
||||
u64_load_send_cmd:
|
||||
|
||||
ldx #U64_TARGET_DOS2
|
||||
stx U64_COMMAND_DATA ; target
|
||||
sta U64_COMMAND_DATA ; command code
|
||||
rts
|
||||
|
||||
u64_load_send_filename:
|
||||
ldy #0
|
||||
u64_load_send_filename_loop:
|
||||
cpy FNLEN
|
||||
bne+
|
||||
rts
|
||||
*
|
||||
ldx #<current_filename_ptr
|
||||
jsr peek_under_roms
|
||||
iny
|
||||
|
||||
sta U64_COMMAND_DATA
|
||||
jmp u64_load_send_filename_loop
|
||||
|
||||
u64_load_finalize_cmd:
|
||||
;; Push the command for execution
|
||||
lda #U64_CTRL_BIT_PUSH_CMD
|
||||
sta U64_CONTROL
|
||||
;; Wait till it is complete
|
||||
*
|
||||
lda U64_STATUS
|
||||
and #U64_STAT_BIT_CMD_BUSY
|
||||
bne -
|
||||
rts
|
||||
|
||||
u64_load_check_status:
|
||||
;; Wait till status is available
|
||||
lda U64_STATUS
|
||||
and #U64_STAT_BIT_STAT_AV
|
||||
beq u64_load_check_status
|
||||
|
||||
;; Status is ready - check the first character
|
||||
lda U64_STATUS_DATA
|
||||
cmp #$30 ; '0'
|
||||
bne u64_load_check_status_wrong
|
||||
|
||||
;; Check the second status character
|
||||
lda U64_STATUS
|
||||
and #U64_STAT_BIT_STAT_AV
|
||||
beq u64_load_check_status_ok
|
||||
lda U64_STATUS_DATA
|
||||
cmp #$30 ; '0'
|
||||
beq u64_load_check_status_ok
|
||||
;; FALLTROUGH
|
||||
u64_load_check_status_wrong:
|
||||
sec
|
||||
bcs +
|
||||
u64_load_check_status_ok:
|
||||
clc
|
||||
*
|
||||
;; Now empty the status queue
|
||||
lda U64_STATUS
|
||||
and #U64_STAT_BIT_STAT_AV
|
||||
beq +
|
||||
lda U64_STATUS_DATA
|
||||
jmp -
|
||||
*
|
||||
rts
|
||||
+4
-8
@@ -17,14 +17,7 @@
|
||||
;; On exit, $YYXX is the highest address into which data
|
||||
;; will have been placed.
|
||||
|
||||
;; Searching through Compute's Mapping the 64, we find the following
|
||||
;; things are used:
|
||||
;; $93 = VERCK
|
||||
;; $AC = current pointer for loading/verifying
|
||||
;; $C1 = similar to the above.
|
||||
|
||||
;; XXX honor MSGFLG bit 6, add VERIFY support
|
||||
;; XXX rework the message print-out to be shared with SAVE
|
||||
;; XXX honor MSGFLG bit 6
|
||||
;; XXX add VERIFY support
|
||||
|
||||
load:
|
||||
@@ -42,6 +35,9 @@ load:
|
||||
;; We need our helpers to get to filenames under ROMs or IO area
|
||||
jsr install_ram_routines
|
||||
|
||||
;; Allow platform-specific routine to takeover the flow
|
||||
`PLATFORM_HOOK_LOAD
|
||||
|
||||
;; Display SEARCHING FOR + filename
|
||||
jsr lvs_display_searching_for
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
lvs_handle_byte_load_verify:
|
||||
|
||||
;; XXX add VERIFY support
|
||||
|
||||
;; Save it and advance pointer.
|
||||
;; As with our BASIC, we want to enable LOADing
|
||||
;; anywhere in memory, including over the IO space.
|
||||
|
||||
Reference in new issue
Block a user