mirror of
https://github.com/mi57730/a2d.git
synced 2025-02-20 02:29:11 +00:00
DeskTop: Identify bank-switched routines
This commit is contained in:
parent
0ab8d20ec0
commit
f20bcf6205
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.DS_Store
|
38
desktop.inc
38
desktop.inc
@ -5,6 +5,8 @@
|
|||||||
;;; ==================================================
|
;;; ==================================================
|
||||||
;;; Direct Calls
|
;;; Direct Calls
|
||||||
|
|
||||||
|
;;; NOTE: Some of these are used by Desk Accessories
|
||||||
|
|
||||||
;; These must be called from main memory (RAMRDOFF/RAMWRTOFF)
|
;; These must be called from main memory (RAMRDOFF/RAMWRTOFF)
|
||||||
JUMP_TABLE_03 := $4003 ; Enter DeskTop input loop
|
JUMP_TABLE_03 := $4003 ; Enter DeskTop input loop
|
||||||
JUMP_TABLE_06 := $4006 ; ???
|
JUMP_TABLE_06 := $4006 ; ???
|
||||||
@ -29,6 +31,8 @@ JUMP_TABLE_3F := $403F ; ???
|
|||||||
|
|
||||||
;;; ==================================================
|
;;; ==================================================
|
||||||
|
|
||||||
|
;;; NOTE: Some of these are used by Desk Accessories
|
||||||
|
|
||||||
DESKTOP := $8E00
|
DESKTOP := $8E00
|
||||||
;; MLI-style call (jsr A2D ; .byte call ; .addr params)
|
;; MLI-style call (jsr A2D ; .byte call ; .addr params)
|
||||||
;; Call from AUX (RAMRDON/RAMWRTON)
|
;; Call from AUX (RAMRDON/RAMWRTON)
|
||||||
@ -69,6 +73,12 @@ DESKTOP_REDRAW_ICONS := $0C ; Repaints desktop icons
|
|||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
;;; ==================================================
|
;;; ==================================================
|
||||||
|
;;; $D000 routines/pointers (called from MAIN)
|
||||||
|
|
||||||
|
;;; These are used by the MAIN (and sometimes AUX) halves of DeskTop itself,
|
||||||
|
;;; since this bank can be accessed from both AUX and MAIN.
|
||||||
|
|
||||||
|
;;; TODO: move into "internal" include file
|
||||||
|
|
||||||
;; Relay for main>aux A2D call (Y=call, X,A=params addr)
|
;; Relay for main>aux A2D call (Y=call, X,A=params addr)
|
||||||
A2D_RELAY := $D000
|
A2D_RELAY := $D000
|
||||||
@ -85,6 +95,15 @@ A2D_RELAY := $D000
|
|||||||
jsr A2D_RELAY
|
jsr A2D_RELAY
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
|
;; SET_POS with params at (X,A) followed by DRAW_TEXT call
|
||||||
|
SETPOS_RELAY := $D01C
|
||||||
|
|
||||||
|
.macro SETPOS_RELAY_CALL addr
|
||||||
|
lda #<addr
|
||||||
|
ldx #>addr
|
||||||
|
jsr SETPOS_RELAY
|
||||||
|
.endmacro
|
||||||
|
|
||||||
;; Relay for main>aux DESKTOP call (Y=call, X,A=params addr)
|
;; Relay for main>aux DESKTOP call (Y=call, X,A=params addr)
|
||||||
DESKTOP_RELAY := $D040
|
DESKTOP_RELAY := $D040
|
||||||
|
|
||||||
@ -100,11 +119,30 @@ DESKTOP_RELAY := $D040
|
|||||||
jsr DESKTOP_RELAY
|
jsr DESKTOP_RELAY
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
|
DESKTOP_FIND_SPACE := $D05E ; Find space in AUX $1F80 table
|
||||||
|
DESKTOP_FREE_SPACE := $D082 ; Free space in AUX $1F80 table
|
||||||
|
DESKTOP_COPY_FROM_BUF := $D096 ; Copy from buffer to blocks around $1B00
|
||||||
|
DESKTOP_COPY_TO_BUF := $D09A ; Copy to buffer from blocks around $1B00
|
||||||
|
DESKTOP_ASSIGN_STATE := $D108 ; Assign active state to DESKTOP_WINID window
|
||||||
|
DESKTOP_AUXLOAD := $D13E ; Load AUX (X,A) into A
|
||||||
|
DESKTOP_SHOW_ALERT0 := $D154 ; Show alert 0
|
||||||
|
DESKTOP_SHOW_ALERT := $D156 ; Show alert in X
|
||||||
|
|
||||||
|
;;; Data fields providing parame for the above
|
||||||
|
|
||||||
|
DESKTOP_BUFNUM := $DE9F ; Buffer num for DESKTOP_COPY_*_BUF
|
||||||
|
DESKTOP_WINID := $EC25 ; Window ID for some operations ???
|
||||||
|
|
||||||
|
;;; A handful of entry points in MAIN are referenced from AUX code
|
||||||
|
|
||||||
|
DESKTOP_MAIN_PUSH_ADDRS := $87F6 ; Push two words from stack from $6/$8
|
||||||
|
DESKTOP_MAIN_POP_ADDRS := $8813 ; Pop two words from stack to $6/$8
|
||||||
|
|
||||||
;;; ==================================================
|
;;; ==================================================
|
||||||
;;; DeskTop Internals
|
;;; DeskTop Internals
|
||||||
|
|
||||||
|
;;; NOTE: Some of these are used by Desk Accessories
|
||||||
|
|
||||||
;; These are DeskTop internals, but it appears there is no
|
;; These are DeskTop internals, but it appears there is no
|
||||||
;; API for getting the selected file.
|
;; API for getting the selected file.
|
||||||
file_selected := $DF21 ; 0 if no selection, 1 otherwise
|
file_selected := $DF21 ; 0 if no selection, 1 otherwise
|
||||||
|
@ -8956,7 +8956,7 @@ L8672: pha
|
|||||||
L867B: lda online_params_buffer
|
L867B: lda online_params_buffer
|
||||||
beq L8672
|
beq L8672
|
||||||
jsr L8388 ; ??? This is the middle of an instruction?
|
jsr L8388 ; ??? This is the middle of an instruction?
|
||||||
jsr desktop_LD05E
|
jsr DESKTOP_FIND_SPACE ; AUX > MAIN call???
|
||||||
ldy L8738
|
ldy L8738
|
||||||
sta $D464,y
|
sta $D464,y
|
||||||
asl a
|
asl a
|
||||||
@ -12513,7 +12513,8 @@ LB5C4: PASCAL_STRING "on the system disk ?"
|
|||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00
|
.byte $00,$00,$00,$00,$00,$00,$00
|
||||||
|
|
||||||
LB600: jmp show_alert_dialog
|
show_alert_indirection:
|
||||||
|
jmp show_alert_dialog
|
||||||
|
|
||||||
alert_bitmap:
|
alert_bitmap:
|
||||||
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
|
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
|
||||||
@ -12635,7 +12636,7 @@ alert_action_table:
|
|||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
.byte $00,$80,$80,$00
|
.byte $00,$80,$80,$00
|
||||||
|
|
||||||
;; Show alert; prompt number in A
|
;; Show alert; prompt number in X (???), A = ???
|
||||||
.proc show_alert_dialog
|
.proc show_alert_dialog
|
||||||
pha
|
pha
|
||||||
txa
|
txa
|
||||||
@ -13228,11 +13229,11 @@ addr: .addr 0
|
|||||||
|
|
||||||
.org $D000
|
.org $D000
|
||||||
|
|
||||||
L87F6 := $87F6
|
;;; Various routines callable from MAIN
|
||||||
L8813 := $8813
|
|
||||||
|
|
||||||
;; A2D call from main>aux, call in Y, params at (X,A)
|
;; A2D call from main>aux, call in Y, params at (X,A)
|
||||||
.proc A2D_RELAY
|
.proc A2D_RELAY_IMPL
|
||||||
|
.assert * = A2D_RELAY, error, "Entry point mismatch"
|
||||||
sty addr-1
|
sty addr-1
|
||||||
sta addr
|
sta addr
|
||||||
stx addr+1
|
stx addr+1
|
||||||
@ -13244,9 +13245,9 @@ L8813 := $8813
|
|||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
;; SET_POS with params at (X,A) followed by DRAW_TEXT call
|
;; SET_POS with params at (X,A) followed by DRAW_TEXT call
|
||||||
.proc SETPOS_RELAY
|
.proc SETPOS_RELAY_IMPL
|
||||||
|
.assert * = SETPOS_RELAY, error, "Entry point mismatch"
|
||||||
sta addr
|
sta addr
|
||||||
stx addr+1
|
stx addr+1
|
||||||
sta RAMRDON
|
sta RAMRDON
|
||||||
@ -13277,7 +13278,8 @@ L8813 := $8813
|
|||||||
|
|
||||||
;; Find first 0 in AUX $1F80 ... $1F7F; if present,
|
;; Find first 0 in AUX $1F80 ... $1F7F; if present,
|
||||||
;; mark it 1 and return index+1 in A
|
;; mark it 1 and return index+1 in A
|
||||||
.proc LD05E
|
.proc DESKTOP_FIND_SPACE_IMPL
|
||||||
|
.assert * = DESKTOP_FIND_SPACE, error, "Entry point mismatch"
|
||||||
sta RAMRDON
|
sta RAMRDON
|
||||||
sta RAMWRTON
|
sta RAMWRTON
|
||||||
ldx #0
|
ldx #0
|
||||||
@ -13300,6 +13302,9 @@ loop: lda $1F80,x
|
|||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
;; Zero the AUX $1F80 table entry in A
|
||||||
|
.proc DESKTOP_FREE_SPACE_IMPL
|
||||||
|
.assert * = DESKTOP_FREE_SPACE, error, "Entry point mismatch"
|
||||||
tay
|
tay
|
||||||
sta RAMRDON
|
sta RAMRDON
|
||||||
sta RAMWRTON
|
sta RAMWRTON
|
||||||
@ -13309,88 +13314,120 @@ loop: lda $1F80,x
|
|||||||
sta RAMRDOFF
|
sta RAMRDOFF
|
||||||
sta RAMWRTOFF
|
sta RAMWRTOFF
|
||||||
rts
|
rts
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
;; Copy data to/from buffers (see bufnum / buf3 / table1/2) ???
|
||||||
|
.proc DESKTOP_COPY_BUF_IMPL
|
||||||
|
ptr := $6
|
||||||
|
|
||||||
|
.assert * = DESKTOP_COPY_FROM_BUF, error, "Entry point mismatch"
|
||||||
lda #$80
|
lda #$80
|
||||||
bne LD09C
|
bne :+ ; always
|
||||||
|
|
||||||
|
.assert * = DESKTOP_COPY_TO_BUF, error, "Entry point mismatch"
|
||||||
lda #$00
|
lda #$00
|
||||||
LD09C: sta LD106
|
|
||||||
jsr L87F6
|
sta flag
|
||||||
lda LDE9F
|
jsr DESKTOP_MAIN_PUSH_ADDRS
|
||||||
asl a
|
|
||||||
|
lda bufnum
|
||||||
|
asl a ; * 2
|
||||||
tax
|
tax
|
||||||
lda LEC01,x
|
lda table1,x ; copy table1 entry to ptr
|
||||||
sta $06
|
sta ptr
|
||||||
lda LEC01+1,x
|
lda table1+1,x
|
||||||
sta $07
|
sta ptr+1
|
||||||
|
|
||||||
sta RAMRDON
|
sta RAMRDON
|
||||||
sta RAMWRTON
|
sta RAMWRTON
|
||||||
bit LD106
|
bit flag
|
||||||
bpl LD0C6
|
bpl set_length
|
||||||
lda LDEA0
|
|
||||||
ldy #$00
|
|
||||||
sta ($06),y
|
|
||||||
jmp LD0CD
|
|
||||||
|
|
||||||
LD0C6: ldy #$00
|
;; assign length from buf3
|
||||||
lda ($06),y
|
lda buf3len
|
||||||
sta LDEA0
|
|
||||||
LD0CD: lda LEC13,x
|
|
||||||
sta $06
|
|
||||||
lda LEC13+1,x
|
|
||||||
sta $07
|
|
||||||
bit LD106
|
|
||||||
bmi LD0EC
|
|
||||||
ldy #0
|
ldy #0
|
||||||
LD0DE: cpy LDEA0
|
sta (ptr),y
|
||||||
beq LD0FC
|
jmp set_copy_ptr
|
||||||
lda ($06),y
|
|
||||||
sta LDEA0+1,y
|
|
||||||
iny
|
|
||||||
jmp LD0DE
|
|
||||||
|
|
||||||
LD0EC: ldy #0
|
;; assign length to buf3
|
||||||
LD0EE: cpy LDEA0
|
set_length:
|
||||||
beq LD0FC
|
ldy #0
|
||||||
lda LDEA0+1,y
|
lda (ptr),y
|
||||||
sta ($06),y
|
sta buf3len
|
||||||
iny
|
|
||||||
jmp LD0EE
|
|
||||||
|
|
||||||
LD0FC: sta RAMRDOFF
|
set_copy_ptr:
|
||||||
|
lda table2,x ; copy table2 entry to ptr
|
||||||
|
sta ptr
|
||||||
|
lda table2+1,x
|
||||||
|
sta ptr
|
||||||
|
bit flag
|
||||||
|
bmi copy_from
|
||||||
|
|
||||||
|
;; copy into buf3
|
||||||
|
ldy #0 ; flag clear...
|
||||||
|
: cpy buf3len
|
||||||
|
beq done
|
||||||
|
lda (ptr),y
|
||||||
|
sta buf3,y
|
||||||
|
iny
|
||||||
|
jmp :-
|
||||||
|
|
||||||
|
;; copy from buf3
|
||||||
|
copy_from:
|
||||||
|
ldy #0
|
||||||
|
: cpy buf3len
|
||||||
|
beq done
|
||||||
|
lda buf3,y
|
||||||
|
sta (ptr),y
|
||||||
|
iny
|
||||||
|
jmp :-
|
||||||
|
|
||||||
|
done: sta RAMRDOFF
|
||||||
sta RAMWRTOFF
|
sta RAMWRTOFF
|
||||||
jsr L8813
|
jsr DESKTOP_MAIN_POP_ADDRS
|
||||||
rts
|
rts
|
||||||
|
|
||||||
LD106: .byte 0
|
flag: .byte 0
|
||||||
rts ; ???
|
rts ; ???
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
;; Assign active state to DESKTOP_WINID window
|
||||||
|
.proc DESKTOP_ASSIGN_STATE_IMPL
|
||||||
|
src := $6
|
||||||
|
dst := $8
|
||||||
|
|
||||||
sta RAMRDON
|
sta RAMRDON
|
||||||
sta RAMWRTON
|
sta RAMWRTON
|
||||||
A2D_CALL A2D_GET_STATE, $06
|
A2D_CALL A2D_GET_STATE, src ; grab window state
|
||||||
lda LEC25
|
|
||||||
|
lda DESKTOP_WINID ; which desktop window?
|
||||||
asl a
|
asl a
|
||||||
tax
|
tax
|
||||||
lda LDFA1,x
|
lda win_table,x ; window table
|
||||||
sta $08
|
sta dst
|
||||||
lda LDFA1+1,x
|
lda win_table+1,x
|
||||||
sta $09
|
sta dst+1
|
||||||
lda $08
|
lda dst
|
||||||
clc
|
clc
|
||||||
adc #$14
|
adc #20 ; add offset
|
||||||
sta $08
|
sta dst
|
||||||
bcc LD12E
|
bcc :+
|
||||||
inc $09
|
inc dst+1
|
||||||
LD12E: ldy #$23
|
|
||||||
LD130: lda ($06),y
|
: ldy #35 ; copy 35 bytes into window state
|
||||||
sta ($08),y
|
loop: lda (src),y
|
||||||
|
sta (dst),y
|
||||||
dey
|
dey
|
||||||
bpl LD130
|
bpl loop
|
||||||
|
|
||||||
sta RAMRDOFF
|
sta RAMRDOFF
|
||||||
sta RAMWRTOFF
|
sta RAMWRTOFF
|
||||||
rts
|
rts
|
||||||
|
.endproc
|
||||||
|
|
||||||
;; From MAIN, load AUX (X,A) into A
|
;; From MAIN, load AUX (X,A) into A
|
||||||
.proc LD13E
|
.proc DESKTOP_AUXLOAD_IMPL
|
||||||
|
.assert * = DESKTOP_AUXLOAD, error, "Entry point mismatch"
|
||||||
stx op+2
|
stx op+2
|
||||||
sta op+1
|
sta op+1
|
||||||
sta RAMRDON
|
sta RAMRDON
|
||||||
@ -13401,16 +13438,26 @@ op: lda $1234
|
|||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
.proc LD154
|
;; From MAIN, show alert with prompt #0
|
||||||
|
.proc DESKTOP_SHOW_ALERT0_IMPL
|
||||||
|
.assert * = DESKTOP_SHOW_ALERT0, error, "Entry point mismatch"
|
||||||
ldx #$00
|
ldx #$00
|
||||||
|
;; fall through
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
;; From MAIN, show alert with prompt # in X
|
||||||
|
.proc DESKTOP_SHOW_ALERT_IMPL
|
||||||
|
.assert * = DESKTOP_SHOW_ALERT, error, "Entry point mismatch"
|
||||||
sta RAMRDON
|
sta RAMRDON
|
||||||
sta RAMWRTON
|
sta RAMWRTON
|
||||||
jsr LB600
|
jsr show_alert_indirection
|
||||||
sta RAMRDOFF
|
sta RAMRDOFF
|
||||||
sta RAMWRTOFF
|
sta RAMWRTOFF
|
||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
;;; ============================================================
|
||||||
|
|
||||||
.res 154, 0
|
.res 154, 0
|
||||||
|
|
||||||
const0: .byte 0
|
const0: .byte 0
|
||||||
@ -13894,12 +13941,17 @@ run_list_entries:
|
|||||||
.res 896, 0
|
.res 896, 0
|
||||||
|
|
||||||
.byte $00
|
.byte $00
|
||||||
LDE9F: .byte $00
|
|
||||||
LDEA0: .res 256, 0
|
;; Used by DESKTOP_COPY_*_BUF
|
||||||
.byte $00
|
.assert * = DESKTOP_BUFNUM, error, "Entry point mismatch"
|
||||||
|
bufnum: .byte $00
|
||||||
|
buf3len:.byte 0
|
||||||
|
buf3: .res 256, 0
|
||||||
|
|
||||||
;; Buffer for desktop windows
|
;; Buffer for desktop windows
|
||||||
LDFA1: .addr 0,win1,win2,win3,win4,win5,win6,win7,win8
|
win_table:
|
||||||
|
.addr 0,win1,win2,win3,win4,win5,win6,win7,win8
|
||||||
|
|
||||||
.addr $0000
|
.addr $0000
|
||||||
.repeat 8,i
|
.repeat 8,i
|
||||||
.addr buf2+i*$41
|
.addr buf2+i*$41
|
||||||
@ -14117,22 +14169,16 @@ buf2: .res 560, 0
|
|||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00
|
.byte $00,$00,$00,$00,$00,$00,$00
|
||||||
|
|
||||||
LEC01: .byte $00,$1B,$80,$1B,$00,$1C,$80,$1C,$00,$1D,$80,$1D,$00,$1E,$80,$1E,$00,$1F
|
;; Used by DESKTOP_COPY_*_BUF
|
||||||
LEC13: .byte $01,$1B,$81,$1B,$01,$1C,$81,$1C,$01,$1D,$81,$1D,$01,$1E,$81,$1E,$01,$1F
|
table1: .addr $1B00,$1B80,$1C00,$1C80,$1D00,$1D80,$1E00,$1E80,$1F00
|
||||||
|
table2: .addr $1B01,$1B81,$1C01,$1C81,$1D01,$1D81,$1E01,$1E81,$1F01
|
||||||
|
|
||||||
LEC25: .byte $00,$00,$00,$00,$00,$00,$00,$00
|
.assert * = DESKTOP_WINID, error, "Entry point mismatch"
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
desktop_winid:
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
|
||||||
.byte $00
|
.byte $00
|
||||||
|
.res 64, 0
|
||||||
.word 500, 160
|
.word 500, 160
|
||||||
.byte $00,$00,$00
|
.res 150, 0
|
||||||
|
|
||||||
.res 147, 0
|
|
||||||
|
|
||||||
.assert * = $ED00, error, "Segment expected to fill through $ED00"
|
.assert * = $ED00, error, "Segment expected to fill through $ED00"
|
||||||
|
|
||||||
@ -14478,6 +14524,4 @@ app_mask:
|
|||||||
|
|
||||||
.res 70, 0
|
.res 70, 0
|
||||||
.endproc ; desktop
|
.endproc ; desktop
|
||||||
desktop_LD05E := desktop::LD05E
|
|
||||||
desktop_A2D_RELAY := desktop::A2D_RELAY
|
|
||||||
desktop_win18_state := desktop::win18::state
|
desktop_win18_state := desktop::win18::state
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user