disasm: quit routines

This commit is contained in:
Joshua Bell 2018-11-25 14:38:06 -08:00
parent 983429128f
commit da715ed9ce
5 changed files with 117 additions and 72 deletions

View File

@ -23,6 +23,12 @@ DA_MAX_SIZE := DA_IO_BUFFER - DA_LOAD_ADDRESS
;; Can't load DA past I/O Buffer at MAIN $1C00, ;; Can't load DA past I/O Buffer at MAIN $1C00,
;; but icon tables start at AUX $1B00 so can't clone there. ;; but icon tables start at AUX $1B00 so can't clone there.
;; Quit routine signature/data
quit_routine_signature := $D3FF
quit_string_1 := $D3EE
quit_string_2 := $D3AD
;;; ============================================================ ;;; ============================================================
;;; Direct Calls (from main memory) ;;; Direct Calls (from main memory)

View File

@ -7,6 +7,18 @@
.include "../inc/prodos.inc" .include "../inc/prodos.inc"
.include "../macros.inc" .include "../macros.inc"
;;; ============================================================
;;; Locations in Main LC Bank 2 (past end of custom quit routines)
;; 16 bytes $D395-$D3A4 - set to $FF when entry is copied
;; ("down loaded") to RAM Card.
entry_copied_flags := $D395
;; Quit routine signature/data
quit_routine_signature := $D3FF ; $00 at start, $C0 mid copy, $80 done
quit_string_1 := $D3EE
quit_string_2 := $D3AD
;;; ============================================================ ;;; ============================================================
.proc copy_desktop_to_ramcard .proc copy_desktop_to_ramcard
@ -194,7 +206,7 @@ match: sta $D3AC
lda ROMIN2 lda ROMIN2
ldx #0 ldx #0
jsr stx_lc_d3ff jsr set_quit_routine_signature
;; Point $8 at $C100 ;; Point $8 at $C100
lda #0 lda #0
@ -277,13 +289,13 @@ found_slot:
bne :- bne :-
ldx #$C0 ldx #$C0
jsr stx_lc_d3ff jsr set_quit_routine_signature
addr_call copy_to_lc2_b, path0 addr_call set_quit_string_1, path0
jsr check_desktop2_on_device jsr check_desktop2_on_device
bcs :+ bcs :+
ldx #$80 ldx #$80
jsr stx_lc_d3ff jsr set_quit_routine_signature
jsr copy_2005_to_lc2_a jsr copy_2005_to_quit_string_2
jmp fail jmp fail
: lda BUTN1 : lda BUTN1
@ -312,7 +324,7 @@ start_copy:
jmp fail_copy jmp fail_copy
: dec buffer : dec buffer
ldx #$80 ldx #$80
jsr stx_lc_d3ff jsr set_quit_routine_signature
ldy buffer ldy buffer
: lda buffer,y : lda buffer,y
@ -371,7 +383,7 @@ fail2: lda copy_flag
sta path0 sta path0
MLI_CALL SET_PREFIX, set_prefix_params MLI_CALL SET_PREFIX, set_prefix_params
: jsr write_desktop1 : jsr write_desktop1
jsr copy_2005_to_lc2_a jsr copy_2005_to_quit_string_2
lda #$00 lda #$00
sta RAMWORKS_BANK ; ??? sta RAMWORKS_BANK ; ???
@ -382,17 +394,19 @@ fail2: lda copy_flag
bpl :- bpl :-
jmp copy_selector_entries_to_ramcard jmp copy_selector_entries_to_ramcard
.proc stx_lc_d3ff ;;; ============================================================
.proc set_quit_routine_signature
lda LCBANK2 lda LCBANK2
lda LCBANK2 lda LCBANK2
stx $D3FF stx quit_routine_signature
lda ROMIN2 lda ROMIN2
rts rts
.endproc .endproc
.proc copy_to_lc2_b .proc set_quit_string_1
ptr := $6 ptr := $6
target := $D3EE target := quit_string_1
stax ptr stax ptr
lda LCBANK2 lda LCBANK2
@ -408,13 +422,14 @@ fail2: lda copy_flag
rts rts
.endproc .endproc
.proc copy_to_lc2_a .proc set_quit_string_2
ptr := $6 ptr := $6
target := $D3AD target := quit_string_2
stax ptr stax ptr
lda LCBANK2 lda LCBANK2
lda LCBANK2 lda LCBANK2
ldy #0 ldy #0
lda (ptr),y lda (ptr),y
tay tay
@ -422,10 +437,13 @@ fail2: lda copy_flag
sta target,y sta target,y
dey dey
bpl :- bpl :-
lda ROMIN2 lda ROMIN2
rts rts
.endproc .endproc
;;; ============================================================
fail: lda #0 fail: lda #0
sta flag sta flag
jmp fail2 jmp fail2
@ -866,8 +884,8 @@ start: MLI_CALL OPEN, open_params
;;; ============================================================ ;;; ============================================================
.proc copy_2005_to_lc2_a .proc copy_2005_to_quit_string_2
addr_call copy_to_lc2_a, L2005 addr_call set_quit_string_2, L2005
rts rts
.endproc .endproc
@ -968,7 +986,7 @@ prodos_loader_blocks:
jsr HOME jsr HOME
lda LCBANK2 lda LCBANK2
lda LCBANK2 lda LCBANK2
lda $D3FF ; ??? last byte of selector routine? lda quit_routine_signature
pha pha
lda ROMIN2 lda ROMIN2
pla pla
@ -979,7 +997,7 @@ prodos_loader_blocks:
lda LCBANK2 lda LCBANK2
ldx #$17 ldx #$17
lda #0 lda #0
: sta $D395,x : sta entry_copied_flags,x
dex dex
bpl :- bpl :-
lda ROMIN2 lda ROMIN2
@ -1010,7 +1028,7 @@ entry_loop:
lda LCBANK2 lda LCBANK2
ldx entry_num ldx entry_num
lda #$FF lda #$FF
sta $D395,x sta entry_copied_flags,x
lda ROMIN2 lda ROMIN2
next_entry: next_entry:
@ -1049,7 +1067,7 @@ entry_loop2:
adc #8 adc #8
tax tax
lda #$FF lda #$FF
sta $D395,x sta entry_copied_flags,x
lda ROMIN2 lda ROMIN2
next_entry2: next_entry2:
inc entry_num inc entry_num
@ -1914,8 +1932,8 @@ L38D6: lda L324A,y
lda LCBANK2 lda LCBANK2
lda LCBANK2 lda LCBANK2
ldy $D3EE ldy quit_string_1
: lda $D3EE,y : lda quit_string_1,y
sta L320A,y sta L320A,y
dey dey
bpl :- bpl :-

