Controlling the marquee

From NeoGeo Development Wiki
Revision as of 06:11, 14 November 2017 by Furrtek (talk | contribs) (Forgot RTS in subroutine)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

You should let the system ROM be in charge of controlling the marquee. But if you want to try things, here's how it goes:

See the bit definitions of the REG_LEDDATA and REG_LEDLATCHES registers for more details.

The system ROM uses ~35us delays done with fall-through calls to NOPs.

move.b #$FF, REG_LEDLATCHES  ; Set clock high
jsr    wait
not.b  d0                    ; The panel # is sent inverted
move.b d0, REG_LEDDATA       ; Set panel #
move.b #$F7, REG_LEDLATCHES  ; Set clock low (latch panel #)
jsr    wait
move.b #$FF, REG_LEDLATCHES  ; Set clock back high
wait:
movem.l d0-d7/a0-a5,-(a7)    ; 120 cycles
movem.l (a7)+,d0-d7/a0-a5    ; 124 cycles
movem.l d0-d7/a0-a5,-(a7)    ; 120 cycles
movem.l (a7)+,d0-d7/a0-a5    ; 124 cycles, total = 488 cycles = 40.7us
rts