22
22
; Define the include guard and the current hardware.inc version
23
23
; (do this after the RGBDS version check since the `def` syntax depends on it)
24
24
def HARDWARE_INC equ 1
25
- def HARDWARE_INC_VERSION equs "5.2 .0"
25
+ def HARDWARE_INC_VERSION equs "6.0 .0"
26
26
27
27
; Usage: rev_Check_hardware_inc <min_ver>
28
28
; Examples:
@@ -76,6 +76,14 @@ def B_JOYP_RIGHT equ 0 ; 0 = Right is pressed (if reading Control Pad) [ro]
76
76
def JOYP_LEFT equ 1 << B_JOYP_LEFT
77
77
def JOYP_RIGHT equ 1 << B_JOYP_RIGHT
78
78
79
+ ; SGB command packet transfer uses for JOYP bits
80
+ def B_JOYP_SGB_ONE equ 5 ; 0 = sending 1 bit
81
+ def B_JOYP_SGB_ZERO equ 4 ; 0 = sending 0 bit
82
+ def JOYP_SGB_START equ %00_00_0000 ; start SGB packet transfer
83
+ def JOYP_SGB_ONE equ %00_01_0000 ; send 1 bit
84
+ def JOYP_SGB_ZERO equ %00_10_0000 ; send 0 bit
85
+ def JOYP_SGB_FINISH equ %00_11_0000 ; finish SGB packet transfer
86
+
79
87
; Combined input byte, with Control Pad in high nybble (conventional order)
80
88
def B_PAD_DOWN equ 7
81
89
def B_PAD_UP equ 6
@@ -96,7 +104,6 @@ def B_PAD_A equ 0
96
104
def PAD_B equ 1 << B_PAD_B
97
105
def PAD_A equ 1 << B_PAD_A
98
106
99
-
100
107
; Combined input byte, with Control Pad in low nybble (swapped order)
101
108
def B_PAD_SWAP_START equ 7
102
109
def B_PAD_SWAP_SELECT equ 6
@@ -222,7 +229,7 @@ def AUD1ENV_PACE equ %00000_111 ; how long between envelope iterations
222
229
; (in 64 Hz ticks, ~15.6 ms apart) [r/w]
223
230
224
231
; -- AUD1LOW / NR13 ($FF13) ---------------------------------------------------
225
- ; Audio channel 1 period (low 8 bits) [r/w ]
232
+ ; Audio channel 1 period (low 8 bits) [wo ]
226
233
def rAUD1LOW equ $ FF13
227
234
228
235
; -- AUD1HIGH / NR14 ($FF14) --------------------------------------------------
@@ -266,7 +273,7 @@ def AUD2ENV_PACE equ %00000_111 ; how long between envelope iterations
266
273
; (in 64 Hz ticks, ~15.6 ms apart) [r/w]
267
274
268
275
; -- AUD2LOW / NR23 ($FF18) ---------------------------------------------------
269
- ; Audio channel 2 period (low 8 bits) [r/w ]
276
+ ; Audio channel 2 period (low 8 bits) [wo ]
270
277
def rAUD2LOW equ $ FF18
271
278
272
279
; -- AUD2HIGH / NR24 ($FF19) --------------------------------------------------
@@ -304,7 +311,7 @@ def AUD3LEVEL_VOLUME equ %0_11_00000 ; volume level [r/w]
304
311
def AUD3LEVEL_25 equ %0_11_00000 ; 25%
305
312
306
313
; -- AUD3LOW / NR33 ($FF1D) ---------------------------------------------------
307
- ; Audio channel 3 period (low 8 bits) [r/w ]
314
+ ; Audio channel 3 period (low 8 bits) [wo ]
308
315
def rAUD3LOW equ $ FF1D
309
316
310
317
; -- AUD3HIGH / NR34 ($FF1E) --------------------------------------------------
@@ -927,15 +934,18 @@ def TILE_HEIGHT equ 8 ; height of tile in pixels
927
934
def TILE_SIZE equ 16 ; size of tile in bytes (2 bits/pixel)
928
935
929
936
def COLOR_SIZE equ 2 ; size of color in bytes (little-endian BGR555)
930
- def B_COLOR_RED equ 0 ; bits 4-0
931
- def B_COLOR_GREEN equ 5 ; bits 9-5
932
- def B_COLOR_BLUE equ 10 ; bits 14-10
937
+ def PAL_COLORS equ 4 ; colors per palette
938
+ def PAL_SIZE equ COLOR_SIZE * PAL_COLORS ; size of palette in bytes
939
+
940
+ def COLOR_CH_WIDTH equ 5 ; bits per RGB color channel
941
+ def COLOR_CH_MAX equ ( 1 << COLOR_CH_WIDTH) - 1
942
+ def B_COLOR_RED equ COLOR_CH_WIDTH * 0 ; bits 4-0
943
+ def B_COLOR_GREEN equ COLOR_CH_WIDTH * 1 ; bits 9-5
944
+ def B_COLOR_BLUE equ COLOR_CH_WIDTH * 2 ; bits 14-10
933
945
def COLOR_RED equ %000_11111 ; for the low byte
934
946
def COLOR_GREEN_LOW equ %111_00000 ; for the low byte
935
947
def COLOR_GREEN_HIGH equ %0_00000_11 ; for the high byte
936
948
def COLOR_BLUE equ %0_11111_00 ; for the high byte
937
- def PAL_COLORS equ 4 ; colors per palette
938
- def PAL_SIZE equ COLOR_SIZE * PAL_COLORS ; size of palette in bytes
939
949
940
950
; (DMG only) grayscale shade indexes for BGP, OBP0, and OBP1
941
951
def SHADE_WHITE equ %00
@@ -1001,7 +1011,7 @@ def AUD3RAM equ $FF1A ; $FF1A-$FF1E
1001
1011
def AUD4RAM equ $ FF1F ; $FF1F-$FF23
1002
1012
def AUDRAM_SIZE equ 5 ; size of each audio channel RAM in bytes
1003
1013
1004
- def _AUD3WAVERAM equ $ FF30 ; $FF30-$FF3F
1014
+ def AUD3WAVERAM equ $ FF30 ; $FF30-$FF3F
1005
1015
def AUD3WAVE_SIZE equ 16 ; size of wave pattern RAM in bytes
1006
1016
1007
1017
@@ -1032,6 +1042,22 @@ def B_BOOTUP_B_AGB equ 0
1032
1042
def BOOTUP_B_CGB equ 0 << B_BOOTUP_B_AGB
1033
1043
def BOOTUP_B_AGB equ 1 << B_BOOTUP_B_AGB
1034
1044
1045
+ ; Register C = CPU qualifier
1046
+ def BOOTUP_C_DMG equ $ 13
1047
+ def BOOTUP_C_SGB equ $ 14
1048
+ def BOOTUP_C_CGB equ $ 00 ; CGB or AGB
1049
+
1050
+ ; Register D = color qualifier
1051
+ def BOOTUP_D_MONO equ $ 00 ; DMG, MGB, SGB, or CGB or AGB in DMG mode
1052
+ def BOOTUP_D_COLOR equ $ FF ; CGB or AGB
1053
+
1054
+ ; Register E = CPU qualifier (distinguishes DMG variants)
1055
+ def BOOTUP_E_DMG0 equ $ C1
1056
+ def BOOTUP_E_DMG equ $ C8
1057
+ def BOOTUP_E_SGB equ $ 00
1058
+ def BOOTUP_E_CGB_DMGMODE equ $ 08 ; CGB or AGB in DMG mode
1059
+ def BOOTUP_E_CGB equ $ 56 ; CGB or AGB
1060
+
1035
1061
1036
1062
;******************************************************************************
1037
1063
; Aliases
0 commit comments