View File

@ -1164,7 +1164,7 @@ set_penmode_copy:
bpl done bpl done
jsr L4AAD jsr L4AAD
jsr L4A77 jsr L4A77
jsr get_LD3FF jsr get_quit_routine_signature
bpl L497A bpl L497A
jsr L8F24 ; Condition for this ??? jsr L8F24 ; Condition for this ???
bmi done bmi done
@ -1215,7 +1215,7 @@ L49A6: lda menu_click_params::item_num
asl a asl a
bmi L49FA bmi L49FA
bcc L49E0 bcc L49E0
jsr get_LD3FF jsr get_quit_routine_signature
beq L49FA beq L49FA
lda L49A5 lda L49A5
jsr L4AEA jsr L4AEA
@ -1226,7 +1226,7 @@ L49A6: lda menu_click_params::item_num
bpl L49ED bpl L49ED
jmp redraw_windows_and_desktop jmp redraw_windows_and_desktop
L49E0: jsr get_LD3FF L49E0: jsr get_quit_routine_signature
beq L49FA beq L49FA
lda L49A5 lda L49A5
jsr L4AEA jsr L4AEA
@ -1315,7 +1315,7 @@ L4AB0: lda buf_win_path,y
sta L0800,y sta L0800,y
dey dey
bpl L4AB0 bpl L4AB0
addr_call copy_LD3EE_str, $840 addr_call copy_quit_string_1, $840
ldy L0800 ldy L0800
L4AC3: lda L0800,y L4AC3: lda L0800,y
cmp #'/' cmp #'/'
@ -1348,12 +1348,13 @@ L4AEA: jsr L4B5F
L4AAD := cmd_selector_item::L4AAD L4AAD := cmd_selector_item::L4AAD
;;; ============================================================ ;;; ============================================================
;;; Get quit routine signature byte from Main LC Bank 2.
.proc get_LD3FF .proc get_quit_routine_signature
sta ALTZPOFF sta ALTZPOFF
lda LCBANK2 lda LCBANK2
lda LCBANK2 lda LCBANK2
lda LD3FF lda quit_routine_signature
tax tax
sta ALTZPON sta ALTZPON
lda LCBANK1 lda LCBANK1
@ -1362,14 +1363,14 @@ L4AEA: jsr L4B5F
rts rts
.endproc .endproc
.proc copy_LD3EE_str .proc copy_quit_string_1
stax @destptr stax @destptr
sta ALTZPOFF sta ALTZPOFF
lda LCBANK2 lda LCBANK2
lda LCBANK2 lda LCBANK2
ldx LD3EE ldx quit_string_1
: lda LD3EE,x : lda quit_string_1,x
@destptr := *+1 @destptr := *+1
sta dummy1234,x sta dummy1234,x
dex dex
@ -1381,14 +1382,14 @@ L4AEA: jsr L4B5F
rts rts
.endproc .endproc
.proc copy_LD3AD_str .proc copy_quit_string_2
stax @destptr stax @destptr
sta ALTZPOFF sta ALTZPOFF
lda LCBANK2 lda LCBANK2
lda LCBANK2 lda LCBANK2
ldx LD3AD ldx quit_string_2
: lda LD3AD,x : lda quit_string_2,x
@destptr := *+1 @destptr := *+1
sta dummy1234,x sta dummy1234,x
dex dex
@ -1400,9 +1401,11 @@ L4AEA: jsr L4B5F
rts rts
.endproc .endproc
;;; ============================================================
.proc L4B5F .proc L4B5F
sta L4BB0 sta L4BB0
addr_call copy_LD3EE_str, path_buffer addr_call copy_quit_string_1, path_buffer
lda L4BB0 lda L4BB0
jsr a_times_64 jsr a_times_64
addax #$DB9E, $06 addax #$DB9E, $06
@ -1903,6 +1906,8 @@ fail: rts
.proc cmd_new_folder_impl .proc cmd_new_folder_impl
ptr := $06
L4F67: .byte $00 L4F67: .byte $00
L4F68: .word 0 L4F68: .word 0
@ -1915,6 +1920,7 @@ path_buffer:
start: lda active_window_id start: lda active_window_id
sta L4F67 sta L4F67
yax_call launch_dialog, index_new_folder_dialog, L4F67 yax_call launch_dialog, index_new_folder_dialog, L4F67
L4FC6: lda active_window_id L4FC6: lda active_window_id
beq L4FD4 beq L4FD4
jsr window_address_lookup jsr window_address_lookup
@ -1922,42 +1928,51 @@ L4FC6: lda active_window_id
L4FD4: lda #$80 L4FD4: lda #$80
sta L4F67 sta L4F67
yax_call launch_dialog, index_new_folder_dialog, L4F67 yax_call launch_dialog, index_new_folder_dialog, L4F67
beq L4FE7 beq :+
jmp L504B jmp done ; Cancelled
: stx ptr+1
L4FE7: stx $06+1
stx L504F stx L504F
sty $06 sty ptr
sty L504E sty L504E
ldy #$00
lda ($06),y ;; Copy path
ldy #0
lda (ptr),y
tay tay
L4FF6: lda ($06),y : lda (ptr),y
sta path_buffer,y sta path_buffer,y
dey dey
bpl L4FF6 bpl :-
ldx #$03
;; Create with current date
ldx #3
: lda DATELO,x : lda DATELO,x
sta create_params::create_date,x sta create_params::create_date,x
dex dex
bpl :- bpl :-
;; Create folder
MLI_RELAY_CALL CREATE, create_params MLI_RELAY_CALL CREATE, create_params
beq L5027 beq success
;; Failure
jsr DESKTOP_SHOW_ALERT0 jsr DESKTOP_SHOW_ALERT0
copy16 L504E, L4F68 copy16 L504E, L4F68
jmp L4FC6 jmp L4FC6
rts rts ; ???
L5027: lda #$40 success:
lda #$40
sta L4F67 sta L4F67
yax_call launch_dialog, index_new_folder_dialog, L4F67 yax_call launch_dialog, index_new_folder_dialog, L4F67
addr_call L6F90, path_buffer addr_call L6F90, path_buffer
sty path_buffer sty path_buffer
addr_call L6FAF, path_buffer addr_call L6FAF, path_buffer
beq L504B beq done
jsr L5E78 jsr L5E78
L504B: jmp redraw_windows_and_desktop
done: jmp redraw_windows_and_desktop
L504E: .byte 0 L504E: .byte 0
L504F: .byte 0 L504F: .byte 0
@ -14916,7 +14931,7 @@ str_system_start: PASCAL_STRING "System/Start"
.proc final_setup .proc final_setup
lda #0 lda #0
sta desktop_main::sys_start_flag sta desktop_main::sys_start_flag
jsr desktop_main::get_LD3FF jsr desktop_main::get_quit_routine_signature
cmp #$80 cmp #$80
beq L0EFE beq L0EFE
MLI_RELAY_CALL GET_PREFIX, get_prefix_params MLI_RELAY_CALL GET_PREFIX, get_prefix_params
@ -14924,7 +14939,7 @@ str_system_start: PASCAL_STRING "System/Start"
dec desktop_main::sys_start_path dec desktop_main::sys_start_path
jmp L0F05 jmp L0F05
L0EFE: addr_call desktop_main::copy_LD3AD_str, desktop_main::sys_start_path L0EFE: addr_call desktop_main::copy_quit_string_2, desktop_main::sys_start_path
L0F05: ldx desktop_main::sys_start_path L0F05: ldx desktop_main::sys_start_path
;; Find last / ;; Find last /

