├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── bootix_dmg.asm ├── bootix_mgb.asm ├── img └── bootix-dmg.gif └── inc └── hardware.inc /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.bin -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Creative Commons Legal Code 2 | 3 | CC0 1.0 Universal 4 | 5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE 6 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN 7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS 8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES 9 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS 10 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM 11 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED 12 | HEREUNDER. 13 | 14 | Statement of Purpose 15 | 16 | The laws of most jurisdictions throughout the world automatically confer 17 | exclusive Copyright and Related Rights (defined below) upon the creator 18 | and subsequent owner(s) (each and all, an "owner") of an original work of 19 | authorship and/or a database (each, a "Work"). 20 | 21 | Certain owners wish to permanently relinquish those rights to a Work for 22 | the purpose of contributing to a commons of creative, cultural and 23 | scientific works ("Commons") that the public can reliably and without fear 24 | of later claims of infringement build upon, modify, incorporate in other 25 | works, reuse and redistribute as freely as possible in any form whatsoever 26 | and for any purposes, including without limitation commercial purposes. 27 | These owners may contribute to the Commons to promote the ideal of a free 28 | culture and the further production of creative, cultural and scientific 29 | works, or to gain reputation or greater distribution for their Work in 30 | part through the use and efforts of others. 31 | 32 | For these and/or other purposes and motivations, and without any 33 | expectation of additional consideration or compensation, the person 34 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she 35 | is an owner of Copyright and Related Rights in the Work, voluntarily 36 | elects to apply CC0 to the Work and publicly distribute the Work under its 37 | terms, with knowledge of his or her Copyright and Related Rights in the 38 | Work and the meaning and intended legal effect of CC0 on those rights. 39 | 40 | 1. Copyright and Related Rights. A Work made available under CC0 may be 41 | protected by copyright and related or neighboring rights ("Copyright and 42 | Related Rights"). Copyright and Related Rights include, but are not 43 | limited to, the following: 44 | 45 | i. the right to reproduce, adapt, distribute, perform, display, 46 | communicate, and translate a Work; 47 | ii. moral rights retained by the original author(s) and/or performer(s); 48 | iii. publicity and privacy rights pertaining to a person's image or 49 | likeness depicted in a Work; 50 | iv. rights protecting against unfair competition in regards to a Work, 51 | subject to the limitations in paragraph 4(a), below; 52 | v. rights protecting the extraction, dissemination, use and reuse of data 53 | in a Work; 54 | vi. database rights (such as those arising under Directive 96/9/EC of the 55 | European Parliament and of the Council of 11 March 1996 on the legal 56 | protection of databases, and under any national implementation 57 | thereof, including any amended or successor version of such 58 | directive); and 59 | vii. other similar, equivalent or corresponding rights throughout the 60 | world based on applicable law or treaty, and any national 61 | implementations thereof. 62 | 63 | 2. Waiver. To the greatest extent permitted by, but not in contravention 64 | of, applicable law, Affirmer hereby overtly, fully, permanently, 65 | irrevocably and unconditionally waives, abandons, and surrenders all of 66 | Affirmer's Copyright and Related Rights and associated claims and causes 67 | of action, whether now known or unknown (including existing as well as 68 | future claims and causes of action), in the Work (i) in all territories 69 | worldwide, (ii) for the maximum duration provided by applicable law or 70 | treaty (including future time extensions), (iii) in any current or future 71 | medium and for any number of copies, and (iv) for any purpose whatsoever, 72 | including without limitation commercial, advertising or promotional 73 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each 74 | member of the public at large and to the detriment of Affirmer's heirs and 75 | successors, fully intending that such Waiver shall not be subject to 76 | revocation, rescission, cancellation, termination, or any other legal or 77 | equitable action to disrupt the quiet enjoyment of the Work by the public 78 | as contemplated by Affirmer's express Statement of Purpose. 79 | 80 | 3. Public License Fallback. Should any part of the Waiver for any reason 81 | be judged legally invalid or ineffective under applicable law, then the 82 | Waiver shall be preserved to the maximum extent permitted taking into 83 | account Affirmer's express Statement of Purpose. In addition, to the 84 | extent the Waiver is so judged Affirmer hereby grants to each affected 85 | person a royalty-free, non transferable, non sublicensable, non exclusive, 86 | irrevocable and unconditional license to exercise Affirmer's Copyright and 87 | Related Rights in the Work (i) in all territories worldwide, (ii) for the 88 | maximum duration provided by applicable law or treaty (including future 89 | time extensions), (iii) in any current or future medium and for any number 90 | of copies, and (iv) for any purpose whatsoever, including without 91 | limitation commercial, advertising or promotional purposes (the 92 | "License"). The License shall be deemed effective as of the date CC0 was 93 | applied by Affirmer to the Work. Should any part of the License for any 94 | reason be judged legally invalid or ineffective under applicable law, such 95 | partial invalidity or ineffectiveness shall not invalidate the remainder 96 | of the License, and in such case Affirmer hereby affirms that he or she 97 | will not (i) exercise any of his or her remaining Copyright and Related 98 | Rights in the Work or (ii) assert any associated claims and causes of 99 | action with respect to the Work, in either case contrary to Affirmer's 100 | express Statement of Purpose. 101 | 102 | 4. Limitations and Disclaimers. 103 | 104 | a. No trademark or patent rights held by Affirmer are waived, abandoned, 105 | surrendered, licensed or otherwise affected by this document. 106 | b. Affirmer offers the Work as-is and makes no representations or 107 | warranties of any kind concerning the Work, express, implied, 108 | statutory or otherwise, including without limitation warranties of 109 | title, merchantability, fitness for a particular purpose, non 110 | infringement, or the absence of latent or other defects, accuracy, or 111 | the present or absence of errors, whether or not discoverable, all to 112 | the greatest extent permissible under applicable law. 113 | c. Affirmer disclaims responsibility for clearing rights of other persons 114 | that may apply to the Work or any use thereof, including without 115 | limitation any person's Copyright and Related Rights in the Work. 116 | Further, Affirmer disclaims responsibility for obtaining any necessary 117 | consents, permissions or other rights required for any use of the 118 | Work. 119 | d. Affirmer understands and acknowledges that Creative Commons is not a 120 | party to this document and has no duty or obligation with respect to 121 | this CC0 or use of the Work. 122 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | RGBASM = rgbasm 2 | RGBLINK = rgblink 3 | 4 | RM_F = rm -f 5 | 6 | ASFLAGS = -h 7 | LDFLAGS = -t -w -x 8 | 9 | bootix_%.bin: bootix_%.o 10 | $(RGBLINK) $(LDFLAGS) -o $@ $^ 11 | 12 | bootix_%.o: bootix_%.asm 13 | $(RGBASM) $(ASFLAGS) -o $@ $< 14 | 15 | all: $(addsuffix .bin, $(basename $(wildcard bootix_*.asm))) 16 | 17 | .PHONY: clean 18 | clean: 19 | $(RM_F) bootix_dmg.o bootix_dmg.bin -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Bootix 2 | Custom copyright-free Gameboy Bootroms. Everything you see is licensed with CC0-1.0, meaning you can use it literally anywhere for anything and I can't do anything about it. (Not that I'd mind anyway) 3 | 4 | ### Bootix DMG/MGB: 5 | 6 | ![bootix-dmg](./img/bootix-dmg.gif) 7 | -------------------------------------------------------------------------------- /bootix_dmg.asm: -------------------------------------------------------------------------------- 1 | INCLUDE "inc/hardware.inc" 2 | 3 | SCX_MAX_OFF EQU $10 4 | ANIM_TIMEOUT EQU 28 5 | SOUND_TIMEOUT_1 EQU 39 6 | SOUND_TIMEOUT_2 EQU 394 7 | 8 | SECTION "Bootrom", ROM0[0] 9 | ; Initialize SP 10 | ld sp, $FFFE 11 | 12 | ; Clear VRAM 13 | ld hl, $9FFF 14 | ClearVRAM: 15 | xor a 16 | ld [hld], a 17 | bit 7, h 18 | jr nz, ClearVRAM 19 | 20 | ; Initialize Audio 21 | ld c, $11 22 | ld hl, rAUDENA 23 | ld a, AUDENA_ON 24 | ld [hld], a 25 | ldh [$ff00+c], a 26 | inc c 27 | ld a, $F3 28 | ld [hld], a 29 | ldh [$ff00+c], a 30 | inc c 31 | ld a, $77 32 | ld [hld], a 33 | ldh [$ff00+c], a 34 | 35 | ; Decode logo and load into VRAM 36 | ld de, $0104 37 | ld hl, $8010 38 | DecodeLoop: 39 | ; Decode first 4 bits of byte 40 | ld a, [de] 41 | call LoadLogoNibble 42 | 43 | ; Decode second 4 bits of byte 44 | ld a, [de] 45 | swap a 46 | call LoadLogoNibble 47 | 48 | ; Loop if necessary 49 | inc de 50 | ld a, e 51 | cp $34 52 | jr nz, DecodeLoop 53 | 54 | ; Load Trademark Symbol into VRAM 55 | ld de, TrademarkLogo 56 | ld b, 8 57 | TrademarkLoadLoop: 58 | ld a, [de] 59 | inc de 60 | ld [hli], a 61 | inc hl 62 | dec b 63 | jr nz, TrademarkLoadLoop 64 | 65 | ; Initialize tilemap (Row 1) 66 | ld hl, $9904 67 | ld bc, $010C 68 | call LogoMapInit 69 | ; Trademark Symbol 70 | ld a, $19 71 | ld [hl], a 72 | 73 | ; Initialize Tilemap (Row 2) 74 | ld hl, $9924 75 | ld c, $0C 76 | call LogoMapInit 77 | 78 | ; Initialize LCDC 79 | ld a, LCDCF_ON | LCDCF_BG8000 | LCDCF_BGON 80 | ldh [rLCDC], a 81 | 82 | ; Play intro animation 83 | ld b, SCX_MAX_OFF 84 | ld de, FadeValues 85 | IntroAnimLoop: 86 | ; Set SCX to OFFSET 87 | ld a, b 88 | ldh [rSCX], a 89 | dec b 90 | 91 | ; Update BGP Fade 92 | ld a, e 93 | cp LOW(FadeValues+4) 94 | jr z, .skipFade 95 | ld a, [de] 96 | ldh [rBGP], a 97 | inc de 98 | .skipFade 99 | 100 | ; Wait... 101 | ld c, ANIM_TIMEOUT 102 | call DoTimeout 103 | 104 | ; Set SCX to -OFFSET 105 | xor a 106 | sub b 107 | ldh [rSCX], a 108 | dec b 109 | 110 | ; Wait... (Return to loop if OFFSET != 0) 111 | ld c, ANIM_TIMEOUT 112 | call DoTimeout 113 | xor a 114 | or b 115 | jr nz, IntroAnimLoop 116 | ldh [rSCX], a 117 | 118 | ; Play sound 1 119 | ld a, $83 120 | call PlaySound 121 | 122 | ; Wait... 123 | ld c, SOUND_TIMEOUT_1 124 | call DoTimeout 125 | 126 | ; Play sound 2 127 | ld a, $C1 128 | call PlaySound 129 | 130 | ; Wait... 131 | ld de, SOUND_TIMEOUT_2 132 | LongWaitLoop: 133 | ldh a, [rLY] 134 | cp SCRN_Y 135 | jr nz, LongWaitLoop 136 | dec de 137 | ld a, d 138 | or e 139 | jr nz, LongWaitLoop 140 | 141 | ; Finalize Bootrom 142 | jr EndBootrom 143 | 144 | PlaySound: 145 | ld c, $13 146 | ld [$ff00+c], a 147 | inc c 148 | ld a, $87 149 | ld [$ff00+c], a 150 | ret 151 | 152 | ; Routine for waiting a certain amount of time 153 | DoTimeout: 154 | ldh a, [rLY] 155 | cp SCRN_Y 156 | jr nz, DoTimeout 157 | dec c 158 | jr nz, DoTimeout 159 | ret 160 | 161 | ; Routine for loading logo tile numbers into VRAM 162 | LogoMapInit: 163 | ld a, b 164 | ld [hli], a 165 | inc b 166 | dec c 167 | jr nz, LogoMapInit 168 | ret 169 | 170 | ; Routine for converting logo byte to VRAM data 171 | LoadLogoNibble: 172 | ld b, a 173 | ld c, $04 174 | xor a 175 | .bitShiftLoop 176 | push bc 177 | rl b 178 | rla 179 | pop bc 180 | rl b 181 | rla 182 | dec c 183 | jr nz, .bitShiftLoop 184 | ld [hli], a 185 | inc hl 186 | ld [hli], a 187 | inc hl 188 | ret 189 | 190 | ; Trademark Logo 191 | TrademarkLogo: 192 | db $3C, $42, $B9, $A5, $B9, $A5, $42, $3C 193 | 194 | ; BGP Fade Values 195 | FadeValues: 196 | db %00000000, %01010100, %10101000, %11111100 197 | 198 | ; Mandatory Copyright Notice 199 | db "BOOTIX.DMG v1.2", 0 200 | 201 | EndBootrom: 202 | ; Initialize registers 203 | ld a, $FF 204 | add $01 205 | dec bc 206 | ld e, $D8 207 | ld hl, $014D 208 | 209 | ; Pad remaining space with NOP 210 | ds $100-@-4, 0 211 | 212 | ; Disable Bootrom 213 | ld a, $01 214 | ldh [$FF50], a -------------------------------------------------------------------------------- /bootix_mgb.asm: -------------------------------------------------------------------------------- 1 | INCLUDE "inc/hardware.inc" 2 | 3 | SCX_MAX_OFF EQU $10 4 | ANIM_TIMEOUT EQU 30 5 | SOUND_TIMEOUT_1 EQU 30 6 | SOUND_TIMEOUT_2 EQU 498 7 | 8 | SECTION "Bootrom", ROM0[0] 9 | ; Initialize SP 10 | ld sp, $FFFE 11 | 12 | ; Clear VRAM 13 | ld hl, $9FFF 14 | ClearVRAM: 15 | xor a 16 | ld [hld], a 17 | bit 7, h 18 | jr nz, ClearVRAM 19 | 20 | ; Initialize Audio 21 | ld c, $11 22 | ld hl, rAUDENA 23 | ld a, AUDENA_ON 24 | ld [hld], a 25 | ldh [$ff00+c], a 26 | inc c 27 | ld a, $F3 28 | ld [hld], a 29 | ldh [$ff00+c], a 30 | inc c 31 | ld a, $77 32 | ld [hld], a 33 | ldh [$ff00+c], a 34 | 35 | ; Decode logo and load into VRAM 36 | ld de, $0104 37 | ld hl, $8010 38 | DecodeLoop: 39 | ; Decode first 4 bits of byte 40 | ld a, [de] 41 | call LoadLogoNibble 42 | 43 | ; Decode second 4 bits of byte 44 | ld a, [de] 45 | swap a 46 | call LoadLogoNibble 47 | 48 | ; Loop if necessary 49 | inc de 50 | ld a, e 51 | cp $34 52 | jr nz, DecodeLoop 53 | 54 | ; Load Trademark Symbol into VRAM 55 | ld de, TrademarkLogo 56 | ld b, 8 57 | TrademarkLoadLoop: 58 | ld a, [de] 59 | inc de 60 | ld [hli], a 61 | inc hl 62 | dec b 63 | jr nz, TrademarkLoadLoop 64 | 65 | ; Initialize tilemap (Row 1) 66 | ld hl, $9904 67 | ld bc, $010C 68 | call LogoMapInit 69 | ; Trademark Symbol 70 | ld a, $19 71 | ld [hl], a 72 | 73 | ; Initialize Tilemap (Row 2) 74 | ld hl, $9924 75 | ld c, $0C 76 | call LogoMapInit 77 | 78 | ; Initialize LCDC 79 | ld a, LCDCF_ON | LCDCF_BG8000 | LCDCF_BGON 80 | ldh [rLCDC], a 81 | 82 | ; Play intro animation 83 | ld b, SCX_MAX_OFF 84 | ld de, FadeValues 85 | IntroAnimLoop: 86 | ; Set SCX to OFFSET 87 | ld a, b 88 | ldh [rSCX], a 89 | dec b 90 | 91 | ; Update BGP Fade 92 | ld a, e 93 | cp LOW(FadeValues+4) 94 | jr z, .skipFade 95 | ld a, [de] 96 | ldh [rBGP], a 97 | inc de 98 | .skipFade 99 | 100 | ; Wait... 101 | ld c, ANIM_TIMEOUT 102 | call DoTimeout 103 | 104 | ; Set SCX to -OFFSET 105 | xor a 106 | sub b 107 | ldh [rSCX], a 108 | dec b 109 | 110 | ; Wait... (Return to loop if OFFSET != 0) 111 | ld c, ANIM_TIMEOUT 112 | call DoTimeout 113 | xor a 114 | or b 115 | jr nz, IntroAnimLoop 116 | ldh [rSCX], a 117 | 118 | ; Play sound 1 119 | ld a, $83 120 | call PlaySound 121 | 122 | ; Wait... 123 | ld c, SOUND_TIMEOUT_1 124 | call DoTimeout 125 | 126 | ; Play sound 2 127 | ld a, $C1 128 | call PlaySound 129 | 130 | ; Wait... 131 | ld de, SOUND_TIMEOUT_2 132 | LongWaitLoop: 133 | ldh a, [rLY] 134 | cp SCRN_Y 135 | jr nz, LongWaitLoop 136 | dec de 137 | ld a, d 138 | or e 139 | jr nz, LongWaitLoop 140 | 141 | ; Finalize Bootrom 142 | jr EndBootrom 143 | 144 | PlaySound: 145 | ld c, $13 146 | ld [$ff00+c], a 147 | inc c 148 | ld a, $87 149 | ld [$ff00+c], a 150 | ret 151 | 152 | ; Routine for waiting a certain amount of time 153 | DoTimeout: 154 | ldh a, [rLY] 155 | cp SCRN_Y 156 | jr nz, DoTimeout 157 | dec c 158 | jr nz, DoTimeout 159 | ret 160 | 161 | ; Routine for loading logo tile numbers into VRAM 162 | LogoMapInit: 163 | ld a, b 164 | ld [hli], a 165 | inc b 166 | dec c 167 | jr nz, LogoMapInit 168 | ret 169 | 170 | ; Routine for converting logo byte to VRAM data 171 | LoadLogoNibble: 172 | ld b, a 173 | ld c, $04 174 | xor a 175 | .bitShiftLoop 176 | push bc 177 | rl b 178 | rla 179 | pop bc 180 | rl b 181 | rla 182 | dec c 183 | jr nz, .bitShiftLoop 184 | ld [hli], a 185 | inc hl 186 | ld [hli], a 187 | inc hl 188 | ret 189 | 190 | ; Trademark Logo 191 | TrademarkLogo: 192 | db $3C, $42, $B9, $A5, $B9, $A5, $42, $3C 193 | 194 | ; BGP Fade Values 195 | FadeValues: 196 | db %00000000, %01010100, %10101000, %11111100 197 | 198 | ; Mandatory Copyright Notice 199 | db "BOOTIX.DMG v1.2", 0 200 | 201 | EndBootrom: 202 | ; Initialize registers 203 | ld a, $FF 204 | add $01 205 | dec bc 206 | ld e, $D8 207 | ld hl, $014D 208 | 209 | ; Pad remaining space with NOP 210 | ds $100-@-4, 0 211 | 212 | ; Disable Bootrom 213 | ld a, $FF 214 | ldh [$FF50], a -------------------------------------------------------------------------------- /img/bootix-dmg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hacktix/Bootix/e2121d0f2e5665efd87b53b53d16ea61775898f3/img/bootix-dmg.gif -------------------------------------------------------------------------------- /inc/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 | ENDC ;HARDWARE_INC --------------------------------------------------------------------------------