From 40030c5baedf10ded8a287f969d76bfdbaac425b Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Mon, 27 Jun 2022 11:25:31 -0300 Subject: [PATCH 01/13] Update README.md Fixes #16 Fixes #21 --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 07aace9..ab0c7bf 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,9 @@ The file was originally created by Jeff Frohwein in 1997, who still hosts [his l Although Jeff tried to version control the file with a rudimentary change log at the top of the file, people have added small changes throughout the years, often without bumping the version number. -This repo is an attempt at version control, using [@AntonioND](http://github.com/AntonioND) fork as baseline. +This repo is an attempt at version control, using [@AntonioND](http://github.com/AntonioND)'s fork as the baseline. + +Breaking changes, like those in [72ec03f](https://github.com/gbdev/hardware.inc/commit/72ec03f835e72be83a1ef189a4a9eac0fbdf39e2), receive a major version bump, while smaller changes, not meant to break anything, yet are important enough to require a feature addition, recieve a minor version bump. ## Contributors @@ -14,5 +16,5 @@ This repo is an attempt at version control, using [@AntonioND](http://github.com * Carsten Sørensen (whose ideas Jeff based his file on) * Jeff Frohwein * AntonioND -* BlitterObjectBob, tobiasvl, ISSOtm, avivace, GreenAndEievui, QuinnPainter, rondnelson99, daid, Hacktix, sukus21, alvaro-cuesta, basxto +* BlitterObjectBob, tobiasvl, ISSOtm, avivace, GreenAndEievui, QuinnPainter, rondnelson99, daid, Hacktix, sukus21, alvaro-cuesta, basxto * Probably lots of other people who have added to the file throughout the years From 9e0ffd1100c624ed7c94fa2c2cecfb3a3c0b06c9 Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Mon, 27 Jun 2022 12:06:14 -0300 Subject: [PATCH 02/13] Apply suggestions from code review Reword the section about the release policy and the reviewer who made these suggestions Co-authored-by: Eievui <14899090+eievui5@users.noreply.github.com> --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ab0c7bf..593f01b 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Although Jeff tried to version control the file with a rudimentary change log at This repo is an attempt at version control, using [@AntonioND](http://github.com/AntonioND)'s fork as the baseline. -Breaking changes, like those in [72ec03f](https://github.com/gbdev/hardware.inc/commit/72ec03f835e72be83a1ef189a4a9eac0fbdf39e2), receive a major version bump, while smaller changes, not meant to break anything, yet are important enough to require a feature addition, recieve a minor version bump. +Breaking changes, like those in [72ec03f](https://github.com/gbdev/hardware.inc/commit/72ec03f835e72be83a1ef189a4a9eac0fbdf39e2) receive a major version bump, while smaller changes which add new features but do not make any breaking changes recieve a minor version bump. ## Contributors @@ -16,5 +16,5 @@ Breaking changes, like those in [72ec03f](https://github.com/gbdev/hardware.inc/ * Carsten Sørensen (whose ideas Jeff based his file on) * Jeff Frohwein * AntonioND -* BlitterObjectBob, tobiasvl, ISSOtm, avivace, GreenAndEievui, QuinnPainter, rondnelson99, daid, Hacktix, sukus21, alvaro-cuesta, basxto +* BlitterObjectBob, tobiasvl, ISSOtm, avivace, Eievui, QuinnPainter, rondnelson99, daid, Hacktix, sukus21, alvaro-cuesta, basxto * Probably lots of other people who have added to the file throughout the years From 46f7e1ebe7119095437dc7486c9366fced2df5fc Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Mon, 27 Jun 2022 12:07:13 -0300 Subject: [PATCH 03/13] Correct typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 593f01b..d972428 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Although Jeff tried to version control the file with a rudimentary change log at This repo is an attempt at version control, using [@AntonioND](http://github.com/AntonioND)'s fork as the baseline. -Breaking changes, like those in [72ec03f](https://github.com/gbdev/hardware.inc/commit/72ec03f835e72be83a1ef189a4a9eac0fbdf39e2) receive a major version bump, while smaller changes which add new features but do not make any breaking changes recieve a minor version bump. +Breaking changes, like those in [72ec03f](https://github.com/gbdev/hardware.inc/commit/72ec03f835e72be83a1ef189a4a9eac0fbdf39e2) receive a major version bump, while smaller changes which add new features but do not make any breaking changes receive a minor version bump. ## Contributors From c94f0f2f91e1c98cc808a018017b494f68bd5e15 Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Mon, 27 Jun 2022 12:10:00 -0300 Subject: [PATCH 04/13] Add intentions blurb --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d972428..0580c2b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # `hardware.inc` ### Gameboy Hardware definitions -`hardware.inc` has been the standard include file containing Game Boy hardware definitions for use in [rgbds](https://github.com/gbdev/rgbds) projects for over 20 years. +`hardware.inc` has been the standard include file containing Game Boy hardware definitions for use in [rgbds](https://github.com/gbdev/rgbds) projects for over 20 years. Our intent here at gbdev is to continue to use `hardware.inc` as the standard as it has been for all these years. The file was originally created by Jeff Frohwein in 1997, who still hosts [his latest version (2.3)](http://www.devrs.com/gb/files/hardware.zip) on his great [Dev'rs](http://devrs.com) website. From 66179df9c787f2e402c4f9538843079efcaffc71 Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Mon, 27 Jun 2022 14:31:35 -0300 Subject: [PATCH 05/13] Added in the relevant entries from ISSOtm's suggestions --- README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0580c2b..cfe61bd 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,22 @@ # `hardware.inc` ### Gameboy Hardware definitions -`hardware.inc` has been the standard include file containing Game Boy hardware definitions for use in [rgbds](https://github.com/gbdev/rgbds) projects for over 20 years. Our intent here at gbdev is to continue to use `hardware.inc` as the standard as it has been for all these years. +`hardware.inc` has been the standard include file containing Game Boy hardware definitions for use in [RGBDS](https://rgbds.gbdev.io) projects for over 20 years. The file was originally created by Jeff Frohwein in 1997, who still hosts [his latest version (2.3)](http://www.devrs.com/gb/files/hardware.zip) on his great [Dev'rs](http://devrs.com) website. Although Jeff tried to version control the file with a rudimentary change log at the top of the file, people have added small changes throughout the years, often without bumping the version number. -This repo is an attempt at version control, using [@AntonioND](http://github.com/AntonioND)'s fork as the baseline. +This repo is an attempt at version control, using [@AntonioND](http://github.com/AntonioND)'s fork as the baseline. It has become the new official reference for documentation of the Game Boy and the underlying hardware. -Breaking changes, like those in [72ec03f](https://github.com/gbdev/hardware.inc/commit/72ec03f835e72be83a1ef189a4a9eac0fbdf39e2) receive a major version bump, while smaller changes which add new features but do not make any breaking changes receive a minor version bump. +## Contributing + +This repository's `master` branch should be considered production. +That is, each commit represents a new release, which thus needs the embedded version number bumped (and an entry added to the changelog at the beginning of the file). + +We follow [semantic versioning](https://semver.org). +That is, breaking changes (such as those in [72ec03f](https://github.com/gbdev/hardware.inc/commit/72ec03f835e72be83a1ef189a4a9eac0fbdf39e2)) increase the major version, backwards-compatible changes (typically additions) only increase the minor version, and bugfixes only increase the patch level. + +Changes to the comments should be considered a bugfix. ## Contributors From f2e346ff81bb93a519b758cb847531da700dccca Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Mon, 27 Jun 2022 15:13:10 -0300 Subject: [PATCH 06/13] Separate the baseline/reference line into two lines Separate the line stating the baseline and the fact that this is the new official reference Co-authored-by: Eldred Habert --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cfe61bd..b7bb5f9 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ The file was originally created by Jeff Frohwein in 1997, who still hosts [his l Although Jeff tried to version control the file with a rudimentary change log at the top of the file, people have added small changes throughout the years, often without bumping the version number. -This repo is an attempt at version control, using [@AntonioND](http://github.com/AntonioND)'s fork as the baseline. It has become the new official reference for documentation of the Game Boy and the underlying hardware. +This repo is an attempt at version control, using [@AntonioND](http://github.com/AntonioND)'s fork as the baseline. +It has become the new official reference for documentation of the Game Boy and the underlying hardware. ## Contributing From 3766cd3022fc7c8a75d4b8c30b09de2a7fdd7180 Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Mon, 27 Jun 2022 19:42:09 -0300 Subject: [PATCH 07/13] Reworded the paragraph about the repo and what it's status is --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index b7bb5f9..7f4c347 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,7 @@ The file was originally created by Jeff Frohwein in 1997, who still hosts [his l Although Jeff tried to version control the file with a rudimentary change log at the top of the file, people have added small changes throughout the years, often without bumping the version number. -This repo is an attempt at version control, using [@AntonioND](http://github.com/AntonioND)'s fork as the baseline. -It has become the new official reference for documentation of the Game Boy and the underlying hardware. +This repo has become the new official reference for `hardware.inc`, using [@AntonioND](http://github.com/AntonioND)'s fork as the baseline. ## Contributing From 919498865404d91d52b37e61285f4fd10a88028f Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Tue, 28 Jun 2022 09:01:18 +0200 Subject: [PATCH 08/13] Make `rev_Check_hardware_inc` use SemVer --- hardware.inc | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/hardware.inc b/hardware.inc index 1a58f27..808329c 100644 --- a/hardware.inc +++ b/hardware.inc @@ -33,6 +33,9 @@ ;* Rev 4.5 - 03-Mar-22 : Added bit number definitions for OCPS, BCPS and LCDC (sukus) ;* Rev 4.6 - 15-Jun-22 : Added MBC3 registers and special values +; NOTE: REVISION NUMBER CHANGES MUST BE REFLECTED +; IN `rev_Check_hardware_inc` BELOW! + IF __RGBDS_MAJOR__ == 0 && __RGBDS_MINOR__ < 5 FAIL "This version of 'hardware.inc' requires RGBDS version 0.5.0 or later." ENDC @@ -42,12 +45,21 @@ ENDC IF !DEF(HARDWARE_INC) DEF HARDWARE_INC EQU 1 +; Usage: rev_Check_hardware_inc +; Examples: rev_Check_hardware_inc 4.1.2 +; rev_Check_hardware_inc 4.1 (equivalent to 4.1.0) +; rev_Check_hardware_inc 4 (equivalent to 4.0.0) MACRO rev_Check_hardware_inc -;NOTE: REVISION NUMBER CHANGES MUST BE ADDED -;TO SECOND PARAMETER IN FOLLOWING LINE. - IF \1 > 4.6 ;PUT REVISION NUMBER HERE - WARN "Version \1 or later of 'hardware.inc' is required." + DEF CUR_VER equs "4,6,0" ; ** UPDATE THIS LINE WHEN CHANGING THE REVISION NUMBER ** + DEF MIN_VER equs STRRPL("\1", ".", ",") + DEF INTERNAL_CHK equs """MACRO ___internal + IF \\1 != \\4 || \\2 < \\5 || (\\2 == \\5 && \\3 < \\6) + FAIL "Version \\1.\\2.\\3 of 'hardware.inc' is incompatible with requested version \\4.\\5.\\6" ENDC +\nENDM""" + INTERNAL_CHK + ___internal {CUR_VER}, {MIN_VER},0,0 + PURGE CUR_VER, MIN_VER, INTERNAL_CHK, ___internal ENDM From 853d325989de3607f83a24b86c8410b51f156109 Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Tue, 5 Jul 2022 10:43:18 -0300 Subject: [PATCH 09/13] Apply suggestions from code review Most of the rewording suggestions from avivace's review implemented Co-authored-by: Antonio Vivace --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7f4c347..0fff933 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,11 @@ This repo has become the new official reference for `hardware.inc`, using [@Anto ## Contributing -This repository's `master` branch should be considered production. -That is, each commit represents a new release, which thus needs the embedded version number bumped (and an entry added to the changelog at the beginning of the file). +This repository's `master` branch should be considered production: +Each commit represents a new release, requiring the embedded version number to be bumped (and an entry to be added to the changelog at the beginning of the file). We follow [semantic versioning](https://semver.org). -That is, breaking changes (such as those in [72ec03f](https://github.com/gbdev/hardware.inc/commit/72ec03f835e72be83a1ef189a4a9eac0fbdf39e2)) increase the major version, backwards-compatible changes (typically additions) only increase the minor version, and bugfixes only increase the patch level. +Breaking changes (such as those in [72ec03f](https://github.com/gbdev/hardware.inc/commit/72ec03f835e72be83a1ef189a4a9eac0fbdf39e2)) increase the major version, backwards-compatible changes (typically additions) only increase the minor version, and bugfixes only increase the patch level. Changes to the comments should be considered a bugfix. From 4e079050ac6ba098bb0e61604a9e9631b5e4931e Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Tue, 5 Jul 2022 14:54:06 -0300 Subject: [PATCH 10/13] Apply ISSOtm's grammatically correct suggestion --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0fff933..ec38798 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ This repo has become the new official reference for `hardware.inc`, using [@Anto This repository's `master` branch should be considered production: Each commit represents a new release, requiring the embedded version number to be bumped (and an entry to be added to the changelog at the beginning of the file). -We follow [semantic versioning](https://semver.org). +We follow [semantic versioning](https://semver.org); Breaking changes (such as those in [72ec03f](https://github.com/gbdev/hardware.inc/commit/72ec03f835e72be83a1ef189a4a9eac0fbdf39e2)) increase the major version, backwards-compatible changes (typically additions) only increase the minor version, and bugfixes only increase the patch level. Changes to the comments should be considered a bugfix. From 7996c04a4b783298597b7c6c60d362356882d6ad Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Tue, 5 Jul 2022 14:56:05 -0300 Subject: [PATCH 11/13] That was a semicolon not a colon :P --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ec38798..ad59708 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ This repo has become the new official reference for `hardware.inc`, using [@Anto ## Contributing -This repository's `master` branch should be considered production: +This repository's `master` branch should be considered production; Each commit represents a new release, requiring the embedded version number to be bumped (and an entry to be added to the changelog at the beginning of the file). We follow [semantic versioning](https://semver.org); From bdd7f06dd32eda0990293f34d2421794c4e1901d Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Tue, 5 Jul 2022 19:13:05 -0300 Subject: [PATCH 12/13] Add pokecrystal constants and finish off the constants that didn't make it into 4.7.0 --- hardware.inc | 122 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 88 insertions(+), 34 deletions(-) diff --git a/hardware.inc b/hardware.inc index fdf8108..3d05cfb 100644 --- a/hardware.inc +++ b/hardware.inc @@ -33,6 +33,7 @@ ;* Rev 4.5 - 03-Mar-22 : Added bit number definitions for OCPS, BCPS and LCDC (sukus) ;* Rev 4.6 - 15-Jun-22 : Added MBC3 registers and special values ;* Rev 4.7.0 - 27-Jun-22 : Added alternate names for some constants +;* Rev 4.8.0 - 05-Jul-22 : Added alternate names for more constants ; NOTE: REVISION NUMBER CHANGES MUST BE REFLECTED ; IN `rev_Check_hardware_inc` BELOW! @@ -51,7 +52,7 @@ DEF HARDWARE_INC EQU 1 ; rev_Check_hardware_inc 4.1 (equivalent to 4.1.0) ; rev_Check_hardware_inc 4 (equivalent to 4.0.0) MACRO rev_Check_hardware_inc - DEF CUR_VER equs "4,7,0" ; ** UPDATE THIS LINE WHEN CHANGING THE REVISION NUMBER ** + DEF CUR_VER equs "4,8,0" ; ** UPDATE THIS LINE WHEN CHANGING THE REVISION NUMBER ** DEF MIN_VER equs STRRPL("\1", ".", ",") DEF INTERNAL_CHK equs """MACRO ___internal IF \\1 != \\4 || \\2 < \\5 || (\\2 == \\5 && \\3 < \\6) @@ -162,18 +163,28 @@ DEF CART_RUMBLE_ON EQU 1 << 3 ; -- P1 ($FF00) ; -- Register for reading joy pad info. (R/W) ; -- -DEF rP1 EQU $FF00 +DEF rP1 EQU $FF00 +DEF rJOYP EQU rP1 -DEF P1F_5 EQU %00100000 ; P15 out port, set to 0 to get buttons -DEF P1F_4 EQU %00010000 ; P14 out port, set to 0 to get dpad -DEF P1F_3 EQU %00001000 ; P13 in port -DEF P1F_2 EQU %00000100 ; P12 in port -DEF P1F_1 EQU %00000010 ; P11 in port -DEF P1F_0 EQU %00000001 ; P10 in port +DEF P1F_5 EQU %00100000 ; P15 out port, set to 0 to get buttons +DEF P1F_4 EQU %00010000 ; P14 out port, set to 0 to get dpad +DEF P1F_3 EQU %00001000 ; P13 in port +DEF P1F_2 EQU %00000100 ; P12 in port +DEF P1F_1 EQU %00000010 ; P11 in port +DEF P1F_0 EQU %00000001 ; P10 in port +DEF JOYPF_5 EQU P1F_5 +DEF JOYPF_4 EQU P1F_4 +DEF JOYPF_3 EQU P1F_3 +DEF JOYPF_2 EQU P1F_2 +DEF JOYPF_1 EQU P1F_1 +DEF JOYPF_0 EQU P1F_0 -DEF P1F_GET_DPAD EQU P1F_5 -DEF P1F_GET_BTN EQU P1F_4 -DEF P1F_GET_NONE EQU P1F_4 | P1F_5 +DEF P1F_GET_DPAD EQU P1F_5 +DEF P1F_GET_BTN EQU P1F_4 +DEF P1F_GET_NONE EQU P1F_4 | P1F_5 +DEF JOYPF_GET_DPAD EQU P1F_GET_DPAD +DEF JOYPF_GET_BTN EQU P1F_GET_BTN +DEF JOYPF_GET_NONE EQU P1F_GET_NONE ; -- @@ -187,7 +198,10 @@ DEF rSB EQU $FF01 ; -- SC ($FF02) ; -- Serial I/O Control (R/W) ; -- -DEF rSC EQU $FF02 +DEF rSC EQU $FF02 +DEF rSC_ON EQU SCB_START +DEF rSC_CGB EQU SCB_SPEED +DEF rSC_CLOCK EQU SCB_SOURCE DEF SCF_START EQU %10000000 ; Transfer Start Flag (1=Transfer in progress, or requested) DEF SCF_SPEED EQU %00000010 ; Clock Speed (0=Normal, 1=Fast) ** CGB Mode Only ** @@ -222,7 +236,12 @@ DEF rTMA EQU $FF06 ; -- TAC ($FF07) ; -- Timer control (R/W) ; -- -DEF rTAC EQU $FF07 +DEF rTAC EQU $FF07 +DEF rTAC_ON EQU TACB_START +DEF rTAC_4096_HZ EQU TACF_4KHZ +DEF rTAC_16384_HZ EQU TACF_16KHZ +DEF rTAC_65536_HZ EQU TACF_65KHZ +DEF rTAC_262144_HZ EQU TACF_262KHZ DEF TACF_START EQU %00000100 DEF TACF_STOP EQU %00000000 @@ -520,7 +539,16 @@ DEF AUDENA_OFF EQU %00000000 ; sets all audio regs to 0! ; -- LCDC ($FF40) ; -- LCD Control (R/W) ; -- -DEF rLCDC EQU $FF40 +DEF rLCDC EQU $FF40 +DEF rLCDC_BG_PRIORITY EQU LCDCB_BGON +DEF rLCDC_SPRITES_ENABLE EQU LCDCB_OBJON +DEF rLCDC_SPRITE_SIZE EQU LCDCB_OBJ16 +DEF rLCDC_BG_TILEMAP EQU LCDCB_BG9C00 +DEF rLCDC_TILE_DATA EQU LCDCB_BG8000 +DEF rLCDC_WINDOW_ENABLE EQU LCDCB_WINON +DEF rLCDC_WINDOW_TILEMAP EQU LCDCB_WIN9C00 +DEF rLCDC_ENABLE EQU LCDCB_ON +DEF rLCDC_DEFAULT EQU LCDCB_DEFAULT DEF LCDCF_OFF EQU %00000000 ; LCD Control Operation DEF LCDCF_ON EQU %10000000 ; LCD Control Operation @@ -547,6 +575,7 @@ DEF LCDCB_BG9C00 EQU 3 ; BG Tile Map Display Select DEF LCDCB_OBJ16 EQU 2 ; OBJ Construction DEF LCDCB_OBJON EQU 1 ; OBJ Display DEF LCDCB_BGON EQU 0 ; BG Display +DEF LCDCB_DEFAULT EQU (1 << LCDCB_ON) | (1 << LCDCB_WIN9C00) | (1 << LCDCB_WINON) | (1 << LCDCB_OBJON) | (1 << LCDCB_BGON) ; "Window Character Data Select" follows BG @@ -738,13 +767,17 @@ DEF HDMA5F_BUSY EQU %10000000 ; 0=Busy (DMA still in progress), 1=Transfer compl ; -- Infrared Communications Port (R/W) ; -- CGB Mode Only ; -- -DEF rRP EQU $FF56 +DEF rRP EQU $FF56 +DEF rRP_LED_ON EQU RPB_LED_ON +DEF rRP_RECEIVING EQU RPB_DATAIN +DEF rRP_ENABLE_READ_MASK EQU RPF_ENREAD DEF RPF_ENREAD EQU %11000000 DEF RPF_DATAIN EQU %00000010 ; 0=Receiving IR Signal, 1=Normal DEF RPF_WRITE_HI EQU %00000001 DEF RPF_WRITE_LO EQU %00000000 +DEF RPB_LED_ON EQU 0 DEF RPB_DATAIN EQU 1 @@ -752,8 +785,9 @@ DEF RPB_DATAIN EQU 1 ; -- BCPS/BGPI ($FF68) ; -- Background Color Palette Specification (aka Background Palette Index) (R/W) ; -- -DEF rBCPS EQU $FF68 -DEF rBGPI EQU rBCPS +DEF rBCPS EQU $FF68 +DEF rBGPI EQU rBCPS +DEF rBGPI_AUTO_INCREMENT EQU BGPIB_AUTOINC DEF BCPSF_AUTOINC EQU %10000000 ; Auto Increment (0=Disabled, 1=Increment after Writing) DEF BCPSB_AUTOINC EQU 7 @@ -773,8 +807,9 @@ DEF rBGPD EQU rBCPD ; -- OCPS/OBPI ($FF6A) ; -- Object Color Palette Specification (aka Object Background Palette Index) (R/W) ; -- -DEF rOCPS EQU $FF6A -DEF rOBPI EQU rOCPS +DEF rOCPS EQU $FF6A +DEF rOBPI EQU rOCPS +DEF rOPBI_AUTO_INCREMENT EQU OBPIB_AUTOINC DEF OCPSF_AUTOINC EQU %10000000 ; Auto Increment (0=Disabled, 1=Increment after Writing) DEF OCPSB_AUTOINC EQU 7 @@ -826,17 +861,26 @@ DEF rPCM34 EQU $FF77 ; -- DEF rIE EQU $FFFF -DEF IEF_HILO EQU %00010000 ; Transition from High to Low of Pin number P10-P13 -DEF IEF_SERIAL EQU %00001000 ; Serial I/O transfer end -DEF IEF_TIMER EQU %00000100 ; Timer Overflow -DEF IEF_STAT EQU %00000010 ; STAT -DEF IEF_VBLANK EQU %00000001 ; V-Blank +DEF IEF_HILO EQU %00010000 ; Transition from High to Low of Pin number P10-P13 +DEF IEF_SERIAL EQU %00001000 ; Serial I/O transfer end +DEF IEF_TIMER EQU %00000100 ; Timer Overflow +DEF IEF_STAT EQU %00000010 ; STAT +DEF IEF_VBLANK EQU %00000001 ; V-Blank + +DEF IEB_HILO EQU 4 +DEF IEB_SERIAL EQU 3 +DEF IEB_TIMER EQU 2 +DEF IEB_STAT EQU 1 +DEF IEB_VBLANK EQU 0 +DEF IEB_DEFAULT EQU (1 << IEB_SERIAL) | (1 << IEB_TIMER) | (1 << IEB_STAT) | (1 << IEB_VBLANK) + +DEF JOYPAD EQU IEB_HILO +DEF SERIAL EQU IEB_SERIAL +DEF TIMER EQU IEB_TIMER +DEF LCD_STAT EQU IEB_STAT +DEF VBLANK EQU IEB_VBLANK +DEF IE_DEFAULT EQU IEB_DEFAULT -DEF IEB_HILO EQU 4 -DEF IEB_SERIAL EQU 3 -DEF IEB_TIMER EQU 2 -DEF IEB_STAT EQU 1 -DEF IEB_VBLANK EQU 0 ;*************************************************************************** @@ -1045,23 +1089,33 @@ DEF OAMF_PAL0 EQU %00000000 ; Palette number; 0,1 (DMG) DEF OAMF_PAL1 EQU %00010000 ; Palette number; 0,1 (DMG) DEF OAMF_BANK0 EQU %00000000 ; Bank number; 0,1 (GBC) DEF OAMF_BANK1 EQU %00001000 ; Bank number; 0,1 (GBC) +DEF PRIORITY EQU OAMF_PRI +DEF Y_FLIP EQU OAMF_YFLIP +DEF X_FLIP EQU OAMF_XFLIP +DEF OBP_NUM EQU OAMF_PAL1 +DEF VRAM_BANK_1 EQU OAMF_BANK1 DEF OAMF_PALMASK EQU %00000111 ; Palette (GBC) +DEF PALETTE_MASK EQU OAMF_PALMASK DEF OAMB_PRI EQU 7 ; Priority DEF OAMB_YFLIP EQU 6 ; Y flip DEF OAMB_XFLIP EQU 5 ; X flip DEF OAMB_PAL1 EQU 4 ; Palette number; 0,1 (DMG) DEF OAMB_BANK1 EQU 3 ; Bank number; 0,1 (GBC) +DEF OAM_PRIORITY EQU OAMB_PRI +DEF OAM_Y_FLIP EQU OAMB_YFLIP +DEF OAM_X_FLIP EQU OAMB_XFLIP +DEF OAM_OBP_NUM EQU OAMB_PAL1 +DEF OAM_TILE_BANK EQU OAMB_BANK1 ; Deprecated constants. Please avoid using. -DEF IEF_LCDC EQU %00000010 ; LCDC (see STAT) -DEF _VRAM8000 EQU _VRAM -DEF _VRAM8800 EQU _VRAM+$800 -DEF _VRAM9000 EQU _VRAM+$1000 +DEF IEF_LCDC EQU %00000010 ; LCDC (see STAT) +DEF _VRAM8000 EQU _VRAM +DEF _VRAM8800 EQU _VRAM+$800 +DEF _VRAM9000 EQU _VRAM+$1000 DEF CART_SRAM_2KB EQU 1 ; 1 incomplete bank - ENDC ;HARDWARE_INC From 865f8b218efd4037d7d372ecbf66114881380c9d Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Tue, 5 Jul 2022 20:25:37 -0300 Subject: [PATCH 13/13] Fix the rgbasm test --- hardware.inc | 76 +++++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 37 deletions(-) diff --git a/hardware.inc b/hardware.inc index 3d05cfb..203baa5 100644 --- a/hardware.inc +++ b/hardware.inc @@ -198,10 +198,7 @@ DEF rSB EQU $FF01 ; -- SC ($FF02) ; -- Serial I/O Control (R/W) ; -- -DEF rSC EQU $FF02 -DEF rSC_ON EQU SCB_START -DEF rSC_CGB EQU SCB_SPEED -DEF rSC_CLOCK EQU SCB_SOURCE +DEF rSC EQU $FF02 DEF SCF_START EQU %10000000 ; Transfer Start Flag (1=Transfer in progress, or requested) DEF SCF_SPEED EQU %00000010 ; Clock Speed (0=Normal, 1=Fast) ** CGB Mode Only ** @@ -210,6 +207,9 @@ DEF SCF_SOURCE EQU %00000001 ; Shift Clock (0=External Clock, 1=Internal Clock) DEF SCB_START EQU 7 DEF SCB_SPEED EQU 1 DEF SCB_SOURCE EQU 0 +DEF rSC_ON EQU SCB_START +DEF rSC_CGB EQU SCB_SPEED +DEF rSC_CLOCK EQU SCB_SOURCE ; -- ; -- DIV ($FF04) @@ -236,21 +236,21 @@ DEF rTMA EQU $FF06 ; -- TAC ($FF07) ; -- Timer control (R/W) ; -- -DEF rTAC EQU $FF07 -DEF rTAC_ON EQU TACB_START +DEF rTAC EQU $FF07 + +DEF TACF_START EQU %00000100 +DEF TACF_STOP EQU %00000000 +DEF TACF_4KHZ EQU %00000000 +DEF TACF_16KHZ EQU %00000011 +DEF TACF_65KHZ EQU %00000010 +DEF TACF_262KHZ EQU %00000001 DEF rTAC_4096_HZ EQU TACF_4KHZ DEF rTAC_16384_HZ EQU TACF_16KHZ DEF rTAC_65536_HZ EQU TACF_65KHZ DEF rTAC_262144_HZ EQU TACF_262KHZ -DEF TACF_START EQU %00000100 -DEF TACF_STOP EQU %00000000 -DEF TACF_4KHZ EQU %00000000 -DEF TACF_16KHZ EQU %00000011 -DEF TACF_65KHZ EQU %00000010 -DEF TACF_262KHZ EQU %00000001 - DEF TACB_START EQU 2 +DEF rTAC_ON EQU TACB_START ; -- @@ -539,16 +539,7 @@ DEF AUDENA_OFF EQU %00000000 ; sets all audio regs to 0! ; -- LCDC ($FF40) ; -- LCD Control (R/W) ; -- -DEF rLCDC EQU $FF40 -DEF rLCDC_BG_PRIORITY EQU LCDCB_BGON -DEF rLCDC_SPRITES_ENABLE EQU LCDCB_OBJON -DEF rLCDC_SPRITE_SIZE EQU LCDCB_OBJ16 -DEF rLCDC_BG_TILEMAP EQU LCDCB_BG9C00 -DEF rLCDC_TILE_DATA EQU LCDCB_BG8000 -DEF rLCDC_WINDOW_ENABLE EQU LCDCB_WINON -DEF rLCDC_WINDOW_TILEMAP EQU LCDCB_WIN9C00 -DEF rLCDC_ENABLE EQU LCDCB_ON -DEF rLCDC_DEFAULT EQU LCDCB_DEFAULT +DEF rLCDC EQU $FF40 DEF LCDCF_OFF EQU %00000000 ; LCD Control Operation DEF LCDCF_ON EQU %10000000 ; LCD Control Operation @@ -576,6 +567,16 @@ DEF LCDCB_OBJ16 EQU 2 ; OBJ Construction DEF LCDCB_OBJON EQU 1 ; OBJ Display DEF LCDCB_BGON EQU 0 ; BG Display DEF LCDCB_DEFAULT EQU (1 << LCDCB_ON) | (1 << LCDCB_WIN9C00) | (1 << LCDCB_WINON) | (1 << LCDCB_OBJON) | (1 << LCDCB_BGON) + +DEF rLCDC_BG_PRIORITY EQU LCDCB_BGON +DEF rLCDC_SPRITES_ENABLE EQU LCDCB_OBJON +DEF rLCDC_SPRITE_SIZE EQU LCDCB_OBJ16 +DEF rLCDC_BG_TILEMAP EQU LCDCB_BG9C00 +DEF rLCDC_TILE_DATA EQU LCDCB_BG8000 +DEF rLCDC_WINDOW_ENABLE EQU LCDCB_WINON +DEF rLCDC_WINDOW_TILEMAP EQU LCDCB_WIN9C00 +DEF rLCDC_ENABLE EQU LCDCB_ON +DEF rLCDC_DEFAULT EQU LCDCB_DEFAULT ; "Window Character Data Select" follows BG @@ -767,10 +768,7 @@ DEF HDMA5F_BUSY EQU %10000000 ; 0=Busy (DMA still in progress), 1=Transfer compl ; -- Infrared Communications Port (R/W) ; -- CGB Mode Only ; -- -DEF rRP EQU $FF56 -DEF rRP_LED_ON EQU RPB_LED_ON -DEF rRP_RECEIVING EQU RPB_DATAIN -DEF rRP_ENABLE_READ_MASK EQU RPF_ENREAD +DEF rRP EQU $FF56 DEF RPF_ENREAD EQU %11000000 DEF RPF_DATAIN EQU %00000010 ; 0=Receiving IR Signal, 1=Normal @@ -780,19 +778,23 @@ DEF RPF_WRITE_LO EQU %00000000 DEF RPB_LED_ON EQU 0 DEF RPB_DATAIN EQU 1 +DEF rRP_LED_ON EQU RPB_LED_ON +DEF rRP_RECEIVING EQU RPB_DATAIN +DEF rRP_ENABLE_READ_MASK EQU RPF_ENREAD + ; -- ; -- BCPS/BGPI ($FF68) ; -- Background Color Palette Specification (aka Background Palette Index) (R/W) ; -- -DEF rBCPS EQU $FF68 -DEF rBGPI EQU rBCPS -DEF rBGPI_AUTO_INCREMENT EQU BGPIB_AUTOINC +DEF rBCPS EQU $FF68 +DEF rBGPI EQU rBCPS -DEF BCPSF_AUTOINC EQU %10000000 ; Auto Increment (0=Disabled, 1=Increment after Writing) -DEF BCPSB_AUTOINC EQU 7 -DEF BGPIF_AUTOINC EQU BCPSF_AUTOINC -DEF BGPIB_AUTOINC EQU BCPSB_AUTOINC +DEF BCPSF_AUTOINC EQU %10000000 ; Auto Increment (0=Disabled, 1=Increment after Writing) +DEF BCPSB_AUTOINC EQU 7 +DEF BGPIF_AUTOINC EQU BCPSF_AUTOINC +DEF BGPIB_AUTOINC EQU BCPSB_AUTOINC +DEF rBGPI_AUTO_INCREMENT EQU BGPIB_AUTOINC ; -- @@ -807,14 +809,14 @@ DEF rBGPD EQU rBCPD ; -- OCPS/OBPI ($FF6A) ; -- Object Color Palette Specification (aka Object Background Palette Index) (R/W) ; -- -DEF rOCPS EQU $FF6A -DEF rOBPI EQU rOCPS -DEF rOPBI_AUTO_INCREMENT EQU OBPIB_AUTOINC +DEF rOCPS EQU $FF6A +DEF rOBPI EQU rOCPS DEF OCPSF_AUTOINC EQU %10000000 ; Auto Increment (0=Disabled, 1=Increment after Writing) DEF OCPSB_AUTOINC EQU 7 DEF OBPIF_AUTOINC EQU OCPSF_AUTOINC DEF OBPIB_AUTOINC EQU OCPSB_AUTOINC +DEF rOPBI_AUTO_INCREMENT EQU OBPIB_AUTOINC ; --