-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeviceutils.asm
More file actions
194 lines (156 loc) · 3.47 KB
/
deviceutils.asm
File metadata and controls
194 lines (156 loc) · 3.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
;===============================================================================
; Device utility functions
;===============================================================================
;
; Utility function : display device status for load/save operations
;
Align
showdevstatus
LDX #$16
LDY #$00
CLC
JSR krnl_plot
LDX #$00
printstatus ; print "STATUS: "
LDA datastatus,X
JSR krnl_chrout
INX
CPX #$08
BNE printstatus
LDX #$00
storvars ; save program variables ($A8 - $BD)
LDA charmemposlo,X
STA varssavearea,X
INX
CPX #$16
BNE storvars
LDA #$00
STA devicestatus
LDA #$08
STA devicenum
JSR krnl_talk
LDA #$6F
STA filesecaddr
JSR krnl_tksa
getdevstatus
LDY devicestatus
BNE devstatusdone
JSR krnl_iecin
JSR krnl_chrout
CMP #$0D
BNE getdevstatus
devstatusdone
JSR krnl_untlk
waitkeyspc
JSR krnl_scnkey
JSR krnl_getin
CMP keyspace
BNE waitkeyspc
LDX #$00 ; restore program variables ($A8 - $BD)
loop26
LDA varssavearea,X
STA charmemposlo,X
INX
CPX #$16
BNE loop26
RTS
;
; Utility function : display device (disc) directory
;
Align
showdevdir
LDA storagedevnum
CMP key1
BNE begindevdir
RTS
begindevdir
LDX #$00
stordevdirvars ; save program variables ($A8 - $BD)
LDA charmemposlo,X
STA varssavearea,X
INX
CPX #$16
BNE stordevdirvars
JSR krnl_clrscrn
LDA storagedevnum
CMP key8
BNE listseconddisc
LDA key0
STA tempsave2
LDA #$02
STA tempsave3
JMP listdevdir
listseconddisc
LDA key1
STA tempsave2
LDA #$02
STA tempsave3
listdevdir
LDA #$00
STA devicestatus
LDA #$24
STA tempsave1
LDA #$FB
STA filenamelo
LDA #$00
STA filenamehi
LDA tempsave3
STA filenamlen
LDA #$08
STA devicenum
LDA #$60
STA filesecaddr
JSR krnl_prtloading
LDA devicenum
JSR krnl_talk
LDA filesecaddr
JSR krnl_tksa
LDY devicestatus
getdevdir
BNE listdevdirend
LDY #$06
nextdevdir
STY tempsave1
JSR krnl_iecin
LDX tempsave2
STA tempsave2
LDY devicestatus
BNE listdevdirend
LDY tempsave1
DEY
BNE nextdevdir
LDY tempsave2
JSR krnl_linprt
LDA keyspace
JSR krnl_chrout
readdevdir
JSR krnl_iecin
LDX devicestatus
BNE listdevdirend
TAX
BEQ enddevdiritem
JSR krnl_chrout
JMP readdevdir
enddevdiritem
LDA keyreturn
JSR krnl_chrout
LDA keybdmatrix
CMP #$3F
BEQ listdevdirend
LDY #$04
BNE nextdevdir
listdevdirend
JSR krnl_closefile
LDX #$00
setdevdirvars ; restore program variables ($A8 - $BD)
LDA varssavearea,X
STA charmemposlo,X
INX
CPX #$16
BNE setdevdirvars
waitdevdirspc
JSR krnl_scnkey
JSR krnl_getin
CMP keyspace
BNE waitdevdirspc
RTS