├── .gitignore ├── .vscode └── settings.json ├── Makefile ├── README.md └── src ├── common ├── ags-aging-font.png ├── ags-aging-font.xcf ├── common.asm └── hardware.inc ├── window_y_trigger └── window_y_trigger.asm └── window_y_trigger_wx_offscreen └── window_y_trigger_wx_offscreen.asm /.gitignore: -------------------------------------------------------------------------------- 1 | *.chr 2 | *.gb 3 | *.o 4 | 5 | release.zip -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rgbdsz80.includePath": ["src/common"] 3 | } -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ASM=rgbasm -i src/common 2 | 3 | gb = \ 4 | src/window_y_trigger/window_y_trigger.gb \ 5 | src/window_y_trigger_wx_offscreen/window_y_trigger_wx_offscreen.gb 6 | 7 | all: $(gb) 8 | 9 | ags-aging-font.chr: 10 | rgbgfx src/common/ags-aging-font.png -o src/common/ags-aging-font.chr 11 | 12 | %.o: %.asm ags-aging-font.chr 13 | $(ASM) -o $@ $< 14 | 15 | $(gb): %.gb: %.o .FORCE 16 | rgblink -o $@ $< 17 | rgbfix -v -p 0 $@ 18 | 19 | # Always force a clean rebuild, this is Game Boy assembly, builds are fast. 20 | .PHONY: .FORCE 21 | 22 | .PHONY: clean 23 | clean: 24 | rm -f src/window_y_trigger/window_y_trigger.o 25 | rm -f src/window_y_trigger/window_y_trigger.gb 26 | rm -f src/window_y_trigger_wx_offscreen/window_y_trigger_wx_offscreen.o 27 | rm -f src/window_y_trigger_wx_offscreen/window_y_trigger_wx_offscreen.gb 28 | rm -f src/common/ags-aging-font.chr 29 | 30 | rm -f release.zip 31 | 32 | # -j Store the file name only, ignore the path. 33 | release: all 34 | zip -j release.zip $(gb) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TurtleTests 2 | A suite of test ROMs for the Game Boy and Game Boy Color. 3 | -------------------------------------------------------------------------------- /src/common/ags-aging-font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Powerlated/TurtleTests/b341ff54ec1e6a501d37dd309c556b6968a07eec/src/common/ags-aging-font.png -------------------------------------------------------------------------------- /src/common/ags-aging-font.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Powerlated/TurtleTests/b341ff54ec1e6a501d37dd309c556b6968a07eec/src/common/ags-aging-font.xcf -------------------------------------------------------------------------------- /src/common/common.asm: -------------------------------------------------------------------------------- 1 | include "hardware.inc" 2 | 3 | SECTION "Common", ROMX, BANK[1] 4 | 5 | ; Safely disables the LCD. 6 | DisableLCD: 7 | ; If the LCDC is already disabled, return. 8 | ld a, [rLCDC] 9 | and a, %10000000 10 | ret z 11 | .loop: 12 | 13 | ld a, [rLY] 14 | cp $90 ; Check if the LCD is past VBlank 15 | jr nz, .loop 16 | 17 | xor a 18 | ld [rLCDC], a 19 | ret 20 | 21 | ; Copies until null terminator is hit, including the null terminator 22 | ; @param DE: Source Pointer 23 | ; @param HL: Destination Pointer 24 | Strcpy: 25 | ld a, [de] 26 | ld [hl+], a 27 | 28 | or a ; Check for null terminator 29 | ret z 30 | 31 | inc de 32 | 33 | jr Strcpy 34 | 35 | ; Copies until null terminator is hit, excluding the null terminator 36 | ; @param DE: Source Pointer 37 | ; @param HL: Destination Pointer 38 | StrcpyNoNull: 39 | ld a, [de] 40 | 41 | or a ; Check for null terminator 42 | ret z 43 | 44 | ld [hl+], a 45 | 46 | inc de 47 | 48 | jr StrcpyNoNull 49 | 50 | ; Smart copy to tilemap until null terminator is hit, excluding the null terminator 51 | ; @param DE: Source Pointer 52 | ; @param HL: Destination Pointer 53 | StrcpyNoNullTilemapSmart: 54 | ld bc, 32 55 | .loop: 56 | ld a, [de] 57 | 58 | or a ; Check for null terminator 59 | 60 | ret z 61 | cp a, $A ; Detect newline character 62 | jr z, .newline 63 | 64 | ld [hl+], a 65 | inc de 66 | 67 | jr .loop 68 | .newline: 69 | add hl, bc 70 | ld a, l 71 | 72 | ; Reset to the left of the tilemap 73 | and a, %11100000 74 | ld l, a 75 | 76 | inc de 77 | 78 | jr .loop 79 | 80 | ; Copies memory 81 | ; @param BC: Bytes to copy 82 | ; @param DE: Source Pointer 83 | ; @param HL: Destination Pointer 84 | Memcpy: 85 | ld a, [de] 86 | ld [hl+], a 87 | 88 | inc de 89 | dec bc 90 | 91 | ld a, b 92 | or a 93 | jr nz, Memcpy 94 | ld a, c 95 | or a 96 | jr nz, Memcpy 97 | ret 98 | 99 | ; Sets a block of memory to a value 100 | ; BC: Bytes to copy 101 | ; HL: Pointer to destination 102 | ; D: Byte to set with 103 | Memset: 104 | ld a, d 105 | ld [hl+], a 106 | 107 | dec bc 108 | 109 | ld a, b 110 | or a 111 | jr nz, Memset 112 | ld a, c 113 | or a 114 | jr nz, Memset 115 | ret 116 | -------------------------------------------------------------------------------- /src/common/hardware.inc: -------------------------------------------------------------------------------- 1 | ;* 2 | ;* Gameboy Hardware definitions 3 | ;* 4 | ;* Based on Jones' hardware.inc 5 | ;* And based on Carsten Sorensen's ideas. 6 | ;* 7 | ;* Rev 1.1 - 15-Jul-97 : Added define check 8 | ;* Rev 1.2 - 18-Jul-97 : Added revision check macro 9 | ;* Rev 1.3 - 19-Jul-97 : Modified for RGBASM V1.05 10 | ;* Rev 1.4 - 27-Jul-97 : Modified for new subroutine prefixes 11 | ;* Rev 1.5 - 15-Aug-97 : Added _HRAM, PAD, CART defines 12 | ;* : and Nintendo Logo 13 | ;* Rev 1.6 - 30-Nov-97 : Added rDIV, rTIMA, rTMA, & rTAC 14 | ;* Rev 1.7 - 31-Jan-98 : Added _SCRN0, _SCRN1 15 | ;* Rev 1.8 - 15-Feb-98 : Added rSB, rSC 16 | ;* Rev 1.9 - 16-Feb-98 : Converted I/O registers to $FFXX format 17 | ;* Rev 2.0 - : Added GBC registers 18 | ;* Rev 2.1 - : Added MBC5 & cart RAM enable/disable defines 19 | ;* Rev 2.2 - : Fixed NR42,NR43, & NR44 equates 20 | ;* Rev 2.3 - : Fixed incorrect _HRAM equate 21 | ;* Rev 2.4 - 27-Apr-13 : Added some cart defines (AntonioND) 22 | ;* Rev 2.5 - 03-May-15 : Fixed format (AntonioND) 23 | ;* Rev 2.6 - 09-Apr-16 : Added GBC OAM and cart defines (AntonioND) 24 | ;* Rev 2.7 - 19-Jan-19 : Added rPCMXX (ISSOtm) 25 | ;* Rev 2.8 - 03-Feb-19 : Added audio registers flags (Álvaro Cuesta) 26 | ;* Rev 2.9 - 28-Feb-20 : Added utility rP1 constants 27 | ;* Rev 3.0 - 27-Aug-20 : Register ordering, byte-based sizes, OAM additions, general cleanup (Blitter Object) 28 | 29 | ; If all of these are already defined, don't do it again. 30 | 31 | IF !DEF(HARDWARE_INC) 32 | HARDWARE_INC SET 1 33 | 34 | rev_Check_hardware_inc : MACRO 35 | ;NOTE: REVISION NUMBER CHANGES MUST BE ADDED 36 | ;TO SECOND PARAMETER IN FOLLOWING LINE. 37 | IF \1 > 3.0 ;PUT REVISION NUMBER HERE 38 | WARN "Version \1 or later of 'hardware.inc' is required." 39 | ENDC 40 | ENDM 41 | 42 | _VRAM EQU $8000 ; $8000->$9FFF 43 | _VRAM8000 EQU _VRAM 44 | _VRAM8800 EQU _VRAM+$800 45 | _VRAM9000 EQU _VRAM+$1000 46 | _SCRN0 EQU $9800 ; $9800->$9BFF 47 | _SCRN1 EQU $9C00 ; $9C00->$9FFF 48 | _SRAM EQU $A000 ; $A000->$BFFF 49 | _RAM EQU $C000 ; $C000->$CFFF / $C000->$DFFF 50 | _RAMBANK EQU $D000 ; $D000->$DFFF 51 | _OAMRAM EQU $FE00 ; $FE00->$FE9F 52 | _IO EQU $FF00 ; $FF00->$FF7F,$FFFF 53 | _AUD3WAVERAM EQU $FF30 ; $FF30->$FF3F 54 | _HRAM EQU $FF80 ; $FF80->$FFFE 55 | 56 | ; *** MBC5 Equates *** 57 | 58 | rRAMG EQU $0000 ; $0000->$1fff 59 | rROMB0 EQU $2000 ; $2000->$2fff 60 | rROMB1 EQU $3000 ; $3000->$3fff - If more than 256 ROM banks are present. 61 | rRAMB EQU $4000 ; $4000->$5fff - Bit 3 enables rumble (if present) 62 | 63 | 64 | ;*************************************************************************** 65 | ;* 66 | ;* Custom registers 67 | ;* 68 | ;*************************************************************************** 69 | 70 | ; -- 71 | ; -- P1 ($FF00) 72 | ; -- Register for reading joy pad info. (R/W) 73 | ; -- 74 | rP1 EQU $FF00 75 | 76 | P1F_5 EQU %00100000 ; P15 out port, set to 0 to get buttons 77 | P1F_4 EQU %00010000 ; P14 out port, set to 0 to get dpad 78 | P1F_3 EQU %00001000 ; P13 in port 79 | P1F_2 EQU %00000100 ; P12 in port 80 | P1F_1 EQU %00000010 ; P11 in port 81 | P1F_0 EQU %00000001 ; P10 in port 82 | 83 | P1F_GET_DPAD EQU P1F_5 84 | P1F_GET_BTN EQU P1F_4 85 | P1F_GET_NONE EQU P1F_4 | P1F_5 86 | 87 | 88 | ; -- 89 | ; -- SB ($FF01) 90 | ; -- Serial Transfer Data (R/W) 91 | ; -- 92 | rSB EQU $FF01 93 | 94 | 95 | ; -- 96 | ; -- SC ($FF02) 97 | ; -- Serial I/O Control (R/W) 98 | ; -- 99 | rSC EQU $FF02 100 | 101 | 102 | ; -- 103 | ; -- DIV ($FF04) 104 | ; -- Divider register (R/W) 105 | ; -- 106 | rDIV EQU $FF04 107 | 108 | 109 | ; -- 110 | ; -- TIMA ($FF05) 111 | ; -- Timer counter (R/W) 112 | ; -- 113 | rTIMA EQU $FF05 114 | 115 | 116 | ; -- 117 | ; -- TMA ($FF06) 118 | ; -- Timer modulo (R/W) 119 | ; -- 120 | rTMA EQU $FF06 121 | 122 | 123 | ; -- 124 | ; -- TAC ($FF07) 125 | ; -- Timer control (R/W) 126 | ; -- 127 | rTAC EQU $FF07 128 | 129 | TACF_START EQU %00000100 130 | TACF_STOP EQU %00000000 131 | TACF_4KHZ EQU %00000000 132 | TACF_16KHZ EQU %00000011 133 | TACF_65KHZ EQU %00000010 134 | TACF_262KHZ EQU %00000001 135 | 136 | 137 | ; -- 138 | ; -- IF ($FF0F) 139 | ; -- Interrupt Flag (R/W) 140 | ; -- 141 | rIF EQU $FF0F 142 | 143 | 144 | ; -- 145 | ; -- AUD1SWEEP/NR10 ($FF10) 146 | ; -- Sweep register (R/W) 147 | ; -- 148 | ; -- Bit 6-4 - Sweep Time 149 | ; -- Bit 3 - Sweep Increase/Decrease 150 | ; -- 0: Addition (frequency increases???) 151 | ; -- 1: Subtraction (frequency increases???) 152 | ; -- Bit 2-0 - Number of sweep shift (# 0-7) 153 | ; -- Sweep Time: (n*7.8ms) 154 | ; -- 155 | rNR10 EQU $FF10 156 | rAUD1SWEEP EQU rNR10 157 | 158 | AUD1SWEEP_UP EQU %00000000 159 | AUD1SWEEP_DOWN EQU %00001000 160 | 161 | 162 | ; -- 163 | ; -- AUD1LEN/NR11 ($FF11) 164 | ; -- Sound length/Wave pattern duty (R/W) 165 | ; -- 166 | ; -- Bit 7-6 - Wave Pattern Duty (00:12.5% 01:25% 10:50% 11:75%) 167 | ; -- Bit 5-0 - Sound length data (# 0-63) 168 | ; -- 169 | rNR11 EQU $FF11 170 | rAUD1LEN EQU rNR11 171 | 172 | 173 | ; -- 174 | ; -- AUD1ENV/NR12 ($FF12) 175 | ; -- Envelope (R/W) 176 | ; -- 177 | ; -- Bit 7-4 - Initial value of envelope 178 | ; -- Bit 3 - Envelope UP/DOWN 179 | ; -- 0: Decrease 180 | ; -- 1: Range of increase 181 | ; -- Bit 2-0 - Number of envelope sweep (# 0-7) 182 | ; -- 183 | rNR12 EQU $FF12 184 | rAUD1ENV EQU rNR12 185 | 186 | 187 | ; -- 188 | ; -- AUD1LOW/NR13 ($FF13) 189 | ; -- Frequency low byte (W) 190 | ; -- 191 | rNR13 EQU $FF13 192 | rAUD1LOW EQU rNR13 193 | 194 | 195 | ; -- 196 | ; -- AUD1HIGH/NR14 ($FF14) 197 | ; -- Frequency high byte (W) 198 | ; -- 199 | ; -- Bit 7 - Initial (when set, sound restarts) 200 | ; -- Bit 6 - Counter/consecutive selection 201 | ; -- Bit 2-0 - Frequency's higher 3 bits 202 | ; -- 203 | rNR14 EQU $FF14 204 | rAUD1HIGH EQU rNR14 205 | 206 | 207 | ; -- 208 | ; -- AUD2LEN/NR21 ($FF16) 209 | ; -- Sound Length; Wave Pattern Duty (R/W) 210 | ; -- 211 | ; -- see AUD1LEN for info 212 | ; -- 213 | rNR21 EQU $FF16 214 | rAUD2LEN EQU rNR21 215 | 216 | 217 | ; -- 218 | ; -- AUD2ENV/NR22 ($FF17) 219 | ; -- Envelope (R/W) 220 | ; -- 221 | ; -- see AUD1ENV for info 222 | ; -- 223 | rNR22 EQU $FF17 224 | rAUD2ENV EQU rNR22 225 | 226 | 227 | ; -- 228 | ; -- AUD2LOW/NR23 ($FF18) 229 | ; -- Frequency low byte (W) 230 | ; -- 231 | rNR23 EQU $FF18 232 | rAUD2LOW EQU rNR23 233 | 234 | 235 | ; -- 236 | ; -- AUD2HIGH/NR24 ($FF19) 237 | ; -- Frequency high byte (W) 238 | ; -- 239 | ; -- see AUD1HIGH for info 240 | ; -- 241 | rNR24 EQU $FF19 242 | rAUD2HIGH EQU rNR24 243 | 244 | 245 | ; -- 246 | ; -- AUD3ENA/NR30 ($FF1A) 247 | ; -- Sound on/off (R/W) 248 | ; -- 249 | ; -- Bit 7 - Sound ON/OFF (1=ON,0=OFF) 250 | ; -- 251 | rNR30 EQU $FF1A 252 | rAUD3ENA EQU rNR30 253 | 254 | 255 | ; -- 256 | ; -- AUD3LEN/NR31 ($FF1B) 257 | ; -- Sound length (R/W) 258 | ; -- 259 | ; -- Bit 7-0 - Sound length 260 | ; -- 261 | rNR31 EQU $FF1B 262 | rAUD3LEN EQU rNR31 263 | 264 | 265 | ; -- 266 | ; -- AUD3LEVEL/NR32 ($FF1C) 267 | ; -- Select output level 268 | ; -- 269 | ; -- Bit 6-5 - Select output level 270 | ; -- 00: 0/1 (mute) 271 | ; -- 01: 1/1 272 | ; -- 10: 1/2 273 | ; -- 11: 1/4 274 | ; -- 275 | rNR32 EQU $FF1C 276 | rAUD3LEVEL EQU rNR32 277 | 278 | 279 | ; -- 280 | ; -- AUD3LOW/NR33 ($FF1D) 281 | ; -- Frequency low byte (W) 282 | ; -- 283 | ; -- see AUD1LOW for info 284 | ; -- 285 | rNR33 EQU $FF1D 286 | rAUD3LOW EQU rNR33 287 | 288 | 289 | ; -- 290 | ; -- AUD3HIGH/NR34 ($FF1E) 291 | ; -- Frequency high byte (W) 292 | ; -- 293 | ; -- see AUD1HIGH for info 294 | ; -- 295 | rNR34 EQU $FF1E 296 | rAUD3HIGH EQU rNR34 297 | 298 | 299 | ; -- 300 | ; -- AUD4LEN/NR41 ($FF20) 301 | ; -- Sound length (R/W) 302 | ; -- 303 | ; -- Bit 5-0 - Sound length data (# 0-63) 304 | ; -- 305 | rNR41 EQU $FF20 306 | rAUD4LEN EQU rNR41 307 | 308 | 309 | ; -- 310 | ; -- AUD4ENV/NR42 ($FF21) 311 | ; -- Envelope (R/W) 312 | ; -- 313 | ; -- see AUD1ENV for info 314 | ; -- 315 | rNR42 EQU $FF21 316 | rAUD4ENV EQU rNR42 317 | 318 | 319 | ; -- 320 | ; -- AUD4POLY/NR43 ($FF22) 321 | ; -- Polynomial counter (R/W) 322 | ; -- 323 | ; -- Bit 7-4 - Selection of the shift clock frequency of the (scf) 324 | ; -- polynomial counter (0000-1101) 325 | ; -- freq=drf*1/2^scf (not sure) 326 | ; -- Bit 3 - Selection of the polynomial counter's step 327 | ; -- 0: 15 steps 328 | ; -- 1: 7 steps 329 | ; -- Bit 2-0 - Selection of the dividing ratio of frequencies (drf) 330 | ; -- 000: f/4 001: f/8 010: f/16 011: f/24 331 | ; -- 100: f/32 101: f/40 110: f/48 111: f/56 (f=4.194304 Mhz) 332 | ; -- 333 | rNR43 EQU $FF22 334 | rAUD4POLY EQU rNR43 335 | 336 | 337 | ; -- 338 | ; -- AUD4GO/NR44 ($FF23) 339 | ; -- 340 | ; -- Bit 7 - Inital 341 | ; -- Bit 6 - Counter/consecutive selection 342 | ; -- 343 | rNR44 EQU $FF23 344 | rAUD4GO EQU rNR44 345 | 346 | 347 | ; -- 348 | ; -- AUDVOL/NR50 ($FF24) 349 | ; -- Channel control / ON-OFF / Volume (R/W) 350 | ; -- 351 | ; -- Bit 7 - Vin->SO2 ON/OFF (Vin??) 352 | ; -- Bit 6-4 - SO2 output level (volume) (# 0-7) 353 | ; -- Bit 3 - Vin->SO1 ON/OFF (Vin??) 354 | ; -- Bit 2-0 - SO1 output level (volume) (# 0-7) 355 | ; -- 356 | rNR50 EQU $FF24 357 | rAUDVOL EQU rNR50 358 | 359 | AUDVOL_VIN_LEFT EQU %10000000 ; SO2 360 | AUDVOL_VIN_RIGHT EQU %00001000 ; SO1 361 | 362 | 363 | ; -- 364 | ; -- AUDTERM/NR51 ($FF25) 365 | ; -- Selection of Sound output terminal (R/W) 366 | ; -- 367 | ; -- Bit 7 - Output sound 4 to SO2 terminal 368 | ; -- Bit 6 - Output sound 3 to SO2 terminal 369 | ; -- Bit 5 - Output sound 2 to SO2 terminal 370 | ; -- Bit 4 - Output sound 1 to SO2 terminal 371 | ; -- Bit 3 - Output sound 4 to SO1 terminal 372 | ; -- Bit 2 - Output sound 3 to SO1 terminal 373 | ; -- Bit 1 - Output sound 2 to SO1 terminal 374 | ; -- Bit 0 - Output sound 0 to SO1 terminal 375 | ; -- 376 | rNR51 EQU $FF25 377 | rAUDTERM EQU rNR51 378 | 379 | ; SO2 380 | AUDTERM_4_LEFT EQU %10000000 381 | AUDTERM_3_LEFT EQU %01000000 382 | AUDTERM_2_LEFT EQU %00100000 383 | AUDTERM_1_LEFT EQU %00010000 384 | ; SO1 385 | AUDTERM_4_RIGHT EQU %00001000 386 | AUDTERM_3_RIGHT EQU %00000100 387 | AUDTERM_2_RIGHT EQU %00000010 388 | AUDTERM_1_RIGHT EQU %00000001 389 | 390 | 391 | ; -- 392 | ; -- AUDENA/NR52 ($FF26) 393 | ; -- Sound on/off (R/W) 394 | ; -- 395 | ; -- Bit 7 - All sound on/off (sets all audio regs to 0!) 396 | ; -- Bit 3 - Sound 4 ON flag (read only) 397 | ; -- Bit 2 - Sound 3 ON flag (read only) 398 | ; -- Bit 1 - Sound 2 ON flag (read only) 399 | ; -- Bit 0 - Sound 1 ON flag (read only) 400 | ; -- 401 | rNR52 EQU $FF26 402 | rAUDENA EQU rNR52 403 | 404 | AUDENA_ON EQU %10000000 405 | AUDENA_OFF EQU %00000000 ; sets all audio regs to 0! 406 | 407 | 408 | ; -- 409 | ; -- LCDC ($FF40) 410 | ; -- LCD Control (R/W) 411 | ; -- 412 | rLCDC EQU $FF40 413 | 414 | LCDCF_OFF EQU %00000000 ; LCD Control Operation 415 | LCDCF_ON EQU %10000000 ; LCD Control Operation 416 | LCDCF_WIN9800 EQU %00000000 ; Window Tile Map Display Select 417 | LCDCF_WIN9C00 EQU %01000000 ; Window Tile Map Display Select 418 | LCDCF_WINOFF EQU %00000000 ; Window Display 419 | LCDCF_WINON EQU %00100000 ; Window Display 420 | LCDCF_BG8800 EQU %00000000 ; BG & Window Tile Data Select 421 | LCDCF_BG8000 EQU %00010000 ; BG & Window Tile Data Select 422 | LCDCF_BG9800 EQU %00000000 ; BG Tile Map Display Select 423 | LCDCF_BG9C00 EQU %00001000 ; BG Tile Map Display Select 424 | LCDCF_OBJ8 EQU %00000000 ; OBJ Construction 425 | LCDCF_OBJ16 EQU %00000100 ; OBJ Construction 426 | LCDCF_OBJOFF EQU %00000000 ; OBJ Display 427 | LCDCF_OBJON EQU %00000010 ; OBJ Display 428 | LCDCF_BGOFF EQU %00000000 ; BG Display 429 | LCDCF_BGON EQU %00000001 ; BG Display 430 | ; "Window Character Data Select" follows BG 431 | 432 | 433 | ; -- 434 | ; -- STAT ($FF41) 435 | ; -- LCDC Status (R/W) 436 | ; -- 437 | rSTAT EQU $FF41 438 | 439 | STATF_LYC EQU %01000000 ; LYC=LY Coincidence (Selectable) 440 | STATF_MODE10 EQU %00100000 ; Mode 10 441 | STATF_MODE01 EQU %00010000 ; Mode 01 (V-Blank) 442 | STATF_MODE00 EQU %00001000 ; Mode 00 (H-Blank) 443 | STATF_LYCF EQU %00000100 ; Coincidence Flag 444 | STATF_HBL EQU %00000000 ; H-Blank 445 | STATF_VBL EQU %00000001 ; V-Blank 446 | STATF_OAM EQU %00000010 ; OAM-RAM is used by system 447 | STATF_LCD EQU %00000011 ; Both OAM and VRAM used by system 448 | STATF_BUSY EQU %00000010 ; When set, VRAM access is unsafe 449 | 450 | 451 | ; -- 452 | ; -- SCY ($FF42) 453 | ; -- Scroll Y (R/W) 454 | ; -- 455 | rSCY EQU $FF42 456 | 457 | 458 | ; -- 459 | ; -- SCY ($FF43) 460 | ; -- Scroll X (R/W) 461 | ; -- 462 | rSCX EQU $FF43 463 | 464 | 465 | ; -- 466 | ; -- LY ($FF44) 467 | ; -- LCDC Y-Coordinate (R) 468 | ; -- 469 | ; -- Values range from 0->153. 144->153 is the VBlank period. 470 | ; -- 471 | rLY EQU $FF44 472 | 473 | 474 | ; -- 475 | ; -- LYC ($FF45) 476 | ; -- LY Compare (R/W) 477 | ; -- 478 | ; -- When LY==LYC, STATF_LYCF will be set in STAT 479 | ; -- 480 | rLYC EQU $FF45 481 | 482 | 483 | ; -- 484 | ; -- DMA ($FF46) 485 | ; -- DMA Transfer and Start Address (W) 486 | ; -- 487 | rDMA EQU $FF46 488 | 489 | 490 | ; -- 491 | ; -- BGP ($FF47) 492 | ; -- BG Palette Data (W) 493 | ; -- 494 | ; -- Bit 7-6 - Intensity for %11 495 | ; -- Bit 5-4 - Intensity for %10 496 | ; -- Bit 3-2 - Intensity for %01 497 | ; -- Bit 1-0 - Intensity for %00 498 | ; -- 499 | rBGP EQU $FF47 500 | 501 | 502 | ; -- 503 | ; -- OBP0 ($FF48) 504 | ; -- Object Palette 0 Data (W) 505 | ; -- 506 | ; -- See BGP for info 507 | ; -- 508 | rOBP0 EQU $FF48 509 | 510 | 511 | ; -- 512 | ; -- OBP1 ($FF49) 513 | ; -- Object Palette 1 Data (W) 514 | ; -- 515 | ; -- See BGP for info 516 | ; -- 517 | rOBP1 EQU $FF49 518 | 519 | 520 | ; -- 521 | ; -- WY ($FF4A) 522 | ; -- Window Y Position (R/W) 523 | ; -- 524 | ; -- 0 <= WY <= 143 525 | ; -- When WY = 0, the window is displayed from the top edge of the LCD screen. 526 | ; -- 527 | rWY EQU $FF4A 528 | 529 | 530 | ; -- 531 | ; -- WX ($FF4B) 532 | ; -- Window X Position (R/W) 533 | ; -- 534 | ; -- 7 <= WX <= 166 535 | ; -- When WX = 7, the window is displayed from the left edge of the LCD screen. 536 | ; -- Values of 0-6 and 166 are unreliable due to hardware bugs. 537 | ; -- 538 | rWX EQU $FF4B 539 | 540 | 541 | ; -- 542 | ; -- SPEED ($FF4D) 543 | ; -- Select CPU Speed (R/W) 544 | ; -- 545 | rKEY1 EQU $FF4D 546 | rSPD EQU rKEY1 547 | 548 | KEY1F_DBLSPEED EQU %10000000 ; 0=Normal Speed, 1=Double Speed (R) 549 | KEY1F_PREPARE EQU %00000001 ; 0=No, 1=Prepare (R/W) 550 | 551 | 552 | ; -- 553 | ; -- VBK ($FF4F) 554 | ; -- Select Video RAM Bank (R/W) 555 | ; -- 556 | ; -- Bit 0 - Bank Specification (0: Specify Bank 0; 1: Specify Bank 1) 557 | ; -- 558 | rVBK EQU $FF4F 559 | 560 | 561 | ; -- 562 | ; -- HDMA1 ($FF51) 563 | ; -- High byte for Horizontal Blanking/General Purpose DMA source address (W) 564 | ; -- CGB Mode Only 565 | ; -- 566 | rHDMA1 EQU $FF51 567 | 568 | 569 | ; -- 570 | ; -- HDMA2 ($FF52) 571 | ; -- Low byte for Horizontal Blanking/General Purpose DMA source address (W) 572 | ; -- CGB Mode Only 573 | ; -- 574 | rHDMA2 EQU $FF52 575 | 576 | 577 | ; -- 578 | ; -- HDMA3 ($FF53) 579 | ; -- High byte for Horizontal Blanking/General Purpose DMA destination address (W) 580 | ; -- CGB Mode Only 581 | ; -- 582 | rHDMA3 EQU $FF53 583 | 584 | 585 | ; -- 586 | ; -- HDMA4 ($FF54) 587 | ; -- Low byte for Horizontal Blanking/General Purpose DMA destination address (W) 588 | ; -- CGB Mode Only 589 | ; -- 590 | rHDMA4 EQU $FF54 591 | 592 | 593 | ; -- 594 | ; -- HDMA5 ($FF55) 595 | ; -- Transfer length (in tiles minus 1)/mode/start for Horizontal Blanking, General Purpose DMA (R/W) 596 | ; -- CGB Mode Only 597 | ; -- 598 | rHDMA5 EQU $FF55 599 | 600 | HDMA5F_MODE_GP EQU %00000000 ; General Purpose DMA (W) 601 | HDMA5F_MODE_HBL EQU %10000000 ; HBlank DMA (W) 602 | 603 | ; -- Once DMA has started, use HDMA5F_BUSY to check when the transfer is complete 604 | HDMA5F_BUSY EQU %10000000 ; 0=Busy (DMA still in progress), 1=Transfer complete (R) 605 | 606 | 607 | ; -- 608 | ; -- RP ($FF56) 609 | ; -- Infrared Communications Port (R/W) 610 | ; -- 611 | rRP EQU $FF56 612 | 613 | 614 | ; -- 615 | ; -- BCPS ($FF68) 616 | ; -- Background Color Palette Specification (R/W) 617 | ; -- 618 | rBCPS EQU $FF68 619 | 620 | BCPSF_AUTOINC EQU %10000000 ; Auto Increment (0=Disabled, 1=Increment after Writing) 621 | 622 | 623 | ; -- 624 | ; -- BCPD ($FF69) 625 | ; -- Background Color Palette Data (R/W) 626 | ; -- 627 | rBCPD EQU $FF69 628 | 629 | 630 | ; -- 631 | ; -- OCPS ($FF6A) 632 | ; -- Object Color Palette Specification (R/W) 633 | ; -- 634 | rOCPS EQU $FF6A 635 | 636 | OCPSF_AUTOINC EQU %10000000 ; Auto Increment (0=Disabled, 1=Increment after Writing) 637 | 638 | 639 | ; -- 640 | ; -- OCPD ($FF6B) 641 | ; -- Object Color Palette Data (R/W) 642 | ; -- 643 | rOCPD EQU $FF6B 644 | 645 | 646 | ; -- 647 | ; -- SMBK/SVBK ($FF70) 648 | ; -- Select Main RAM Bank (R/W) 649 | ; -- 650 | ; -- Bit 2-0 - Bank Specification (0,1: Specify Bank 1; 2-7: Specify Banks 2-7) 651 | ; -- 652 | rSVBK EQU $FF70 653 | rSMBK EQU rSVBK 654 | 655 | 656 | ; -- 657 | ; -- PCM12 ($FF76) 658 | ; -- Sound channel 1&2 PCM amplitude (R) 659 | ; -- 660 | ; -- Bit 7-4 - Copy of sound channel 2's PCM amplitude 661 | ; -- Bit 3-0 - Copy of sound channel 1's PCM amplitude 662 | ; -- 663 | rPCM12 EQU $FF76 664 | 665 | 666 | ; -- 667 | ; -- PCM34 ($FF77) 668 | ; -- Sound channel 3&4 PCM amplitude (R) 669 | ; -- 670 | ; -- Bit 7-4 - Copy of sound channel 4's PCM amplitude 671 | ; -- Bit 3-0 - Copy of sound channel 3's PCM amplitude 672 | ; -- 673 | rPCM34 EQU $FF77 674 | 675 | 676 | ; -- 677 | ; -- IE ($FFFF) 678 | ; -- Interrupt Enable (R/W) 679 | ; -- 680 | rIE EQU $FFFF 681 | 682 | IEF_HILO EQU %00010000 ; Transition from High to Low of Pin number P10-P13 683 | IEF_SERIAL EQU %00001000 ; Serial I/O transfer end 684 | IEF_TIMER EQU %00000100 ; Timer Overflow 685 | IEF_LCDC EQU %00000010 ; LCDC (see STAT) 686 | IEF_VBLANK EQU %00000001 ; V-Blank 687 | 688 | 689 | ;*************************************************************************** 690 | ;* 691 | ;* Flags common to multiple sound channels 692 | ;* 693 | ;*************************************************************************** 694 | 695 | ; -- 696 | ; -- Square wave duty cycle 697 | ; -- 698 | ; -- Can be used with AUD1LEN and AUD2LEN 699 | ; -- See AUD1LEN for more info 700 | ; -- 701 | AUDLEN_DUTY_12_5 EQU %00000000 ; 12.5% 702 | AUDLEN_DUTY_25 EQU %01000000 ; 25% 703 | AUDLEN_DUTY_50 EQU %10000000 ; 50% 704 | AUDLEN_DUTY_75 EQU %11000000 ; 75% 705 | 706 | 707 | ; -- 708 | ; -- Audio envelope flags 709 | ; -- 710 | ; -- Can be used with AUD1ENV, AUD2ENV, AUD4ENV 711 | ; -- See AUD1ENV for more info 712 | ; -- 713 | AUDENV_UP EQU %00001000 714 | AUDENV_DOWN EQU %00000000 715 | 716 | 717 | ; -- 718 | ; -- Audio trigger flags 719 | ; -- 720 | ; -- Can be used with AUD1HIGH, AUD2HIGH, AUD3HIGH 721 | ; -- See AUD1HIGH for more info 722 | ; -- 723 | 724 | AUDHIGH_RESTART EQU %10000000 725 | AUDHIGH_LENGTH_ON EQU %01000000 726 | AUDHIGH_LENGTH_OFF EQU %00000000 727 | 728 | 729 | ;*************************************************************************** 730 | ;* 731 | ;* CPU values on bootup (a=type, b=qualifier) 732 | ;* 733 | ;*************************************************************************** 734 | 735 | BOOTUP_A_DMG EQU $01 ; Dot Matrix Game 736 | BOOTUP_A_CGB EQU $11 ; Color GameBoy 737 | BOOTUP_A_MGB EQU $FF ; Mini GameBoy (Pocket GameBoy) 738 | 739 | ; if a=BOOTUP_A_CGB, bit 0 in b can be checked to determine if real CGB or 740 | ; other system running in GBC mode 741 | BOOTUP_B_CGB EQU %00000000 742 | BOOTUP_B_AGB EQU %00000001 ; GBA, GBA SP, Game Boy Player, or New GBA SP 743 | 744 | 745 | ;*************************************************************************** 746 | ;* 747 | ;* Cart related 748 | ;* 749 | ;*************************************************************************** 750 | 751 | ; $0143 Color GameBoy compatibility code 752 | CART_COMPATIBLE_DMG EQU $00 753 | CART_COMPATIBLE_DMG_GBC EQU $80 754 | CART_COMPATIBLE_GBC EQU $C0 755 | 756 | ; $0146 GameBoy/Super GameBoy indicator 757 | CART_INDICATOR_GB EQU $00 758 | CART_INDICATOR_SGB EQU $03 759 | 760 | ; $0147 Cartridge type 761 | CART_ROM EQU $00 762 | CART_ROM_MBC1 EQU $01 763 | CART_ROM_MBC1_RAM EQU $02 764 | CART_ROM_MBC1_RAM_BAT EQU $03 765 | CART_ROM_MBC2 EQU $05 766 | CART_ROM_MBC2_BAT EQU $06 767 | CART_ROM_RAM EQU $08 768 | CART_ROM_RAM_BAT EQU $09 769 | CART_ROM_MMM01 EQU $0B 770 | CART_ROM_MMM01_RAM EQU $0C 771 | CART_ROM_MMM01_RAM_BAT EQU $0D 772 | CART_ROM_MBC3_BAT_RTC EQU $0F 773 | CART_ROM_MBC3_RAM_BAT_RTC EQU $10 774 | CART_ROM_MBC3 EQU $11 775 | CART_ROM_MBC3_RAM EQU $12 776 | CART_ROM_MBC3_RAM_BAT EQU $13 777 | CART_ROM_MBC5 EQU $19 778 | CART_ROM_MBC5_BAT EQU $1A 779 | CART_ROM_MBC5_RAM_BAT EQU $1B 780 | CART_ROM_MBC5_RUMBLE EQU $1C 781 | CART_ROM_MBC5_RAM_RUMBLE EQU $1D 782 | CART_ROM_MBC5_RAM_BAT_RUMBLE EQU $1E 783 | CART_ROM_MBC7_RAM_BAT_GYRO EQU $22 784 | CART_ROM_POCKET_CAMERA EQU $FC 785 | CART_ROM_BANDAI_TAMA5 EQU $FD 786 | CART_ROM_HUDSON_HUC3 EQU $FE 787 | CART_ROM_HUDSON_HUC1 EQU $FF 788 | 789 | ; $0148 ROM size 790 | ; these are kilobytes 791 | CART_ROM_32K EQU $00 ; 2 banks 792 | CART_ROM_64K EQU $01 ; 4 banks 793 | CART_ROM_128K EQU $02 ; 8 banks 794 | CART_ROM_256K EQU $03 ; 16 banks 795 | CART_ROM_512K EQU $04 ; 32 banks 796 | CART_ROM_1024K EQU $05 ; 64 banks 797 | CART_ROM_2048K EQU $06 ; 128 banks 798 | CART_ROM_4096K EQU $07 ; 256 banks 799 | CART_ROM_8192K EQU $08 ; 512 banks 800 | CART_ROM_1152K EQU $52 ; 72 banks 801 | CART_ROM_1280K EQU $53 ; 80 banks 802 | CART_ROM_1536K EQU $54 ; 96 banks 803 | 804 | ; $0149 SRAM size 805 | ; these are kilobytes 806 | CART_SRAM_NONE EQU 0 807 | CART_SRAM_2K EQU 1 ; 1 incomplete bank 808 | CART_SRAM_8K EQU 2 ; 1 bank 809 | CART_SRAM_32K EQU 3 ; 4 banks 810 | CART_SRAM_128K EQU 4 ; 16 banks 811 | 812 | CART_SRAM_ENABLE EQU $0A 813 | CART_SRAM_DISABLE EQU $00 814 | 815 | ; $014A Destination code 816 | CART_DEST_JAPANESE EQU $00 817 | CART_DEST_NON_JAPANESE EQU $01 818 | 819 | 820 | ;*************************************************************************** 821 | ;* 822 | ;* Keypad related 823 | ;* 824 | ;*************************************************************************** 825 | 826 | PADF_DOWN EQU $80 827 | PADF_UP EQU $40 828 | PADF_LEFT EQU $20 829 | PADF_RIGHT EQU $10 830 | PADF_START EQU $08 831 | PADF_SELECT EQU $04 832 | PADF_B EQU $02 833 | PADF_A EQU $01 834 | 835 | PADB_DOWN EQU $7 836 | PADB_UP EQU $6 837 | PADB_LEFT EQU $5 838 | PADB_RIGHT EQU $4 839 | PADB_START EQU $3 840 | PADB_SELECT EQU $2 841 | PADB_B EQU $1 842 | PADB_A EQU $0 843 | 844 | 845 | ;*************************************************************************** 846 | ;* 847 | ;* Screen related 848 | ;* 849 | ;*************************************************************************** 850 | 851 | SCRN_X EQU 160 ; Width of screen in pixels 852 | SCRN_Y EQU 144 ; Height of screen in pixels 853 | SCRN_X_B EQU 20 ; Width of screen in bytes 854 | SCRN_Y_B EQU 18 ; Height of screen in bytes 855 | 856 | SCRN_VX EQU 256 ; Virtual width of screen in pixels 857 | SCRN_VY EQU 256 ; Virtual height of screen in pixels 858 | SCRN_VX_B EQU 32 ; Virtual width of screen in bytes 859 | SCRN_VY_B EQU 32 ; Virtual height of screen in bytes 860 | 861 | 862 | ;*************************************************************************** 863 | ;* 864 | ;* OAM related 865 | ;* 866 | ;*************************************************************************** 867 | 868 | ; OAM attributes 869 | ; each entry in OAM RAM is 4 bytes (sizeof_OAM_ATTRS) 870 | RSRESET 871 | OAMA_Y RB 1 ; y pos 872 | OAMA_X RB 1 ; x pos 873 | OAMA_TILEID RB 1 ; tile id 874 | OAMA_FLAGS RB 1 ; flags (see below) 875 | sizeof_OAM_ATTRS RB 0 876 | 877 | OAM_COUNT EQU 40 ; number of OAM entries in OAM RAM 878 | 879 | ; flags 880 | OAMF_PRI EQU %10000000 ; Priority 881 | OAMF_YFLIP EQU %01000000 ; Y flip 882 | OAMF_XFLIP EQU %00100000 ; X flip 883 | OAMF_PAL0 EQU %00000000 ; Palette number; 0,1 (DMG) 884 | OAMF_PAL1 EQU %00010000 ; Palette number; 0,1 (DMG) 885 | OAMF_BANK0 EQU %00000000 ; Bank number; 0,1 (GBC) 886 | OAMF_BANK1 EQU %00001000 ; Bank number; 0,1 (GBC) 887 | 888 | OAMF_PALMASK EQU %00000111 ; Palette (GBC) 889 | 890 | OAMB_PRI EQU 7 ; Priority 891 | OAMB_YFLIP EQU 6 ; Y flip 892 | OAMB_XFLIP EQU 5 ; X flip 893 | OAMB_PAL1 EQU 4 ; Palette number; 0,1 (DMG) 894 | OAMB_BANK1 EQU 3 ; Bank number; 0,1 (GBC) 895 | 896 | 897 | ;* 898 | ;* Nintendo scrolling logo 899 | ;* (Code won't work on a real GameBoy) 900 | ;* (if next lines are altered.) 901 | NINTENDO_LOGO : MACRO 902 | DB $CE,$ED,$66,$66,$CC,$0D,$00,$0B,$03,$73,$00,$83,$00,$0C,$00,$0D 903 | DB $00,$08,$11,$1F,$88,$89,$00,$0E,$DC,$CC,$6E,$E6,$DD,$DD,$D9,$99 904 | DB $BB,$BB,$67,$63,$6E,$0E,$EC,$CC,$DD,$DC,$99,$9F,$BB,$B9,$33,$3E 905 | ENDM 906 | 907 | ENDC ;HARDWARE_INC -------------------------------------------------------------------------------- /src/window_y_trigger/window_y_trigger.asm: -------------------------------------------------------------------------------- 1 | include "common.asm" 2 | 3 | ; This ROM tests if the window Y trigger is activated only when LY = WY. 4 | 5 | Section "VBLANK ISR", ROM0[$40] 6 | ld a, 144 7 | ld [rWY], a 8 | reti 9 | 10 | Section "STAT ISR", ROM0[$48] 11 | jp hl 12 | 13 | SECTION "Start", ROM0[$0100] 14 | Entrypoint: 15 | nop 16 | jp main 17 | 18 | REPT $150 - $104 19 | db 0 20 | ENDR 21 | 22 | SECTION "ROM", ROM0[$0150] 23 | main: 24 | di 25 | ld sp, $FFFC 26 | 27 | call DisableLCD 28 | 29 | ; Zero fill WRAM 30 | ld d, 0 31 | ld bc, $2000 32 | ld hl, $C000 33 | call Memset 34 | 35 | ld d, 0 36 | ld bc, 32 37 | ld hl, $FF80 38 | call Memset 39 | 40 | ; Copy in font 41 | ld bc, 128 * 16 ; 16 bytes per tile 42 | ld de, Font 43 | ld hl, $9000 44 | call Memcpy 45 | 46 | TestScreen: 47 | call DisableLCD 48 | 49 | ld de, MainText 50 | ld hl, $9800 51 | call StrcpyNoNullTilemapSmart 52 | 53 | ld de, FailText 54 | ld hl, $9D01 55 | call StrcpyNoNullTilemapSmart 56 | 57 | ld a, LCDCF_BGON | LCDCF_WINON | LCDCF_ON | LCDCF_BG8800 | LCDCF_BG9800 | LCDCF_WIN9C00 58 | ld [rLCDC], a 59 | 60 | ld a, 7 61 | ld [rWX], a 62 | ld a, 0 63 | ld [rWY], a 64 | 65 | ld a, STATF_LYC 66 | ld [rSTAT], a 67 | 68 | ei 69 | 70 | ; set STAT IRQ jump vector 71 | ld hl, MoveWY 72 | ld a, 56 73 | ld [rLYC], a 74 | 75 | ld a, IEF_LCDC | IEF_VBLANK 76 | ld [rIE], a 77 | 78 | .rehalt: 79 | halt 80 | jr .rehalt 81 | 82 | 83 | MoveWY: 84 | ld a, 0 85 | ld [rWY], a 86 | reti 87 | 88 | 89 | 90 | 91 | SECTION "Font", ROMX 92 | Font: INCBIN "ags-aging-font.chr" 93 | 94 | SECTION "Text", ROMX 95 | FailText: 96 | db " You should not be\n" 97 | db " able to see this\n" 98 | db " text.\n" 99 | db "\n" 100 | db " Test failed.",0 101 | 102 | MainText: 103 | db "1 LY=WY Trigger Test\n" 104 | db "2\n" 105 | db "3 The numbers 1-18\n" 106 | db "4 should be visible\n" 107 | db "5 on the left side\n" 108 | db "6 of the screen.\n" 109 | db "7\n" 110 | db "8\n" 111 | db "9 If this text is\n" 112 | db "10 visible,the test\n" 113 | db "11 is OK!\n" 114 | db "12\n" 115 | db "13 Test OK!\n" 116 | db "14\n" 117 | db "15\n" 118 | db "16\n" 119 | db "17\n" 120 | db "18\n" 121 | db "19\n",0 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /src/window_y_trigger_wx_offscreen/window_y_trigger_wx_offscreen.asm: -------------------------------------------------------------------------------- 1 | include "common.asm" 2 | 3 | ; This ROM tests whether the window Y trigger can be activated even when WX 4 | ; is offscreen. 5 | 6 | Section "VBLANK ISR", ROM0[$40] 7 | jp Vblank 8 | 9 | Section "STAT ISR", ROM0[$48] 10 | jp hl 11 | 12 | SECTION "Start", ROM0[$0100] 13 | Entrypoint: 14 | nop 15 | jp main 16 | 17 | REPT $150 - $104 18 | db 0 19 | ENDR 20 | 21 | SECTION "ROM", ROM0[$0150] 22 | main: 23 | di 24 | ld sp, $FFFC 25 | 26 | call DisableLCD 27 | 28 | ; Zero fill WRAM 29 | ld d, 0 30 | ld bc, $2000 31 | ld hl, $C000 32 | call Memset 33 | 34 | ld d, 0 35 | ld bc, 32 36 | ld hl, $FF80 37 | call Memset 38 | 39 | ; Copy in font 40 | ld bc, 128 * 16 ; 16 bytes per tile 41 | ld de, Font 42 | ld hl, $9000 43 | call Memcpy 44 | 45 | TestScreen: 46 | call DisableLCD 47 | 48 | ld de, MainText 49 | ld hl, $9800 50 | call StrcpyNoNullTilemapSmart 51 | 52 | ld de, PassText 53 | ld hl, $9C00 54 | call StrcpyNoNullTilemapSmart 55 | 56 | ld a, LCDCF_BGON | LCDCF_WINON | LCDCF_ON | LCDCF_BG8800 | LCDCF_BG9800 | LCDCF_WIN9C00 57 | ld [rLCDC], a 58 | 59 | ld a, 7 60 | ld [rWX], a 61 | ld a, 0 62 | ld [rWY], a 63 | 64 | ld a, STATF_LYC 65 | ld [rSTAT], a 66 | 67 | ei 68 | 69 | ; set STAT IRQ jump vector 70 | ld hl, MoveWY 71 | ld a, 13 72 | ld [rLYC], a 73 | 74 | ld a, IEF_LCDC | IEF_VBLANK 75 | ld [rIE], a 76 | 77 | .rehalt: 78 | halt 79 | jr .rehalt 80 | 81 | ; Test that Window Y stays triggered even after WY is moved somewhere else 82 | ; LY=13 83 | MoveWY: 84 | ld a, 144 85 | ld [rWY], a 86 | 87 | ld hl, MoveWindow 88 | ld a, 56 89 | ld [rLYC], a 90 | reti 91 | 92 | ; LY=56 93 | MoveWindow: 94 | ld a, 0 95 | ld [rWY], a 96 | ld a, 7 97 | ld [rWX], a 98 | reti 99 | 100 | Vblank: 101 | ; Set Window Y Trigger to 12 102 | ld a, 12 103 | ld [rWY], a 104 | ld a, 167 105 | ld [rWX], a 106 | 107 | ; reset STAT IRQ jump vector 108 | ld hl, MoveWY 109 | ld a, 13 110 | ld [rLYC], a 111 | 112 | reti 113 | 114 | SECTION "Font", ROMX 115 | Font: INCBIN "ags-aging-font.chr" 116 | 117 | SECTION "Text", ROMX 118 | PassText: 119 | db "8\n" 120 | db "9 If this text is\n" 121 | db "10 visible,the test\n" 122 | db "11 is OK!\n" 123 | db "12\n" 124 | db "13 Test OK!\n" 125 | db "14\n" 126 | db "15\n" 127 | db "16\n" 128 | db "17\n" 129 | db "18\n",0 130 | 131 | MainText: 132 | db "1 LY=WY Trigger\n" 133 | db "2 WX Offscreen Test\n" 134 | db "3\n" 135 | db "4 The numbers 1-18\n" 136 | db "5 should be visible\n" 137 | db "6 on the left side\n" 138 | db "7 of the screen.\n" 139 | db "8\n" 140 | db " You should not be\n" 141 | db " able to see this\n" 142 | db " text.\n" 143 | db "\n" 144 | db " Test failed." 145 | db "\n" 146 | db " You should not be\n" 147 | db " able to see this\n" 148 | db " text.\n" 149 | db "\n" 150 | db " Test failed.",0 --------------------------------------------------------------------------------