comparison directcolor.s68 @ 11:19226d79f839

Add direct color DMA demo and converter
author Mike Pavone <pavone@retrodev.com>
date Fri, 06 Sep 2013 19:09:19 -0700
parents
children 30f1d4c90900
comparison
equal deleted inserted replaced
10:eddc4ba6b0c3 11:19226d79f839
1 dc.l $0, start
2 dc.l empty_handler
3 dc.l empty_handler
4 ;$10
5 dc.l empty_handler
6 dc.l empty_handler
7 dc.l empty_handler
8 dc.l empty_handler
9 ;$20
10 dc.l empty_handler
11 dc.l empty_handler
12 dc.l empty_handler
13 dc.l empty_handler
14 ;$30
15 dc.l empty_handler
16 dc.l empty_handler
17 dc.l empty_handler
18 dc.l empty_handler
19 ;$40
20 dc.l empty_handler
21 dc.l empty_handler
22 dc.l empty_handler
23 dc.l empty_handler
24 ;$50
25 dc.l empty_handler
26 dc.l empty_handler
27 dc.l empty_handler
28 dc.l empty_handler
29 ;$60
30 dc.l empty_handler
31 dc.l empty_handler
32 dc.l empty_handler
33 dc.l empty_handler
34 ;$70
35 dc.l HINT
36 dc.l empty_handler
37 dc.l VINT
38 dc.l empty_handler
39 ;$80
40 dc.l empty_handler
41 dc.l empty_handler
42 dc.l empty_handler
43 dc.l empty_handler
44 ;$90
45 dc.l empty_handler
46 dc.l empty_handler
47 dc.l empty_handler
48 dc.l empty_handler
49 ;$A0
50 dc.l empty_handler
51 dc.l empty_handler
52 dc.l empty_handler
53 dc.l empty_handler
54 ;$B0
55 dc.l empty_handler
56 dc.l empty_handler
57 dc.l empty_handler
58 dc.l empty_handler
59 ;$C0
60 dc.l empty_handler
61 dc.l empty_handler
62 dc.l empty_handler
63 dc.l empty_handler
64 ;$D0
65 dc.l empty_handler
66 dc.l empty_handler
67 dc.l empty_handler
68 dc.l empty_handler
69 ;$E0
70 dc.l empty_handler
71 dc.l empty_handler
72 dc.l empty_handler
73 dc.l empty_handler
74 ;$F0
75 dc.l empty_handler
76 dc.l empty_handler
77 dc.l empty_handler
78 dc.l empty_handler
79 dc.b "SEGA"
80 empty_handler:
81 rte
82 start:
83 ;background and sprite test
84
85 ButtonState equ $FFFFEFF0
86 ButtonStateNew equ ButtonState+2
87 PalAddress equ ButtonStateNew+2
88
89 CRAMXferSizeCmd equ $9308
90 CRAMDMACmd equ $C0000080
91
92 move.b #$40, $A10009
93 move.l #$C00000, a4
94 move.l #$c00004, a5
95
96 move.l #$0, a7
97
98 move.w #$8004, (a5)
99 move.w #$8104, (a5) ;turn off display
100 move.w #$8200, (a5) ;Table A = 0000
101 move.w #$8400, (a5) ;Table B = 0000
102 move.w #$857C, (a5) ;Sprite Table = F800
103 move.w #$8B00, (a5) ;set full screen vertical and horizontal scrolling
104 move.w #$8C01, (a5) ;H40 mode, no shadow/hilight, no interlace
105 move.w #$8D3F, (a5) ;H Scroll = FC00
106 move.w #$9001, (a5) ;64x32 scroll tables
107
108
109
110
111
112 move #$2300, SR
113
114 Top:
115 lea BgData(pc), a0 ;set DMA source address
116 move.l a0, d7
117 sub.l #258, d7
118 move.w #$9500, d6
119 ror.l #1, d7
120 move.b d7, d6
121 move.w d6, (a5)
122 ror.l #8, d7
123 move.b d7, d6
124 add.w #$100, d6
125 move.w d6,(a5)
126 ror.l #8, d7
127 move.b d7, d6
128 add.w #$100, d6
129 and.b #$7F, d6
130 move.w d6,(a5)
131
132 move.l #$94AE9342, (a5) ;set DMA length
133
134 move.w #$8F00, (a5) ;set auto-increment to 0
135
136 move.w #$8174, (a5)
137
138
139 move.l #$40000000, (a5) ;Setup VRAM writes
140 addq #1, a5
141 WaitVBlank:
142 btst.b #3, (a5)
143 beq.s WaitVBlank
144 WaitActive:
145 btst.b #3, (a5)
146 bne.s WaitActive
147
148 move.l d0, (a4) ;fill FIFO
149 move.l d0, (a4)
150 move.w d0, (a4)
151 subq #1, a5
152 move.w #$8114, (a5) ;turn off display
153 nop
154 nop
155 nop
156 nop
157 move.l #$C0000080, (a5)
158
159 bra Top
160
161
162
163 HINT:
164 rte
165 VINT:
166 bsr ReadPad
167 rte
168
169
170 ReadPad:
171 move.b #$FF, $a10003 ;set TH for controller A
172 move.b $a10003, d0 ;CBRLUD
173 andi.b #$3F, d0
174 move.b #0, $a10003
175 move.b $a10003, d1 ;SA00UD
176 andi.b #$30, d1
177 lsl.b #2, d1
178 or.b d1, d0 ;SACBRLUD
179 not.b d0
180 move.b (ButtonState).w, d1
181 eor.b d0, d1
182 and.b d0, d1
183 move.b d0, (ButtonState).w
184 move.b d1, (ButtonStateNew).w
185
186 rts
187
188
189 BgData:
190 incbin dcolor.bin
191