disasm: ramcard paths

This commit is contained in:
Joshua Bell 2018-12-14 20:01:36 -08:00
parent 44d1771662
commit b2cf01f0c9
6 changed files with 224 additions and 145 deletions

View File

@ -25,9 +25,9 @@ DA_MAX_SIZE := DA_IO_BUFFER - DA_LOAD_ADDRESS
;; Quit routine signature/data
quit_routine_signature := $D3FF
quit_string_1 := $D3EE
quit_string_2 := $D3AD
copied_to_ramcard_flag := $D3FF
ramcard_prefix := $D3EE
desktop_orig_prefix := $D3AD
;;; ============================================================
;;; Direct Calls (from main memory)

View File

@ -15,9 +15,9 @@
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
copied_to_ramcard_flag := $D3FF ; $00 at start, $C0 mid copy, $80 done
ramcard_prefix := $D3EE
desktop_orig_prefix := $D3AD
;;; ============================================================
.proc copy_desktop_to_ramcard
@ -208,7 +208,7 @@ match: sta $D3AC
lda ROMIN2
ldx #0
jsr set_quit_routine_signature
jsr set_copied_to_ramcard_flag
;; Point $8 at $C100
lda #0
@ -291,13 +291,13 @@ found_slot:
bne :-
ldx #$C0
jsr set_quit_routine_signature
addr_call set_quit_string_1, path0
jsr set_copied_to_ramcard_flag
addr_call set_ramcard_prefix, path0
jsr check_desktop2_on_device
bcs :+
ldx #$80
jsr set_quit_routine_signature
jsr copy_2005_to_quit_string_2
jsr set_copied_to_ramcard_flag
jsr copy_2005_to_desktop_orig_prefix
jmp fail
: lda BUTN1
@ -328,7 +328,7 @@ str_slash_desktop:
jmp fail_copy
: dec buffer
ldx #$80
jsr set_quit_routine_signature
jsr set_copied_to_ramcard_flag
ldy buffer
: lda buffer,y
@ -385,7 +385,7 @@ fail2: lda copy_flag
sta path0
MLI_CALL SET_PREFIX, set_prefix_params
: jsr write_desktop1
jsr copy_2005_to_quit_string_2
jsr copy_2005_to_desktop_orig_prefix
lda #$00
sta RAMWORKS_BANK ; ???
@ -398,17 +398,17 @@ fail2: lda copy_flag
;;; ============================================================
.proc set_quit_routine_signature
.proc set_copied_to_ramcard_flag
lda LCBANK2
lda LCBANK2
stx quit_routine_signature
stx copied_to_ramcard_flag
lda ROMIN2
rts
.endproc
.proc set_quit_string_1
.proc set_ramcard_prefix
ptr := $6
target := quit_string_1
target := ramcard_prefix
stax ptr
lda LCBANK2
@ -424,9 +424,9 @@ fail2: lda copy_flag
rts
.endproc
.proc set_quit_string_2
.proc set_desktop_orig_prefix
ptr := $6
target := quit_string_2
target := desktop_orig_prefix
stax ptr
lda LCBANK2
@ -886,8 +886,8 @@ start: MLI_CALL OPEN, open_params
;;; ============================================================
.proc copy_2005_to_quit_string_2
addr_call set_quit_string_2, L2005
.proc copy_2005_to_desktop_orig_prefix
addr_call set_desktop_orig_prefix, L2005
rts
.endproc
@ -975,6 +975,7 @@ prodos_loader_blocks:
;; $ 2 - 24 * 16-byte data entries
;; $0 - label (length-prefixed, 15 bytes)
;; $F - active_flag (other flags, i.e. download on ... ?)
;; bit 6 = "down loaded" flag ???
;; $182 - 24 * 64-byte pathname
;; $782 - EOF
@ -988,7 +989,7 @@ prodos_loader_blocks:
jsr HOME
lda LCBANK2
lda LCBANK2
lda quit_routine_signature
lda copied_to_ramcard_flag
pha
lda ROMIN2
pla
@ -1922,8 +1923,8 @@ L38D6: lda L324A,y
lda LCBANK2
lda LCBANK2
ldy quit_string_1
: lda quit_string_1,y
ldy ramcard_prefix
: lda ramcard_prefix,y
sta L320A,y
dey
bpl :-