View File

@ -299,15 +299,9 @@ buf_filename2: .res 16, 0
buf_win_path: .res 43, 0 buf_win_path: .res 43, 0
temp_string_buf: temp_string_buf:
.res 45, 0 .res 65, 0
LD3AD: .res 20, 0 LD3C1: .res 65, 0
LD3C1: .res 45, 0
LD3EE: .res 17, 0
LD3FF: .byte 0
LD400: .byte 0
LD401: .byte 0
;;; In common dialog (copy/edit file, add/edit selector entry): ;;; In common dialog (copy/edit file, add/edit selector entry):
;;; * path_buf0 has the contents of the top input field ;;; * path_buf0 has the contents of the top input field

View File

@ -24,7 +24,7 @@ L9017: lda $0C00
sta LD343 sta LD343
lda #$00 lda #$00
sta LD343+1 sta LD343+1
jsr L9DED jsr get_quit_routine_signature
cmp #$80 cmp #$80
bne L9015 bne L9015
jsr JUMP_TABLE_REDRAW_ALL jsr JUMP_TABLE_REDRAW_ALL
@ -307,7 +307,7 @@ L9282: lda L938D
cmp #$C0 cmp #$C0
beq L92F0 beq L92F0
sta L938A sta L938A
jsr L9DED jsr get_quit_routine_signature
beq L92F0 beq L92F0
lda L938A lda L938A
beq L92CE beq L92CE
@ -1252,10 +1252,10 @@ L9C09: sta warning_dialog_num
DEFINE_WRITE_PARAMS write_params, $C00, $800 DEFINE_WRITE_PARAMS write_params, $C00, $800
DEFINE_CLOSE_PARAMS flush_close_params DEFINE_CLOSE_PARAMS flush_close_params
L9C26: addr_call L9E2A, $1C00 L9C26: addr_call copy_quit_string_2, $1C00
inc $1C00 inc $1C00
ldx $1C00 ldx $1C00
lda #$2F lda #'/'
sta $1C00,x sta $1C00,x
ldx #$00 ldx #$00
ldy $1C00 ldy $1C00
@ -1439,46 +1439,58 @@ params: .addr 0
;;; ============================================================ ;;; ============================================================
L9DED: sta ALTZPOFF .proc get_quit_routine_signature
sta ALTZPOFF
lda LCBANK2 lda LCBANK2
lda LCBANK2 lda LCBANK2
lda LD3FF lda quit_routine_signature
tax tax
sta ALTZPON sta ALTZPON
lda LCBANK1 lda LCBANK1
lda LCBANK1 lda LCBANK1
txa txa
rts rts
.endproc
L9E05: stax @addr .proc copy_quit_string_1
stax @addr
sta ALTZPOFF sta ALTZPOFF
lda LCBANK2 lda LCBANK2
lda LCBANK2 lda LCBANK2
ldx LD3EE
: lda LD3EE,x ldx quit_string_1
: lda quit_string_1,x
@addr := *+1 @addr := *+1
sta dummy1234,x sta dummy1234,x
dex dex
bpl :- bpl :-
sta ALTZPON sta ALTZPON
lda LCBANK1 lda LCBANK1
lda LCBANK1 lda LCBANK1
rts rts
.endproc
L9E2A: stax @addr .proc copy_quit_string_2
stax @addr
sta ALTZPOFF sta ALTZPOFF
lda LCBANK2 lda LCBANK2
lda LCBANK2 lda LCBANK2
ldx LD3AD
: lda LD3AD,x ldx quit_string_2
: lda quit_string_2,x
@addr := *+1 @addr := *+1
sta dummy1234,x sta dummy1234,x
dex dex
bpl :- bpl :-
sta ALTZPON sta ALTZPON
lda LCBANK1 lda LCBANK1
lda LCBANK1 lda LCBANK1
rts rts
.endproc
;;; ============================================================
DEFINE_GET_FILE_INFO_PARAMS get_file_info_params, 0 DEFINE_GET_FILE_INFO_PARAMS get_file_info_params, 0
@ -1488,7 +1500,7 @@ L9E61: jsr L9E74
rts rts
L9E74: sta L9EBF L9E74: sta L9EBF
addr_call L9E05, L9EC1 addr_call copy_quit_string_1, L9EC1
lda L9EBF lda L9EBF
jsr L9BE2 jsr L9BE2
stax $06 stax $06