-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsound.s
executable file
·538 lines (448 loc) · 9.06 KB
/
sound.s
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
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
; The Paralax distorter by Gunstick from Unlimited Matricks
parallax equ 0
parallay equ 0
bus equ 10
digitest equ 10
; config:
def_version equ 10
d0_for_mcp equ 0
mcp_adr equ $500
keyboard set 10
test equ 10
ifeq def_version
opt d-
org $2500
keyboard set 0
endc
section text
ifne def_version
pea start(pc)
move.w #38,-(sp)
trap #14
addq.l #6,sp
clr.w -(sp)
trap #1
endc
start:
lea oldcpu(pc),a0
move.l sp,(a0)+
lea my_stack,sp
move.w sr,(a0)+
move.w #$2700,sr
move.l usp,a1
move.l a1,(a0)+
ifne def_version
moveq #$12,d0
bsr ikbd_wrt
moveq #$1a,d0
bsr ikbd_wrt
move.l $408.w,old_408
move.l #exit_with_408,$408.w
endc
lea oldvideo(pc),a0
move.b $ffff8260.w,(a0)+
move.b $ffff820a.w,(a0)+
move.l $ffff8200.w,(a0)+
movem.l $ffff8240.w,d0-d7
movem.l d0-d7,(a0)
movem.l black(pc),d0-d7
movem.l d0-d7,$ffff8240.w
lea oldvectors(pc),a0
move.l $68.w,(a0)+
move.l $70.w,(a0)+
move.l $114.w,(a0)+
move.l $118.w,(a0)+
move.l $120.w,(a0)+
move.l $134.w,(a0)+
move.l #nix,$68.w
move.l #nix,$70.w
move.l #nix,$114.w
ifeq keyboard
move.l #nix,$118.w
endc
move.l #nix,$120.w
move.l #nix,$134.w
lea oldmfp(pc),a0
move.b $fffffa07.w,(a0)+
move.b $fffffa09.w,(a0)+
move.b $fffffa13.w,(a0)+
move.b $fffffa15.w,(a0)+
move.b $fffffa17.w,(a0)+
move.b $fffffa19.w,(a0)+
move.b $fffffa1b.w,(a0)+
move.b $fffffa1d.w,(a0)+
bclr #3,$fffffa17.w
clr.b $fffffa07.w
ifeq keyboard
clr.b $fffffa09.w
endc
ifne keyboard
move.b #%01000000,$fffffa09.w
endc
bsr waitvbl1
move.b #0,$ffff8260.w
move.b #2,$ffff820a.w
bsr psginit
bsr mfp_test
; jmp screen
back:
lea my_stack,sp
bsr psginit
lea oldmfp(pc),a0
move.b (a0)+,$fffffa07.w
move.b (a0)+,$fffffa09.w
move.b (a0)+,$fffffa13.w
move.b (a0)+,$fffffa15.w
move.b (a0)+,$fffffa17.w
move.b (a0)+,$fffffa19.w
move.b (a0)+,$fffffa1b.w
move.b (a0)+,$fffffa1d.w
lea oldvectors(pc),a0
move.l (a0)+,$68.w
move.l (a0)+,$70.w
move.l (a0)+,$114.w
move.l (a0)+,$118.w
move.l (a0)+,$120.w
move.l (a0)+,$134.w
move.b #2,$ffff820a.w
bsr.s waitvbl1
move.b #0,$ffff820a.w
bsr.s waitvbl1
move.b #2,$ffff820a.w
bsr.s waitvbl1
lea oldvideo(pc),a0
move.b (a0)+,$ffff8260.w
move.b (a0)+,$ffff820a.w
move.l (a0)+,$ffff8200.w
movem.l (a0),d0-d7
movem.l d0-d7,$ffff8240.w
ifne def_version
moveq #$14,d0
bsr.s ikbd_wrt
moveq #$8,d0
bsr.s ikbd_wrt
endc
lea oldcpu(pc),a0
move.l (a0)+,sp
move.w (a0)+,sr
move.l (a0)+,a1
move.l a1,usp
ifne def_version
move.l old_408(pc),$408.w
rts
endc
ifeq def_version
moveq #d0_for_mcp,d0
jsr mcp_adr+0.w
endc
psginit:
moveq #15,d0
lea psginittab,a1
lea $ffff8800.w,a0
nextinit:
move.b (a1)+,(a0)
move.b (a1)+,2(a0)
dbf d0,nextinit
; move.b #7,(a0)
; move.b #$7f,2(a0)
; move.b #14,(a0)
; move.b #$26,2(a0)
rts
waitvbl1:
move.w #9000,d0
waitvbl2:
dbf d0,waitvbl2
waitvbl:
lea $ffff8209.w,a0
movep.w -8(a0),d0
waitvbl3:
tst.b (a0)
bne.s waitvbl3
movep.w -4(a0),d1
cmp.w d0,d1
bne.s waitvbl3
rts
ikbd_wrt:
lea $fffffc00.w,a0
ik_wait:
move.b (a0),d1
btst #1,d1
beq.s ik_wait
move.b d0,2(a0)
rts
mfp_test:
move.w #$2700,sr
bsr.s waitvbl
bsr.s waitvbl
move.b #0,$fffffa19.w
move.b #255,$fffffa1f.w
move.b #$20,$fffffa07.w
move.b #0,$fffffa13.w
moveq #30,d1
lea $ffff8209.w,a0
check_mfp_s1:
move.b (a0),d0
beq.s check_mfp_s1
sub.w d0,d1
lsl.w d1,d1
move.b #0,$fffffa0b.w
move.b #1,$fffffa19.w
moveq #-1,d0
mfp_test_loop:
dbf d0,mfp_test_loop
moveq #0,d0
move.b $fffffa1f.w,d0
move.b #0,$fffffa19.w
cmp.w #$9b,d0
ble.s mfp_of_my_st
move.w #-1,mfp_type
mfp_of_my_st:
rts
ifne def_version
dc.l 'XBRA'
dc.l 'TFSY'
old_408:
dc.l 0
exit_with_408:
bsr.s exit
move.l old_408(pc),a0
jmp (a0)
endc
exit:
movem.l black(pc),d0-d7
movem.l d0-d7,$ffff8240.w
bra back
nix:
rte
oldcpu: ds.w 4
oldvideo: ds.w 19
oldvectors: ds.l 6
oldmfp: ds.w 5
mfp_type: ds.w 1
black: ds.l 16
****************************************************************
;overscan:equ 0
; Double Megadistorter by Gunstick (c) ULM 1990
; we know! it's long, but it works ! And it's from ULM !!!
; dc.w $c8*4
; dc.w 138*4
dc.w 195*4
; dc.w 167*4
; dc.w 197*4
; dc.w 167*4
; dc.w 255*4
dc.w 128*4
digisound:
; incbin "includes\telgraph.dmn"
; incbin "includes\jasy75.dmn"
; incbin "includes\senn_l1.dmn"
; incbin "includes\senn_l2.dmn"
; incbin "includes\luna.dmn"
; incbin "includes\luna2.dmn"
; incbin "includes\infinity.dmn"
digiend:
dc.w 159*4
digisound2:
digiend2:
even
font:
even
fontend:
kotz:
dc.l 0
noswreset:
rts
;--------------------------------------------------------
calc_mdist MACRO
move.w (a3)+,d6
sub.w (a4)+,d6
movem.l (a5,d6),d3/d4/d5/d6
ENDM
do_mdist MACRO
lea 64(a5),a5
move.b #1,$ffff8260.w ;GunsticK's right border end switch
move.b #0,$ffff8260.w
movem.l d3/d4/d5,$ffff8250.w ;mdist
; move.l buffer,buffer
; dcb 9,$4e71
move.b #2,$ffff8260.w ;Open left border
move.b #0,$ffff8260.w
move.l d6,$ffff825c.w ;mdist
; dcb 4,$4e71
ENDM
calc_mdist2 MACRO
move.w (a3)+,d6
sub.w (a4)+,d6
movem.l (a5,d6),d4/d5/d6/a2
ENDM
do_mdist2 MACRO
lea 64(a5),a5
move.b #1,$ffff8260.w ;GunsticK's right border end switch
move.b #0,$ffff8260.w
movem.l d4/d5/d6,$ffff8250.w ;mdist
; move.l buffer,buffer
; dcb 9,$4e71
move.b #2,$ffff8260.w ;Open left border
move.b #0,$ffff8260.w
move.l a2,$ffff825c.w ;mdist
; dcb 4,$4e71
ENDM
calc_mdist02 MACRO
move.w (a3)+,d6
sub.w (a4)+,d6
movem.l (a5,d6),d2/d4/d5/d6
ENDM
do_mdist02 MACRO
lea 64(a5),a5
move.b #1,$ffff8260.w ;GunsticK's right border end switch
move.b #0,$ffff8260.w
movem.l d2/d4/d5,$ffff8250.w ;mdist
; dcb 9,$4e71
move.b #2,$ffff8260.w ;Open left border
move.b #0,$ffff8260.w
move.l d6,$ffff825c.w ;mdist
; dcb 4,$4e71
ENDM
dcb 17-1-11,$4e71
moveq #0,d7
; megadistorter test
; lea 0(a0,d7),a0
movem.l (a0),d4/d5/d6/d7
digi1 MACRO
; not.w kotz
; bne.s *+4
; illegal
ifne digitest
moveq #-1,d6 ;~1
move.b (a6),d6 ;~2
add.w d6,d6 ;~1
add.w (a7,d6),d7 ;~4
endc
ifeq digitest
move.w #$700,$ffff8240.w
move.w #$200,$ffff8240.w
endc
andi.w #$ff*4,d7 ;~2
move.l (a7,d7),d6
movep.l d6,$ffff8800-512-downthere(a7) ;~7
ENDM
digi2 MACRO
; not.w kotz
; beq.s *+4
; illegal
ifne digitest
moveq #-1,d6 ;~1
move.b (a6)+,d6 ;~2
add.w d6,d6 ;~1
add.w 2(a7,d6),d7 ;~4
endc
ifeq digitest
move.w #$070,$ffff8240.w
move.w #$020,$ffff8240.w
endc
andi.w #$ff*4,d7 ;~2
move.l (a7,d7),d6 ;~5
movep.l d6,$ffff8800-512-downthere(a7) ;~7
ENDM
even
;**********************************************************
prt:
dc.b 27,"Y",32+20,32+1," 000"
str: dc.b "0 ",0
even
psginittab:dc.b 0,$ff,1,$ff,2,$ff,3,$ff,4,$ff,5,$ff,6,0
dc.b 7,%11111111,8,16,9,0,10,0,11,60,12,0,13,14,$ff,0
even
hwpalette:
dc.w $000,$227,$005,$654,$543,$432,$321,$777
; dc.w $000,$227,$005,$740,$730,$720,$710,$777
dc.w $777,$666,$555,$444,$333,$222,$111,$002
dc.w $0700,$0707,$0474,$0777,$0606,$0505,$0404,$303
graphic:
dc.w $d555,$3333,$0f0f,$ff
cheatcodepos:
dc.l cheatcode
cheatcode: ; B U S cr
dc.b 48,22,48+$80,31,22+$80,28,31+$80,28+$80,0
even
lowbyte:
dc.b 0
even
hwscrolldat:
even
section bss
bss_start: ;here starts the bss
screenad: ds.l 1
ds.l 20
my_stack:
stack: ds.l 1
oldpal: ds.w 16
oldres: ds.w 1
screenad1:ds.w 1
screenad2:ds.l 1
screenadr:ds.l 1
resync: ds.w 1
digswitch: ds.w 1 ;use digi1 or digi2
logbase: ds.l 1 ;screen where to put scroll
tabentry:
ds.l 1 ;for hwscroll
cpybufdest:
ds.l 1 ;copy from (this+4buffers-1scroll) to (this)
shiftcnt:
ds.w 1 ;counter for shifter
count:
ds.l 1 ;for some dbf without register
nextscrn:
ds.l 1 ;points to next screenadress to be used
distcalc:
ds.w 1
distwaveptr:
ds.l 1 ;pointer in one distwave
wavetabptr:
ds.l 1 ;pointer to the next wave to be played
disttableptr:
ds.l 1 ;pointer to scrolldisttable
disttable:
ds.w 20*2 ;scrolldisttable
digiptr:
ds.l 1 ;ptr to begin digi after vbl
predigi:
ds.l 40 ;40 lines predigitized (20*2 values)
mactcurv:
ds.l 1 ;ptr in active curve
mnextcurv:
ds.l 1 ;next mdist curv
mdistcurvval:
ds.w 1 ;curve
mdistcurvptr:
ds.l 1
mdistadjustptr:
ds.l 1 ;pointer to the distorter adjust table
mdistadjust:
ds.w 300*2 ;adjusttable for the two distorters
linebuffbegin:
textptr:
ds.l 1 ;letter not completly copied into buffer (forward)
bufptr:
ds.l 1 ;pos where graphic is added in preshift 0
bufcnt:
ds.w 1 ;which one of the 26 routs to be used to copy
shift:
ds.w 1 ;which preshift to copy
buffer:
ds.l 2*26*16 ;16 shifts of the 1st line of the scrolling
linebuffend:
; ds.l 1
; ds.l 1
; ds.w 1
; ds.w 1
ds.l 2*26*16+1+1+1
screenmem:
ds.w 230*6
ecran:
rept 5
ds.l 15700
endr
endprg:
bss_end: ;here ends the bss
end