disasm: invoker preamble

This commit is contained in:
Joshua Bell 2018-11-26 20:19:25 -08:00
parent 3be197076f
commit e4480a55b6
2 changed files with 108 additions and 73 deletions

View File

@ -124,6 +124,8 @@ str_f6: PASCAL_STRING "PRODOS"
filename_table: filename_table:
.addr str_f1,str_f2,str_f3,str_f4,str_f5,str_f6 .addr str_f1,str_f2,str_f3,str_f4,str_f5,str_f6
num_filenames = 6
str_copying_to_ramcard: str_copying_to_ramcard:
PASCAL_STRING "Copying Apple II DeskTop into RAMCard" PASCAL_STRING "Copying Apple II DeskTop into RAMCard"
@ -317,7 +319,9 @@ str_slash_desktop:
.byte ST_LINKED_DIRECTORY ; storage_type .byte ST_LINKED_DIRECTORY ; storage_type
.endproc .endproc
start_copy: .proc start_copy
ptr := $06
jsr show_copying_screen jsr show_copying_screen
MLI_CALL GET_PREFIX, get_prefix_params MLI_CALL GET_PREFIX, get_prefix_params
beq :+ beq :+
@ -360,23 +364,21 @@ file_loop:
lda filenum lda filenum
asl a asl a
tax tax
lda filename_table,x copy16 filename_table,x, ptr
sta $06
lda filename_table+1,x
sta $06+1
ldy #0 ldy #0
lda ($06),y lda (ptr),y
tay tay
: lda ($06),y : lda (ptr),y
sta filename_buf,y sta filename_buf,y
dey dey
bpl :- bpl :-
jsr copy_file jsr copy_file
inc filenum inc filenum
lda filenum lda filenum
cmp #$06 cmp #num_filenames
bne file_loop bne file_loop
jmp fail2 jmp fail2
.endproc
fail2: lda copy_flag fail2: lda copy_flag
beq :+ beq :+

View File

