gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
gbdk-lib/libc/targets/sm83/cgb.s
1 .include "global.s"
2
3 .title "CGB support"
4 .module CGB
5
6 .area _CODE
7
8 _cpu_slow::
9 LDH A, (rKEY1)
10 AND #0x80 ; Is GBC in double speed mode?
11 RET Z ; No, already in single speed
12
13 .shift_speed:
14 LDH A, (rIE)
15 PUSH AF
16
17 XOR A ; A = 0
18 LDH (rIE), A ; Disable interrupts
19 LDH (rIF), A
20
21 LD A, #0x30
22 LDH (rP1), A
23
24 LD A, #0x01
25 LDH (rKEY1), A
26
27 STOP
28
29 POP AF
30 LDH (rIE), A
31
32 RET
33
34 _cpu_fast::
35 LDH A, (rKEY1)
36 AND #0x80 ; Is GBC in double speed mode?
37 RET NZ ; Yes, exit
38 JR .shift_speed
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.