2 # --register-prefix-optional --bitwise-or
4 .macro ldarg arg, stacksz, reg
5 move.l (4 + \arg * 4 + \stacksz)(%sp), \reg
9 .global read_joy_responses /* u8 *rbuf */
52 .global test_joy_read_log /* u8 *dest, int size */
60 .macro joy_read_log_prep
66 0: /* wait for special code */
77 0: /* wait for special code to end */
82 move.l #8000000/50/18, d2
84 0: /* wait enough for teensy to setup it's stuff */
90 * when communicating with 3.3V teensy:
91 * - no nops: see old value on multiple pins randomly
92 * - 1 nop: only TR often shows old value
115 /* broken on Mega-ED v9?? */
129 /* delay for teensy, 128 not enough.. */
141 .global test_joy_read_log_vsync /* u8 *dest, int size */
142 test_joy_read_log_vsync:
145 movem.l d2-d7/a2, -(sp)
146 movea.l #0xa10003, a0
147 movea.l #0xc00005, a2
150 /* syncs, sets d0=0, d1=0x40 */
161 /* wait for next vsync */
173 movem.l (sp)+, d2-d7/a2
177 .global run_game /* u16 mapper, int tas_sync */
182 movea.l #0xa10000, a6
183 movea.l #0xc00000, a5
184 movea.l #0xc00005, a4
185 movea.l #0xc00004, a3
189 move.b d4, (0x09,a6) /* CtrlA */
190 move.b d2, (0x0b,a6) /* CtrlB */
191 move.b d2, (0x0d,a6) /* CtrlC */
192 move.b d2, (0x13,a6) /* S-CtrlA */
193 move.b d3, (0x0f,a6) /* TxDataA */
194 move.b d2, (0x19,a6) /* S-CtrlB */
195 move.b d3, (0x15,a6) /* TxDataB */
196 move.b d2, (0x1f,a6) /* S-CtrlC */
197 move.b d3, (0x1b,a6) /* TxDataC */
199 /* set up for vram write */
200 move.l #0x40000000, (a3)
203 move.l #0x10000/4/4-1, d0
215 lea (run_game_r,pc), a0
216 move.l #(run_game_r_end - run_game_r)/2-1, d0
219 lea (run_game_r_tas,pc), a0
220 move.l #(run_game_r_tas_end - run_game_r_tas)/2-1, d0
228 move.w #0x3210, (0xA13006)
230 move.w d7, (0xA13010)
231 move.w #0, (0xA13000)
239 move.w #0x3210, (0xA13006)
240 move.w d7, (0xA13010)
241 move.w #0, (0xA13000)
246 0: /* wait for special code */
257 0: /* wait for special code to end */
261 /* wait for active display */
264 btst d0, (a4) /* 8 */
270 /* flood the VDP FIFO */
280 move.l #0x93049400, (a3) /* DMALEN LO/HI = 0x0008 */
281 move.l #0x95009601, (a3) /* DMA SRC LO/MID */
282 move.l #0x977f8114, (a3) /* DMA SRC HI/MODE, Turn off Display */
283 move.l #0xc0000080, (a3) /* start DMA */
286 move.b d2, (0x09,a6) /* CtrlA */
291 # vim:filetype=asmM68k:ts=4:sw=4:expandtab