@ -921,139 +921,170 @@ params: .addr dummy0000
;;; Launch file (double-click) ??? ;;; Launch file (double-click) ???
.proc launch_file .proc launch_file
path := $220
jmp begin jmp begin
DEFINE_GET_FILE_INFO_PARAMS get_file_info_params, $220 DEFINE_GET_FILE_INFO_PARAMS get_file_info_params, path
begin: begin:
jsr set_watch_cursor jsr set_watch_cursor
;; Compose window path plus icon path
ldx #$FF ldx #$FF
: inx : inx
copy buf_win_path,x, $220,x copy buf_win_path,x, path,x
cpx buf_win_path cpx buf_win_path
bne :- bne :-
inx inx
copy #'/', $220,x copy #'/', path,x
ldy #$00
ldy #0
: iny : iny
inx inx
copy buf_filename2,y, $220,x copy buf_filename2,y, path,x
cpy buf_filename2 cpy buf_filename2
bne :- bne :-
stx path
stx $220 ;; Get the file info to determine type.
MLI_RELAY_CALL GET_FILE_INFO, get_file_info_params MLI_RELAY_CALL GET_FILE_INFO, get_file_info_params
beq L472B beq :+
jsr DESKTOP_SHOW_ALERT0 jsr DESKTOP_SHOW_ALERT0
rts rts
L472B: lda get_file_info_params::file_type ;; Check file type.
: lda get_file_info_params::file_type
cmp #FT_BASIC cmp #FT_BASIC
bne L4738 bne :+
jsr L47B8 jsr check_basic_system ; Only launch if BASIC.SYSTEM is found
jmp L4755 jmp launch
L4738: cmp #FT_BINARY : cmp #FT_BINARY
bne L4748 bne :+
lda BUTN0 ; only launch if a button is down lda BUTN0 ; Only launch if a button is down
ora BUTN1 ora BUTN1 ; BUG: Never gets this far ???
bmi L4755 bmi launch
jsr set_pointer_cursor jsr set_pointer_cursor
rts rts
L4748: cmp #FT_SYSTEM : cmp #FT_SYSTEM
beq L4755 beq launch
cmp #FT_S16 cmp #FT_S16
beq L4755 beq launch
lda #$FA lda #$FA
jsr L4802 jsr show_alert_and_fail
L4755: DESKTOP_RELAY_CALL DT_UNHIGHLIGHT_ALL launch: DESKTOP_RELAY_CALL DT_UNHIGHLIGHT_ALL
MGTK_RELAY_CALL MGTK::CloseAll MGTK_RELAY_CALL MGTK::CloseAll
MGTK_RELAY_CALL MGTK::SetMenu, blank_menu MGTK_RELAY_CALL MGTK::SetMenu, blank_menu
ldx buf_win_path ldx buf_win_path
: copy buf_win_path,x, $220,x : copy buf_win_path,x, path,x
dex dex
bpl :- bpl :-
ldx buf_filename2 ldx buf_filename2
: copy buf_filename2,x, INVOKER_FILENAME,x : copy buf_filename2,x, INVOKER_FILENAME,x
dex dex
bpl :- bpl :-
addr_call L4842, $280 addr_call upcase_string, $280
addr_call L4842, $220 addr_call upcase_string, path
jsr restore_device_list jsr restore_device_list
copy16 #INVOKER, reset_and_invoke_target copy16 #INVOKER, reset_and_invoke_target
jmp reset_and_invoke jmp reset_and_invoke
;;; -------------------------------------------------- ;;; --------------------------------------------------
DEFINE_GET_FILE_INFO_PARAMS get_file_info_params2, $1800 .proc check_basic_system_impl
path := $1800
L47B8: ldx buf_win_path DEFINE_GET_FILE_INFO_PARAMS get_file_info_params2, path
stx L4816
: copy buf_win_path,x, $1800,x start: ldx buf_win_path
stx path_length
: copy buf_win_path,x, path,x
dex dex
bpl :- bpl :-
inc $1800 inc path
ldx $1800 ldx path
copy #'/', $1800,x copy #'/', path,x
L47D2: ldx $1800 loop:
ldy #$00 ;; Append BASIC.SYSTEM to path and check for file.
L47D7: inx ldx path
ldy #0
: inx
iny iny
copy L4817,y, $1800,x copy str_basic_system,y, path,x
cpy L4817 cpy str_basic_system
bne L47D7 bne :-
stx $1800 stx path
MLI_RELAY_CALL GET_FILE_INFO, get_file_info_params2 MLI_RELAY_CALL GET_FILE_INFO, get_file_info_params2
bne L47F3 bne not_found
rts rts
L47F3: ldx L4816 ;; Pop off a path segment and try again.
L47F6: lda $1800,x not_found:
ldx path_length
: lda path,x
cmp #'/' cmp #'/'
beq L4808 beq found_slash
dex dex
bne L47F6 bne :-
L4800: lda #$FE
L4802: jsr DESKTOP_SHOW_ALERT0 no_bs: lda #$FE ; "BASIC.SYSTEM not found"
pla
show_alert_and_fail:
jsr DESKTOP_SHOW_ALERT0
pla ; pop caller address, return to its caller
pla pla
rts rts
L4808: cpx #$01 found_slash:
beq L4800 cpx #$01
stx $1800 beq no_bs
stx path
dex dex
stx L4816 stx path_length
jmp L47D2 jmp loop
L4816: .byte $00 path_length:
L4817: PASCAL_STRING "Basic.system" .byte 0
L4824: .res 30, 0
L4842: stax $06 str_basic_system:
ldy #$00 PASCAL_STRING "Basic.system"
lda ($06),y .endproc
check_basic_system := check_basic_system_impl::start
show_alert_and_fail := check_basic_system_impl::show_alert_and_fail
;;; --------------------------------------------------
prefix_buffer: .res 30, 0
.proc upcase_string
ptr := $06
stax ptr
ldy #0
lda (ptr),y
tay tay
L484B: lda ($06),y loop: lda (ptr),y
cmp #'a' cmp #'a'
bcc L4859 bcc :+
cmp #'z'+1 cmp #'z'+1
bcs L4859 bcs :+
and #CASE_MASK and #CASE_MASK
sta ($06),y sta (ptr),y
L4859: dey : dey
bne L484B bne loop
rts rts
.endproc .endproc
L4824 := launch_file::L4824
.endproc
prefix_buffer := launch_file::prefix_buffer
;;; ============================================================ ;;; ============================================================
L485D: .word $E000 L485D: .word $E000
@ -8558,7 +8589,7 @@ desktop_icon_coords_table:
DEFINE_POINT 130,160 DEFINE_POINT 130,160
DEFINE_POINT 40,160 DEFINE_POINT 40,160
DEFINE_GET_PREFIX_PARAMS get_prefix_params, L4824 DEFINE_GET_PREFIX_PARAMS get_prefix_params, prefix_buffer
;;; ============================================================ ;;; ============================================================
@ -14351,9 +14382,11 @@ end:
selector_list_data_buf := $1400 selector_list_data_buf := $1400
selector_list_data_len := $400 selector_list_data_len := $400
;; Save the current PREFIX
MGTK_RELAY_CALL MGTK::CheckEvents MGTK_RELAY_CALL MGTK::CheckEvents
MLI_RELAY_CALL GET_PREFIX, desktop_main::get_prefix_params MLI_RELAY_CALL GET_PREFIX, desktop_main::get_prefix_params
MGTK_RELAY_CALL MGTK::CheckEvents MGTK_RELAY_CALL MGTK::CheckEvents
lda #0 lda #0
sta L0A92 sta L0A92
jsr read_selector_list jsr read_selector_list