View File

@ -1206,7 +1206,7 @@ set_penmode_copy:
bpl done
jsr L4AAD
jsr L4A77
jsr get_quit_routine_signature
jsr get_copied_to_ramcard_flag
bpl L497A
jsr L8F24 ; Condition for this ???
bmi done
@ -1239,48 +1239,58 @@ result: .byte 0
;;; ============================================================
.proc cmd_selector_item_impl
DEFINE_GET_FILE_INFO_PARAMS get_file_info_params3, $220
.proc cmd_selector_item
start:
jmp L49A6
L49A5: .byte 0
entry_num:
.byte 0
L49A6: lda menu_click_params::item_num
sec
sbc #$06
sta L49A5
sbc #6 ; 4 items + separator (and make 0 based)
sta entry_num
jsr a_times_16
addax #run_list_entries, $06
ldy #$0F
ldy #$0F ; flag byte following name
lda ($06),y
asl a
bmi L49FA
bcc L49E0
jsr get_quit_routine_signature
beq L49FA
lda L49A5
jsr L4AEA
bmi not_downloaded ; bit 6
bcc L49E0 ; bit 7
jsr get_copied_to_ramcard_flag
beq not_downloaded
lda entry_num
jsr check_downloaded_path
beq L49ED
lda L49A5
lda entry_num
jsr L4A47
jsr L8F24
bpl L49ED
jmp redraw_windows_and_desktop
L49E0: jsr get_quit_routine_signature
beq L49FA
lda L49A5
jsr L4AEA
bne L49FA
L49ED: lda L49A5
jsr L4B5F
L49E0: jsr get_copied_to_ramcard_flag
beq not_downloaded
lda entry_num
jsr check_downloaded_path ; was-downloaded flag check?
bne not_downloaded
L49ED: lda entry_num
jsr compose_downloaded_entry_path
stax $06
jmp L4A0A
L49FA: lda L49A5
not_downloaded:
lda entry_num
jsr a_times_64
addax #run_list_paths, $06
L4A0A: ldy #$00
lda ($06),y
tay
@ -1311,34 +1321,45 @@ L4A2B: iny
jmp launch_file
L4A46: .byte 0
;;; --------------------------------------------------
;; Copy entry path to $800
L4A47: pha
jsr a_times_64
addax #run_list_paths, $06
ldy #$00
ldy #0
lda ($06),y
tay
L4A5A: lda ($06),y
: lda ($06),y
sta L0800,y
dey
bpl L4A5A
bpl :-
pla
jsr L4B5F
;; Copy "down loaded" path to $840
jsr compose_downloaded_entry_path
stax $08
ldy #$00
ldy #0
lda ($08),y
tay
L4A6F: lda ($08),y
: lda ($08),y
sta $840,y
dey
bpl L4A6F
L4A77: ldy L0800
L4A7A: lda L0800,y
bpl :-
;; Strip segment off path at $800
L4A77: ldy $800
: lda $800,y
cmp #'/'
beq L4A84
beq :+
dey
bne L4A7A
L4A84: dey
bne :-
: dey
sty L0800
;; Strip segment off path at $840
ldy $840
L4A8B: lda $840,y
cmp #'/'
@ -1347,17 +1368,22 @@ L4A8B: lda $840,y
bne L4A8B
L4A95: dey
sty $840
;; Return addresses in $6 and $8
copy16 #$800, $06
copy16 #$840, $08
jsr L4D19
jsr copy_paths_and_split_name
rts
;;; --------------------------------------------------
L4AAD: ldy buf_win_path
L4AB0: lda buf_win_path,y
sta L0800,y
dey
bpl L4AB0
addr_call copy_quit_string_1, $840
addr_call copy_ramcard_prefix, $840
ldy L0800
L4AC3: lda L0800,y
cmp #'/'
@ -1380,23 +1406,28 @@ L4ADC: iny
bne L4ADC
rts
L4AEA: jsr L4B5F
.proc check_downloaded_path
jsr compose_downloaded_entry_path
stax get_file_info_params3::pathname
MLI_RELAY_CALL GET_FILE_INFO, get_file_info_params3
rts
.endproc
L4A17 := cmd_selector_item::L4A17
L4A77 := cmd_selector_item::L4A77
L4AAD := cmd_selector_item::L4AAD
.endproc
cmd_selector_item := cmd_selector_item_impl::start
L4A17 := cmd_selector_item_impl::L4A17
L4A77 := cmd_selector_item_impl::L4A77
L4AAD := cmd_selector_item_impl::L4AAD
;;; ============================================================
;;; Get quit routine signature byte from Main LC Bank 2.
;;; Get "coped to RAM card" flag from Main LC Bank 2.
.proc get_quit_routine_signature
.proc get_copied_to_ramcard_flag
sta ALTZPOFF
lda LCBANK2
lda LCBANK2
lda quit_routine_signature
lda copied_to_ramcard_flag
tax
sta ALTZPON
lda LCBANK1
@ -1405,14 +1436,14 @@ L4AEA: jsr L4B5F
rts
.endproc
.proc copy_quit_string_1
.proc copy_ramcard_prefix
stax @destptr
sta ALTZPOFF
lda LCBANK2
lda LCBANK2
ldx quit_string_1
: lda quit_string_1,x
ldx ramcard_prefix
: lda ramcard_prefix,x
@destptr := *+1
sta dummy1234,x
dex
@ -1424,14 +1455,14 @@ L4AEA: jsr L4B5F
rts
.endproc
.proc copy_quit_string_2
.proc copy_desktop_orig_prefix
stax @destptr
sta ALTZPOFF
lda LCBANK2
lda LCBANK2
ldx quit_string_2
: lda quit_string_2,x
ldx desktop_orig_prefix
: lda desktop_orig_prefix,x
@destptr := *+1
sta dummy1234,x
dex
@ -1444,44 +1475,63 @@ L4AEA: jsr L4B5F
.endproc
;;; ============================================================
;;; For entry copied ("down loaded") to RAM card, compose path
;;; using RAM card prefix plus last two segments of path
;;; (e.g. "/RAM" + "/" + "MOUSEPAINT/MP.SYSTEM") into path_buffer
.proc L4B5F
sta L4BB0
addr_call copy_quit_string_1, path_buffer
lda L4BB0
.proc compose_downloaded_entry_path
sta entry_num
;; Initialize buffer
addr_call copy_ramcard_prefix, path_buffer
;; Find entry path
lda entry_num
jsr a_times_64
addax #run_list_paths, $06
ldy #$00
ldy #0
lda ($06),y
sta L4BB1
sta prefix_length
;; Walk back one segment
tay
L4B81: lda ($06),y
: lda ($06),y
and #CHAR_MASK
cmp #'/'
beq L4B8C
beq :+
dey
bne L4B81
L4B8C: dey
L4B8D: lda ($06),y
bne :-
: dey
;; Walk back a second segment
: lda ($06),y
and #CHAR_MASK
cmp #'/'
beq L4B98
beq :+
dey
bne L4B8D
L4B98: dey
bne :-
: dey
;; Append last two segments to path
ldx path_buffer
L4B9C: inx
: inx
iny
lda ($06),y
sta path_buffer,x
cpy L4BB1
bne L4B9C
cpy prefix_length
bne :-
stx path_buffer
ldax #path_buffer
rts
L4BB0: .byte 0
L4BB1: .byte 0
entry_num:
.byte 0
prefix_length:
.byte 0
.endproc
;;; ============================================================
@ -1626,7 +1676,9 @@ running_da_flag:
bpl L4CCD
jmp L4CD6
L4CCD: jsr L4D19
;;; --------------------------------------------------
L4CCD: jsr copy_paths_and_split_name
jsr redraw_windows_and_desktop
jsr jt_copy_file
L4CD6: pha
@ -1660,9 +1712,12 @@ L4CF3: iny
.endproc
;;; ============================================================
;;; Copy string at ($6) to path_buf3, string at ($8) to path_buf4,
;;; split filename off path_buf4 and store in filename_buf
.proc L4D19
.proc copy_paths_and_split_name
;; Copy string at $6 to path_buf3
ldy #0
lda ($06),y
tay
@ -1671,6 +1726,7 @@ L4CF3: iny
dey
bpl :-
;; Copy string at $8 to path_buf4
ldy #0
lda ($08),y
tay
@ -1679,23 +1735,26 @@ L4CF3: iny
dey
bpl :-
addr_call L6F90, path_buf4
addr_call find_last_path_segment, path_buf4
ldx #$01
;; Copy filename part to buf
ldx #1
iny
iny
: lda path_buf4,y
sta LE04B,x
sta filename_buf,x
cpy path_buf4
beq :+
iny
inx
jmp :-
: stx LE04B
: stx filename_buf
;; And remove from path_buf4
lda path_buf4
sec
sbc LE04B
sbc filename_buf
sta path_buf4
dec path_buf4
rts
@ -1741,7 +1800,7 @@ L4D9D: pha
bpl :+
jmp redraw_windows_and_desktop
: addr_call L6F90, path_buf3
: addr_call find_last_path_segment, path_buf3
sty path_buf3
addr_call L6FAF, path_buf3
beq L4DC2
@ -2003,7 +2062,7 @@ L4FD4: copy #$80, new_folder_dialog_params::phase
success:
copy #$40, new_folder_dialog_params::phase
yax_call launch_dialog, index_new_folder_dialog, new_folder_dialog_params
addr_call L6F90, path_buffer
addr_call find_last_path_segment, path_buffer
sty path_buffer
addr_call L6FAF, path_buffer
beq done
@ -5484,27 +5543,37 @@ L6F8F: rts
.endproc
;;; ============================================================
;;; Find position of last segment of path at (A,X), return in Y.
;;; For "/a/b", Y points at "/a"; if volume path, unchanged.
.proc L6F90
.proc find_last_path_segment
ptr := $A
stax ptr
;; Find last slash in string
ldy #0
lda (ptr),y
tay
L6F99: lda (ptr),y
: lda (ptr),y
cmp #'/'
beq L6FA9
beq slash
dey
bpl L6F99
bpl :-
;; Oops - no slash
ldy #1
L6FA4: dey
;; Restore original string
restore:
dey
lda (ptr),y
tay
rts
L6FA9: cpy #1
beq L6FA4
;; Are we left with "/" ?
slash: cpy #1
beq restore
dey
rts
.endproc
@ -6330,12 +6399,13 @@ L76BB: bit flag
L7705: addr_jump L7710, $00AA
L770C: ldax #$01C2
L770C: ldax #450
L7710: ldy #$20
sta ($06),y
txa
iny
sta ($06),y
cmp16 L7B65, #50
bmi L7739
cmp16 L7B65, #108
@ -7160,7 +7230,8 @@ inext: inc record_num
ora #$80
sta (ptr),y
ldax #$0F5A
lda #'Z'
ldx #15
: sta $0808,x
dex
bpl :-
@ -10547,9 +10618,9 @@ L9A50: ldx path_buf_main
ldx path_buf_main
L9A60: iny
inx
lda LE04B,y
lda filename_buf,y
sta path_buf_main,x
cpy LE04B
cpy filename_buf
bne L9A60
stx path_buf_main
L9A70: yax_call JT_MLI_RELAY, GET_FILE_INFO, file_info_params2
@ -15254,7 +15325,7 @@ str_system_start: PASCAL_STRING "System/Start"
.proc final_setup
lda #0
sta desktop_main::sys_start_flag
jsr desktop_main::get_quit_routine_signature
jsr desktop_main::get_copied_to_ramcard_flag
cmp #$80
beq L0EFE
MLI_RELAY_CALL GET_PREFIX, get_prefix_params
@ -15262,7 +15333,7 @@ str_system_start: PASCAL_STRING "System/Start"
dec desktop_main::sys_start_path
jmp L0F05
L0EFE: addr_call desktop_main::copy_quit_string_2, desktop_main::sys_start_path
L0EFE: addr_call desktop_main::copy_desktop_orig_prefix, desktop_main::sys_start_path
L0F05: ldx desktop_main::sys_start_path
;; Find last /

