-
Notifications
You must be signed in to change notification settings - Fork 15
/
M4.asm
54 lines (40 loc) · 748 Bytes
/
M4.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
MODULE M4BOARD
@M4DisableLowerROM:
ld a, 0
ld (M4CmdBufferROMEnable), a
ld hl, M4CmdBuffer
call SendM4Command
ld bc, #7F00 + %10001001 ; Enable lower ROM to refresh M4 state
out (c), c
ret
@M4EnableLowerROM:
ld a, 1
ld (M4CmdBufferROMEnable), a
ld hl, M4CmdBuffer
call SendM4Command
ld bc, #7F00 + %10001001 ; Enable lower ROM to refresh M4 state
out (c),c
ret
DATAPORT equ #FE00
ACKPORT equ #FC00
; Send command to M4
SendM4Command:
ld bc, DATAPORT
ld d, (hl)
inc d
.sendLoop:
inc b
outi
dec d
jr nz, .sendLoop
ld bc, ACKPORT
out (c), c
ret
C_ROMLOW equ #433D
;; Variables but this resides in RAM, so that's OK
M4CmdBuffer:
db 3
dw C_ROMLOW
M4CmdBufferROMEnable:
db 0
ENDMODULE