-
Notifications
You must be signed in to change notification settings - Fork 21
Release hardware.inc version 4.10 #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add more constants - Deprecate some alias constants - Move change log to HISTORY.md file - Regroup and reformat constants - Define `F`lags in terms of shifted `B`its
(I don't have review-request permissions in this repository, so: @ISSOtm @avivace @AntonioND @nitro2k01 @FredrIQ @vulcandth maybe in the next week or so y'all can take a look at this?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for this highly thorough change!
The nature of a review means I am only going to point out the things that I disagree with, but I have to say that I'm a big fan of the improvements here, including some of the more intuitive names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now!
Before merging, correct the date in HISTORY.md! Then, do "squash and merge"!
Although this is a large PR, it does not break any backwards compatibility. All the pre-existing constants are still defined. This should be a drop-in replacement for anyone using hardware.inc 4.9.2.
The changes here fall into a few categories:
New constants
A
HARDWARE_INC_VERSION
string constant (currently"4.10.0"
) to provide more flexibility than therev_Check_hardware_inc
macro.We now consistently define
<REG>B_<FIELD>
for bit values (0-7, to be used withbit
,set
,res
) and<REG>F_<FIELD>
for flag values (to be used withand
,or
,xor
). Some<REG>F_<FIELD>
are also meant as values (to be used withld
). Previously many registers had flags but not bits, or sometimes vice-versa, or lacked any field bits/flags at all even though Pan Docs described some.Some new registers:
rKEY0
($FF4C) andrBANK
($FF50). These are boot ROM registers which were already documented in Pan Docs, but only defined in gb-bootroms.A new
rRTCREG
($A000) register that is affected byrRAMB
andrRTCLATCH
for MBC3. (pokecrystal's hardware_constants.asm had called thisMBC3RTC
.)Some new preferred aliases have been defined:
rJOYP
forrP1
: Pan Docs already listed this as an alias, and used it more widely thanP1
(e.g. in thestop
diagram), and it's more human-readable.rVDMA_*
forrHDMA1-5
: This continues the pattern of how we addedrAUD*
aliases for therNRxx
registers a long time ago (before the initial commit in this repository). I used "VDMA" here for "video DMA", since "horizontal/HBlank DMA" and "general DMA" are the two modes it can take.rVDMA_SRC_HIGH
forrHDMA1
rVDMA_SRC_LOW
forrHDMA2
rVDMA_DEST_HIGH
forrHDMA3
rVDMA_DEST_LOW
forrHDMA4
rVDMA_LEN
forrHDMA5
rWBK
forrSVBK
akarSMBK
: This was suggested in rHDMAx alternative names #36, and makes more sense as "WRAM bank" (pairing withrVBK
for "VRAM bank").IEB_JOYPAD
andIEF_JOYPAD
forIEB_HILO
andIEF_HILO
: This is the Joypad interrupt, not the "hilo" interrupt.OBJ_B
forsizeof_OAM_ATTRS
: This matches theSCRN_X_B
andSCRN_Y_B
byte-size constants, and avoids a one-off lowercase "sizeof_*
".PADF_SWAP_*
constants as alternatives to the existingPADF_*
constants, with a swapped convention of putting Control Pad bits in the low nybble instead of the high nybble.More constants are defined related to tiles, palettes and colors, grouped with the screen-related constants.
A complete list new newly available constants is at https://pastebin.com/V4eq0zPe.
Deprecations
Again, although nothing has been removed, some things have been commented as "deprecated", with preferred alternatives available from RGBASM, RGBLINK, and RGBFIX.
Memory region constants, like
_RAMBANK
: since RGBASM 0.7.0, you can doSTARTOF(WRAMX)
instead. Note that the actual value gets resolved by RGBLINK, since some settings (like-d/--dmg
) can affect which section types span which memory.Cartridge header constants, like
NINTENDO_LOGO
orCART_ROM_*
MBC values: You can reserve aSECTION
for your cartridge header filled with $00s, and should use RGBFIX to assign appropriate values inside it (including correct checksums).Reformatting and reorganizing
Comments take up less vertical space. Heading comments have changed from this:
to this:
And subheading comments have changed from this:
to this:
Register readability/writeability indicators have changed from
(R/W)
(R)
(W)
to[r/w]
[ro]
[wo]
.Lowercase
def equ
instead ofDEF EQU
so the all-caps constant names stand out more.Associated/dependent constants are indented. Now that RGBASM uses
def
to introduce definitions, this is legal, and helps to indicate a "hierarchy" of constants (e.g. flag values being derived from bit values).Use
equ
instead ofrb
to define OAM object field offsets, so we won't be disturbing the value of_RS
for the user.Comments noting which addresses in the $FF00-$FF7F range are "unused", so they don't look like oversights.
The history change log has moved from the top of the file to its own HISTORY.md file. This makes the actual file more compact, and enables Markdown formatting. In future we may want to backfill the changelog with more detail now that it wouldn't be bloating the main file.
Removed the links to Jeff Frohwein's devrs.com because it's now just a HostGator default page, and there's no need to link to his old hardware.inc v2.3 when we have it tagged already.
Resolutions
This resolves many open issues that have been neglected, some for years:
rHDMA1-5
now have alternative names, and we've addedrWBK
, CGB palette constants, andBGP_SGB_TRANSFER
($E4).PADF_*
andPADB_*
constants don't represent hardware values #37: ThePADF_*
constants are here to stay, and we've addedPADF_SWAP_*
constants to make it clear that this is a convention, not an inescapable fact of the hardware.F
lag values are defined as shiftedB
it values when possible. We decided against using macros becausedef REGF_FIELD equ 1 << REGB_FIELD
is minimal boilerplate and makes both names easily greppable.rJOYP
alias forrP1
#47:rJOYP
is now defined and preferred torP1
.rIE
? #48: We now defineIEB/F_JOYPAD
and have deprecatedIEB/F_HILO
.TILE_X
andTILE_Y
for the tile width and height of 8 pixels (comparable toSCRN_X
andSCRN_Y
), andTILE_B
for the 16-byte size.