View File

@ -935,7 +935,9 @@ path_buf4:
.res 65, 0
path_buf3:
.res 65, 0
LE04B: .res 16, 0
filename_buf:
.res 16, 0
LE05B: .byte $00
LE05C: .byte $00
LE05D: .byte $00

View File

@ -24,7 +24,7 @@ L9017: lda $0C00
sta num_selector_list_items
lda #$00
sta LD344
jsr get_quit_routine_signature
jsr get_copied_to_ramcard_flag
cmp #$80
bne L9015
jsr JUMP_TABLE_REDRAW_ALL
@ -307,7 +307,7 @@ L9282: lda L938D
cmp #$C0
beq L92F0
sta L938A
jsr get_quit_routine_signature
jsr get_copied_to_ramcard_flag
beq L92F0
lda L938A
beq L92CE
@ -474,7 +474,7 @@ L9471: cmp #$10
ldx #$00
lda #$73
bne L947F
L947B: ldax #$00DC
L947B: ldax #220
L947F: clc
adc #$0A
sta dialog_label_pos
@ -736,32 +736,32 @@ L97A0: pha
bne L97B2
addr_jump L97B6, $0069
L97B2: ldax #$00D2
L97B2: ldax #210
L97B6: clc
adc #$09
adc #9
sta rect_D877
txa
adc #$00
adc #0
sta rect_D877+1
pla
cmp #$08
cmp #8
bcc L97D4
cmp #$10
cmp #16
bcs L97D1
sec
sbc #$08
sbc #8
jmp L97D4
L97D1: sec
sbc #$10
sbc #16
L97D4: asl a
asl a
asl a
clc
adc #$18
adc #24
sta rect_D877+2
lda #$00
adc #$00
lda #0
adc #0
sta rect_D877+3
add16 rect_D877, #106, rect_D877+4
add16 rect_D877+2, #7, rect_D877+6
@ -808,13 +808,13 @@ L985E: MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::PaintRect, rect_D6F8
MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::PaintRect, rect_D6F8
return #$00
return #0
L9885: MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::PaintRect, rect_D700
MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::PaintRect, rect_D700
return #$01
return #1
L98AC: lda L938B
ora L938C
@ -1252,7 +1252,7 @@ L9C09: sta warning_dialog_num
DEFINE_WRITE_PARAMS write_params, $C00, $800
DEFINE_CLOSE_PARAMS flush_close_params
L9C26: addr_call copy_quit_string_2, $1C00
L9C26: addr_call copy_desktop_orig_prefix, $1C00
inc $1C00
ldx $1C00
lda #'/'
@ -1439,11 +1439,11 @@ params: .addr 0
;;; ============================================================
.proc get_quit_routine_signature
.proc get_copied_to_ramcard_flag
sta ALTZPOFF
lda LCBANK2
lda LCBANK2
lda quit_routine_signature
lda copied_to_ramcard_flag
tax
sta ALTZPON
lda LCBANK1
@ -1452,14 +1452,14 @@ params: .addr 0
rts
.endproc
.proc copy_quit_string_1
.proc copy_ramcard_prefix
stax @addr
sta ALTZPOFF
lda LCBANK2
lda LCBANK2
ldx quit_string_1
: lda quit_string_1,x
ldx ramcard_prefix
: lda ramcard_prefix,x
@addr := *+1
sta dummy1234,x
dex
@ -1471,14 +1471,14 @@ params: .addr 0
rts
.endproc
.proc copy_quit_string_2
.proc copy_desktop_orig_prefix
stax @addr
sta ALTZPOFF
lda LCBANK2
lda LCBANK2
ldx quit_string_2
: lda quit_string_2,x
ldx desktop_orig_prefix
: lda desktop_orig_prefix,x
@addr := *+1
sta dummy1234,x
dex
@ -1500,7 +1500,7 @@ L9E61: jsr L9E74
rts
L9E74: sta L9EBF
addr_call copy_quit_string_1, L9EC1
addr_call copy_ramcard_prefix, L9EC1
lda L9EBF
jsr L9BE2
stax $06

View File

@ -1847,10 +1847,12 @@ L62C7: .byte 0
;;; ============================================================
L62DE: ldax #$0F5A
L62E2: sta L63C2,x
L62DE: lda #'Z'
ldx #15
: sta L63C2,x
dex
bpl L62E2
bpl :-
lda #$00
sta L63BF
sta L63BE
@ -1902,10 +1904,13 @@ L634B: lda L63C0
lda ($06),y
ora #$80
sta ($06),y
ldax #$0F5A
L635D: sta L63C2,x
lda #'Z'
ldx #15
: sta L63C2,x
dex
bpl L635D
bpl :-
ldx L63BF
lda L63C0
sta L63D2,x