-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathplay_dmalist.asm
159 lines (130 loc) · 2.79 KB
/
play_dmalist.asm
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
; assembly file supposed to be compiled with RASM
;
; this will generate a snapshot playing one DMA sample
;
Macro GenericDisableRom
and %11
or %10001100
ld b,#7F
out (c),a
Mend
; E : lower rom number
Macro GenericSelectLowerRom Adresse,Asic,VideoMode
if {Asic}==ON
rmr2_page=%11000
else
rmr2_page=0
endif
switch {adresse}
case #0000
; rmr2 déjà mis comme il faut
break
case #4000
if {Asic}==ON
print 'impossible de mettre la page en #4000 avec l\'asic actif'
stop
endif
rmr2_page=%01000
break
case #8000
if {Asic}==ON
print 'impossible de mettre la page en #4000 avec l\'asic actif'
stop
endif
rmr2_page=%10000
break
default
print 'impossible de selection l\'adresse ',{HEX}{adresse},' pour une ROM basse'
stop
endswitch
if {VideoMode}>7
print 'Mode video doit etre entre 0 et 3 uniquement'
stop
elseif {VideoMode}<0
print 'Mode video doit etre entre 0 et 3 uniquement'
stop
endif
ld a,rmr2_page+%10100000
add e
ld b,#7F
out (c),a
ld a,%10001000+{VideoMode} ; up deco, low co, mode 0
out (c),a
mend
ON EQU 1
OFF EQU 0
macro Asic switch
if {switch}
ld bc,#7FB8
out (c),c
else
ld bc,#7FA0
out (c),c
endif
mend
;**********************************************************
;**********************************************************
; SNAPSHOT configuration
;**********************************************************
;**********************************************************
buildsna
snaset cpc_type,4
snaset GA_ROMCFG,#8C
snaset GA_RAMCFG,#C0
snaset Z80_SP,#38
snaset Z80_IM,#1
bankset 0 ; initialisation is always starting in bank 0
run rom_init
org 0 ; very first code is always starting in adress 0
; sequence to unlock asic
unlockdata defb #ff,#00,#ff,#77,#b3,#51,#a8,#d4,#62,#39,#9c,#46,#2b,#15,#8a,#cd,#ee
; in case we need an interruption in the initialisation, we must set an interrupt vector in #38
org #38
ei
ret
rom_init
;; unlock ASIC so we can access ASIC registers (Kevin Thacker)
ld b,#bc
ld hl,unlockdata
ld e,17
.loop
inc b
outi
dec e
jr nz,.loop
Asic On
ld hl,#000 : ld (#6400),hl
ld hl,#555 : ld (#6402),hl
ld hl,#0F0 : ld (#6420),hl
megaloop
;******************************
;***** LAUNCH DMA LIST ********
;******************************
ld hl,sample
ld (#6C04),hl
ld hl,#6C06
ld (hl),0 ; registre de pause au minimum utilisable
ld hl,#6C0F
ld (hl),%10 ; DMA 1
jr $
ld hl,50*8
ld b,#F5
.novbl in a,(c) : rra : jr c,.novbl
.vbl in a,(c) : rra : jr nc,.vbl
ld a,e
ld (#6400),a
dec hl
ld a,h
or l
jr nz,.novbl
jr megaloop
;**********************************
; DMA sample MUST be aligned!!!
;**********************************
align 2
sample
defw #0700+%111000 ; ALL channels ON
defw 0,8,0,9,0,10 ; ALL volumes to ZERO
include 'sample.dma' ; generated DMA list <= PUT YOUR DMA LIST FILE HERE (text file)
defw #0700+%111111 ; channel OFF
defw #4020 ; END of DMA list