-
Notifications
You must be signed in to change notification settings - Fork 0
/
desktop.bas
400 lines (315 loc) · 12.2 KB
/
desktop.bas
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
0 PRINT CHR$(147)
1 POKE 53280,0: REM 1 POKE 53280,11
2 POKE 53281,0
3 POKE 646, 15
4 REM PRINT "////////////////////////////"
5 REM PRINT " RICH DESKTOP "
6 REM PRINT "////////////////////////////"
7 DELIMITER$="> "
8 LNGTH = 7:SX=0:SY=100: TMOUT=0
9 PROGRAM$(0,0)="FILES"
10 PROGRAM$(1,0)="BBS"
11 PROGRAM$(2,0)="PAINT"
12 PROGRAM$(3,0)="GAME"
13 PROGRAM$(4,0)="WORD"
14 PROGRAM$(5,0)="SHEETS"
15 PROGRAM$(6,0)="MUSIC"
16 PROGRAM$(7,0)="BASIC"
18 PROGRAM$(0,1) = "8,1"
19 PROGRAM$(1,1) = "8,1"
20 PROGRAM$(2,1) = "8,1"
21 PROGRAM$(3,1) = "8,1"
22 PROGRAM$(4,1) = "8,1"
23 PROGRAM$(5,1) = "8,1"
24 PROGRAM$(6,1) = "8,1"
25 PROGRAM$(7,1) = "8,1"
26 REM X COORD
27 XY(0,0) = 3
28 XY(1,0) = 13
29 XY(2,0) = 23
30 XY(3,0) = 33
31 XY(4,0) = 3
32 XY(5,0) = 13
33 XY(6,0) = 23
34 XY(7,0) = 33
35 REM Y COORD
36 XY(0,1) = 12
37 XY(1,1) = 12
38 XY(2,1) = 12
39 XY(3,1) = 12
40 XY(4,1) = 20
41 XY(5,1) = 20
42 XY(6,1) = 20
43 XY(7,1) = 20
100 I = 0
138 PRINT CHR$(147)
139 REM GOSUB 1071 : REM PRETTY LINES
140 ROW = 11: COL = 12: GOSUB 7000: POKE 646,2: PRINT "LOADING DESKTOP..."
141 GOSUB 6000 : REM RENDER SPRITES
142 ROW = 12: COL = 12: GOSUB 7000: PRINT " "
143 POKE V + 21,255: GOSUB 2000 : REM RENDER LIST : REM DO NOT CHANGE THIS LINE NUMBER!!!!!! WILL BREAK A FEW SPOTS
150 GOSUB 3500 : REM SET CURSOR
151 ROW = 0: COL = 25: GOSUB 7000: PRINT "DAGGATOP V0.2.4"
152 ROW = 0: COL = 0: GOSUB 7000: PRINT "[F1] HELP"
153 REM ROW = 1: COL = 0: GOSUB 7000: PRINT "F3 = CONSOLE"
154 REM ROW = 2: COL = 0: GOSUB 7000: PRINT "F5 = SCREENSAVER"
162 GOSUB 1110 : REM RENDER PROMPT
173 REM BEGIN RENDER LOOP
184 CURRENT$ = PROGRAM$(I,0): REM CURRENT SELECTION
195 GOSUB 3000 : REM GET INPUT
209 GOTO 173 : REM END RENDER LOOP
500 END
1000 REM DRAW PRETTY LINES
1001 POKE 55296,0
1019 B = 960: S = 1024: C = 55296
1020 FOR X = 0 TO 39
1029 T = S + X
1042 A = C + X
1043 POKE A, 7 : REM TOP ROW COLOR
1044 POKE A + B,2 : REM BOTTOM ROW COLOR
1045 POKE T,221 : REM TOP BORDER CHARACTER
1046 POKE T + B,221 : REM BOTTOM BORDER CHARACTER
1050 NEXT X
1059 L = 2014: R = 39
1060 FOR X = 1 TO 23
1061 H = X * 40
1062 T = S + H: V = C + H
1063 POKE V, 6 : REM LEFT BORDER COLOR
1064 POKE V + R, 6 : REM RIGHT BORDER COLOR
1065 POKE T, 221 : REM LEFT BORDER CHARACTER
1066 POKE T + R, 221 : REM RIGHT BORDER CHARACTER
1067 NEXT X
1070 RETURN
1071 REM FASTER PRETTY LINES
1072 POKE 646, 2
1073 ROW = 0: COL = 0: GOSUB 7000 : PRINT "";
1074 ROW = 24: COL = 0: GOSUB 7000: PRINT "";
1075 POKE 2023, 230
1076 POKE 56295, 2
1080 FOR L=1TO 23
1081 ROW = L: COL = 0: GOSUB 7000 : PRINT " ";
1082 NEXT
1090 POKE 646, 1
1091 RETURN
1110 REM DRAW COMMAND PROMPT
1120 ROW = 22: COL=0: GOSUB 7000: POKE 646,1
1130 PRINT " F3"
1140 PRINT " > "
1150 PRINT " ";
1161 RETURN
2000 REM RENDER LIST AND RENDER CURRENT SELECTION
2001 POKE 53280,0: POKE 53281,0
2012 FOR X = 0 TO LNGTH
2013 REM T$ = " "
2014 REM IF CURRENT$ = PROGRAM$(X,0) THEN T$ = DELIMITER$
2015 REM PRINT T$ + PROGRAM$(X, 0)
2016 REM POKE 1024 + XY(X, 0) + 40 * XY(X, 1), 127
2017 REM POKE 55296 + XY(X, 0) + 40 * XY(X, 1), 8
2020 ROW = XY(X, 1): COL = XY(X, 0): GOSUB 7000
2021 PRINT PROGRAM$(X,0)
2030 NEXT X
2031 REM UPDATE CURSOR POSITION
2032 REM GOSUB 3500
2033 RETURN
3000 REM WAIT FOR KEYBOARD INPUT AND UPDATE NAVIGATION
3001 ROW = 1: COL = 32: GOSUB 7000
3002 PRINT LEFT$(TI$, 2)":"MID$(TI$,3,2)":"RIGHT$(TI$,2)
3005 GT = GT + 1: IF GT > 40 THEN G=FRE(0): GT=0
3010 TMOUT = TMOUT + 1: IF TMOUT > 500 THEN TMOUT = 0: GOSUB 9000
3020 GET KEY$: IF KEY$ = "" THEN GOTO 3000
3030 GOSUB 3400: TMOUT = 0
3040 IF KEY$ = CHR$(13) THEN GOSUB 4000 : REM LAUNCH APP
3050 IF KEY$ = CHR$(134) THEN GOSUB 5000 : REM DIR LIST
3060 IF KEY$ = "" THEN I = I + 4
3070 IF KEY$ = "" THEN I = I + 1
3080 IF KEY$ = "" THEN I = I - 4
3090 IF KEY$ = "" THEN I = I - 1
3100 IF KEY$ = "1" THEN I = 0 : GOSUB 4000
3110 IF KEY$ = "2" THEN I = 1 : GOSUB 4000
3120 IF KEY$ = "3" THEN I = 2 : GOSUB 4000
3130 IF KEY$ = "4" THEN I = 3 : GOSUB 4000
3140 IF KEY$ = "5" THEN I = 4 : GOSUB 4000
3150 IF KEY$ = "6" THEN I = 5 : GOSUB 4000
3160 IF KEY$ = CHR$(133) THEN GOSUB 8000
3170 IF KEY$ = CHR$(135) THEN GOSUB 9000
3180 IF I > LNGTH THEN I = 0
3190 IF I < 0 THEN I = LNGTH
3200 GOSUB 3500
3210 RETURN
3400 REM CLEAR OLD CURSOR POSITION
3401 POKE (1024 + XY(I, 0) + 40 * XY(I, 1)) - 1, 32
3499 RETURN
3500 REM SET NEW CURSOR POSITION
3501 POKE (1024 + XY(I, 0) + 40 * XY(I, 1)) - 1, 250 :REM 90
3502 POKE (55296 + XY(I, 0) + 40 * XY(I, 1)) - 1,13
3530 REM FOR X = 0 TO 12
3531 REM SX = SX + X
3540 REM POKE V + 0,SX : REM UPDATE X COORDINATES
3550 REM POKE V + 1,SY : REM UPDATE Y COORDINATES
3560 REM NEXT X
3600 REM POKE V + 0,XY(I, 0) * 10
3610 REM POKE V + 1,XY(I, 1) * 10
3700 RETURN
4000 REM LAUNCH APP
4001 ROW = 12: COL = 12: GOSUB 7000: PRINT "LAUNCHING APP " + CURRENT$
4002 REM POKE 53280,11
4003 REM POKE 53281,15
4004 REM POKE 646, 0
4022 POKE V + 21,0 : REM DISABLE SPRITES
4033 IF CURRENT$ = "BASIC" THEN SYS 64738
4040 REM DYNAMIC KEYBOARD LOADER EXAMPLE
4055 REM CHR$(34) IS FOR QUOTE MARKS. PRINTS AT PROPER PLACE
4060 PRINT "LOAD";CHR$(34);PROGRAM$(I,0);CHR$(34);",";PROGRAM$(I,1)
4075 PRINT:PRINT:PRINT:PRINT:PRINT"RUN"
4080 PRINT"":POKE198,2:POKE631,13:POKE632,13:END
4095 REM 198=NUMBER OF CHARACTERS IN KEYBOARD BUFFER. 13=RETURN
4100 RETURN
5000 ROW = 0: COL = 0: GOSUB 7000
5005 POKE 19,65
5006 REM POKE 53280,12: POKE 53281,12
5010 POKE V + 21,0 : REM DISABLE SPRITES
5020 PRINT CHR$(147)
5025 GOSUB 11000
5030 REM GOSUB 10000 : REM DIR LISTING
5035 PRINT ""
5036 PRINT ""
5037 POKE 646,1
5040 INPUT "> "; IP$
5041 PRINT ""
5042 POKE 646,15
5050 IF IP$ = "EXIT" THEN PRINT CHR$(147): POKE V + 21,255 : GOSUB 143: GOSUB 5035
5060 IF IP$ = "DIR" THEN GOSUB 10000: GOSUB 5035
5061 IF IP$ = "LS" THEN GOSUB 10000: GOSUB 5035
5070 IF IP$ = "HELP" THEN GOSUB 11000: GOSUB 5035
5080 IF LEFT$(IP$,4) = "LOAD" THEN PRINT "";IP$","II$:PRINT:PRINT:PRINT:PRINT:PRINT"RUN":PRINT"":POKE198,2:POKE631,13:POKE632,13:END
5090 IF LEFT$(IP$,4) = "POKE" THEN PRINT "";IP$","II$:PRINT:PRINT:PRINT:PRINT"":POKE198,2:POKE631,13:POKE632,13: END
5095 REM ELSE
5100 OPEN 15,8,15,IP$:CLOSE 15
5110 PRINT ""
5120 GOSUB 10000
5800 GOTO 5035
5900 RETURN
6000 REM SPRITES
6010 V = 53248 : REM START OF DISPLAY CHIP
6011 POKE V + 21,255 : REM ENABLE SPRITE 2 AND 3
6012 POKE 2040,248 : REM SPRITE 2 DATA FROM BLOCK 13 : ICON FILES
6013 POKE 2041,249 : REM ICON TERMINAL
6014 POKE 2042,250 : REM ICON PAINT
6015 POKE 2043,251 : REM ICON GAME
6016 POKE 2044,252 : REM ICON WORD
6017 POKE 2045,253 : REM ICON SHEETS
6018 POKE 2046,254 : REM ICON MUSIC
6019 POKE 2047,255 : REM ICON BASIC
6020 POKE V + 39,3 : REM FILE ICON
6021 POKE V + 40,13 : REM BBS
6022 POKE V + 41,7 : REM PAINT
6023 POKE V + 42,2 : REM GAME
6024 POKE V + 43,1 : REM WORD
6025 POKE V + 44,6 : REM SHEETS
6026 POKE V + 45,10 : REM MUSIC
6027 POKE V + 46,14 : REM BASIC
6033 POKE 646,3
6034 FOR N = 0 TO 511 : READ Q : POKE 15872+N,Q :
6035 PRINT "";: NEXT : REM LOADS SPRITE INTO MEM SOMEHOW
6036 PRINT CHR$(147): POKE 646,1
6040 POKE 53264,PEEK(53264) OR 136: REM SIGNIFICANT BIT FOR SPRITE 4 AND 8
6045 POKE V + 23,255 : POKE V + 29,255 : REM EXPAND SPRITE
6080 POKE V + 0, 45 : REM FILES
6090 POKE V + 1, 100
6091 POKE V + 2, 125 : REM TERMINAL
6092 POKE V + 3, 100
6093 POKE V + 4, 205 : REM PAINT
6094 POKE V + 5, 100
6095 POKE V + 6, 29 : REM GAMES
6096 POKE V + 7, 100
6097 POKE V + 8, 45 : REM WORD
6098 POKE V + 9, 160
6099 POKE V + 10, 125 : REM SHEETS
6100 POKE V + 11, 160
6101 POKE V + 12, 205 : REM MUSIC
6102 POKE V + 13, 160
6111 POKE V + 14, 29 : REM BASIC
6112 POKE V + 15, 160
6199 REM SELECTOR ICON
6300 DATA 255,255,255,255,255,255,255,255,255,255,255,252,255,255,252,255,255,255,255,255
6310 DATA 255,255,231,255,255,219,255,255,219,255,255,231,255,255,255,255,255,255,255,255
6320 DATA 231,255,255,231,255,255,231,255,255,231,255,255,231,255,255,255,255,255,255,255
6330 DATA 255,255,255,1,0,255,0,3,0,192,12,114,48,16,251,8,33,255,132,33,255,196,64,127
6340 DATA 194,64,63,98,128,30,33,128,12,1,128,8,1,128,12,1,128,31,1,64,63,130,64,31,2,32
6350 DATA 14,4,32,14,4,16,6,8,12,4,48,3,30,192,0,255,0,1,0,8,0,0,20,0,1,231,0,7,195,192
6360 DATA 15,137,224,28,132,240,56,128,248,56,64,252,120,65,252,124,235,252,115,235,252
6370 DATA 97,235,248,97,235,248,115,235,240,127,235,112,62,107,32,30,107,128,15,235,128
6380 DATA 3,235,0,0,8,0,0,0,0,1,0,28,0,0,34,0,0,69,0,0,69,0,0,65,0,0,34,0,0,28,0,0,20,0
6390 DATA 0,20,0,0,20,0,0,20,0,0,28,0,0,34,0,0,127,0,0,255,128,7,255,240,8,0,8,8,0,8,15
6400 DATA 255,248,15,255,248,7,255,240,1,63,255,192,63,255,208,63,255,216,63,255,192,63
6410 DATA 255,252,56,0,60,63,255,252,56,64,188,63,255,252,60,96,252,63,255,252,56,30,124
6420 DATA 63,255,252,60,0,252,63,255,252,60,112,124,63,255,252,63,0,124,63,255,252,63,255
6430 DATA 252,63,255,252,1,0,0,0,121,139,230,122,235,234,122,219,234,121,187,230,127,251
6440 DATA 254,0,0,0,127,251,254,127,251,254,127,251,254,127,251,254,0,0,0,127,251,254,127
6450 DATA 251,254,127,251,254,127,251,254,0,0,0,127,251,254,127,251,254,127,251,254,0,0
6460 DATA 0,1,0,112,0,0,124,0,0,63,0,0,55,192,0,48,224,0,48,0,0,16,0,0,24,0,0,24,0,0,24
6470 DATA 0,0,12,0,0,124,0,1,254,0,3,255,0,3,255,0,3,255,0,3,255,0,1,254,0,0,252,0,0,112
6480 DATA 0,0,0,0,1,0,0,0,3,254,0,7,254,0,15,254,0,15,254,0,31,254,0,31,129,255,63,1,254
6490 DATA 63,1,252,63,1,248,63,1,240,63,0,0,63,1,240,63,1,248,63,1,252,31,1,254,31,129
6500 DATA 255,15,254,0,15,254,0,7,254,0,3,254,0,1
6700 RETURN
7000 POKE 780,0 : REM FUNCTION TO SET TEXT POSITION X/Y
7010 POKE 781,ROW
7020 POKE 782,COL
7030 SYS 65520
7040 RETURN
8000 ROW = 23: COL = 6: GOSUB 7000
8010 PRINT "MOVE=ARROW KEYS. RUN=RETURN"
8100 RETURN
9000 REM SCREENSAVER
9004 PRINT CHR$(147)
9005 POKE V + 21,0 : REM DISABLE SPRITES
9006 POKE 646,5
9007 POKE 53280,0
9008 POKE 53281,0
9009 REM POKE 646, INT(RND(1)*16)
9011 ROW = 24: COL = 0: GOSUB 7000:
9012 PRINT "> DUMP MEMORY 0-64K "
9016 ROW = 0: COL = 0: GOSUB 7000:
9017 BV=0: BC=5: W=1104: BN=13:CV=0
9018 IF BV < 1 THEN BV = 1: BR=BV+110
9020 A = PEEK(BV) AND 255: D=256:
9030 IF W = 1104 THEN ROW=0: COL=10: GOSUB 7000: POKE646,1 : PRINT " " :
9040 IF W = 1104 THEN ROW=0: COL=13: GOSUB 7000: POKE646,INT(RND(1)*15)+1: PRINT BV "-" BR
9050 FORM=0TO6: POKE 55296 - 1024 + W,1: POKE W,97: BC=BN : IF INT(RND(1)*6) = 1 THEN BC = BN:REM13
9060 D=D/2:B=INT(A / D)
9070 A = A - (B * D):
9080 POKE W,ASC(RIGHT$(STR$(B),1)):POKE 55296 - 1024 + W, BC: W=W+1: IF W >= 2024 THEN W = 1104: BR=A+110: G=FRE(0)
9090 NEXT
9100 POKE W,ASC(RIGHT$(STR$(A),1)): POKE 55296 - 1024 + W, BC: W=W+1: IF W >= 2024 THEN W = 1104: BR=A+110: G=FRE(0)
9110 BN = 5
9120 REM BN = INT(RND(1)*15)+1
9130 REM PRINT "DEBUG >" BV
9140 GET KEY$
9150 IF KEY$ = "+" THEN BV=BR+1: BR = BV + 110: W = 1104: GOTO 9018
9160 IF KEY$ = "-" THEN BV=BR-221: BR = BR - 111: W = 1104: GOTO 9018
9170 IF NOT KEY$ = "" THEN POKE 646, 1: PRINT CHR$(147) : G=FRE(0): GOTO 143:
9180 BV = BV + 1: IF BV > 65534 THEN BV = 1: BC =5
9190 IF BV <= 1 THEN BV = 1: BC =5
9200 IF CV = 1 THEN BN = 13: CV = 0: GOTO 9018
9210 IF CV = 0 THEN BN = 5: CV = 1: GOTO 9018
9500 RETURN
10000 REM DIR
10006 D=PEEK(186):REM LAST USED DRIVE NUMBER, YOU CAN FORCE 8 IF < 8
10010 SYS57812"$",D:POKE43,1:POKE44,192:POKE768,174:POKE769,167:SYS47003,1
10020 POKE782,192:SYS65493:SYS42291:LIST:POKE44,8:POKE768,139:POKE769,227
10030 RETURN
11000 REM HELP
11010 PRINT "DAGGA/DOS 0.2.4"
11020 PRINT ""
11025 POKE 646,15
11030 PRINT "VALID COMMANDS: DIR LS CD LOAD HELP EXIT"
11035 POKE 646,3
11040 PRINT "": PRINT "ALL OTHER COMMANDS SENT RAW TO SD2IEC": PRINT ""
11045 POKE 646,15
11050 PRINT "CD// - ROOT DIRECTORY"
11060 PRINT "CD/MYDIR - CHANGE TO A DIRECTORY"
11061 PRINT "CD MYIMAGE.D64 - MOUNT DISK IMAGE"
11062 PRINT "CD - GO UP ONE LEVEL"
11070 POKE 646,1
11100 RETURN