1; GEOS KERNAL by Berkeley Softworks
2; reverse engineered by Maciej Witkowiak, Michael Steil
3;
4; Dialog box: default icon callbacks
5
6.include "const.inc"
7.include "geossym.inc"
8.include "geosmac.inc"
9.include "config.inc"
10.include "gkernal.inc"
11.include "c64.inc"
12
13.ifdef wheels
14.import ChDiskDirectory
15.import DBDefIconsTabRoutine
16.import DBDefIconsTab
17.import defIconTab
18.import CallRoutine
19.endif
20
21.import RstrFrmDialogue
22
23.global DBIcCANCEL
24.global DBIcDISK
25.global DBIcYES
26.global DBIcNO
27.global DBIcOK
28.global DBIcOPEN
29.global DBKeyVector
30
31.ifdef wheels
32.global DBKeyVector2
33.global DBStringFaultVec2
34.global DoKeyboardShortcut
35.endif
36
37.segment "dlgbox1e2"
38
39DBKeyVector:
40.ifdef wheels_button_shortcuts
41	lda keyData
42	ldy #ShortcutKeysEnd - ShortcutKeys - 1
43@1:	cmp ShortcutKeys,y
44	beq DoKeyboardShortcut
45	dey
46	bpl @1
47	rts
48
49DoKeyboardShortcut:
50	tya
51	asl
52	asl
53	asl
54	tay
55	lda #0
56	sta r0L
57LF4AC:	tax
58	lda defIconTab+4,x
59	cmp DBDefIconsTab,y
60	bne LF4BD
61	lda defIconTab+4+1,x
62	cmp DBDefIconsTab+1,y
63	beq LF4CC
64LF4BD:	inc r0L
65	lda r0L
66	cmp defIconTab
67	bcs LF4CB
68	asl
69	asl
70	asl
71	bne LF4AC
72LF4CB:	rts
73LF4CC:	lda DBDefIconsTabRoutine,y
74	ldx DBDefIconsTabRoutine+1,y
75	jmp CallRoutine
76
77ShortcutKeys:
78	.byte 13, "cynod"; ok, cancel, yes, no, open, disk
79ShortcutKeysEnd:
80.else
81	CmpBI keyData, CR
82	beq DBIcOK
83	rts
84.endif
85
86.ifdef wheels_size
87DBIcDISK:
88.ifdef wheels_dialog_chdir ; "Disk" button can change directory
89; Maurice says: If your application includes a dialogue box
90; with the "DISK" icon, that's all you really need to let the
91; user select any partition or subdirectory on a CMD device or
92; a subdirectory on a native ramdisk.
93; ATTN: *requires* wheels_size!!!
94.import GetNewKernal
95.import RstrKernal
96	lda #$40 + 5
97	jsr GetNewKernal
98	jsr ChDiskDirectory
99	jsr RstrKernal
100.endif
101	lda #DISK
102	bra :+
103DBIcOK
104	lda #OK
105	bra :+
106DBIcCANCEL
107	lda #CANCEL
108	bra :+
109DBIcYES
110	lda #YES
111	bra :+
112DBIcNO
113	lda #NO
114	bra :+
115DBIcOPEN
116	lda #OPEN
117	bra :+
118DBStringFaultVec2
119	lda #DBSYSOPV
120	bra :+
121DBKeyVector2
122	lda #DBGETSTRING
123:
124.else
125DBIcOK:
126	lda #OK
127	bne DBKeyVec1
128DBIcCANCEL:
129	lda #CANCEL
130	bne DBKeyVec1
131DBIcYES:
132	lda #YES
133	bne DBKeyVec1
134DBIcNO:
135	lda #NO
136	bne DBKeyVec1
137DBIcOPEN:
138	lda #OPEN
139	bne DBKeyVec1
140DBIcDISK:
141	lda #DISK
142	bne DBKeyVec1 ; XXX
143DBKeyVec1:
144.endif
145	sta sysDBData
146	jmp RstrFrmDialogue
147
148