megaed-sv: input latency test
[megadrive.git] / megaed-sv / asmtools.s
1 # Assemble with gas
2 #   --register-prefix-optional --bitwise-or
3
4 .macro ldarg  arg, stacksz, reg
5     move.l (4 + \arg * 4 + \stacksz)(%sp), \reg
6 .endm
7
8
9 .globl read_joy_responses /* u8 *rbuf */
10 read_joy_responses:
11     ldarg       0, 0, a1
12     movem.l     d2-d7, -(sp)
13     movea.l     #0xa10003, a0
14     move.b      #0x40, (6,a0)
15     move.b      #0x40, (a0)
16
17 .macro one_test val
18     move.l      #100/12-1, d0
19 0:
20     dbra        d0, 0b
21     move.b      \val, d0
22     move.b      d0, (a0)
23     move.b      (a0), d0
24     move.b      (a0), d1
25     move.b      (a0), d2
26     move.b      (a0), d3
27     move.b      (a0), d4
28     move.b      (a0), d5
29     move.b      (a0), d6
30     move.b      (a0), d7
31     move.b      d0, (a1)+
32     move.b      d1, (a1)+
33     move.b      d2, (a1)+
34     move.b      d3, (a1)+
35     move.b      d4, (a1)+
36     move.b      d5, (a1)+
37     move.b      d6, (a1)+
38     move.b      d7, (a1)+
39 .endm
40
41         move.w          #0x2700, sr
42     one_test    #0x00
43     one_test    #0x40
44     one_test    #0x00
45     one_test    #0x40
46     one_test    #0x00
47         move.w          #0x2000, sr
48     movem.l     (sp)+, d2-d7
49     rts
50
51
52 # vim:filetype=asmM68k:ts=4:sw=4:expandtab