Skip to content

Commit

Permalink
Correct pre-computed branch - fixes zero bug
Browse files Browse the repository at this point in the history
Thanks 0xCrafty on the PK Hack Discord for discovering and helping
troubleshoot this bug!
  • Loading branch information
charasyn committed Jul 15, 2021
1 parent e4abdc2 commit d665588
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Some examples of custom control codes can be seen in the `example/` directory:
## Thanks
- jtolmar for providing a WIP which this was based on
- phoenixbound and Catador for their support during development
- 0xCrafty for bugtesting
- All of the randomizer developers for inspiring me to get involved with PK Hacking
- Everyone else on the PK Hack Discord for being awesome
- The [EarthBound ROM Explorer](https://earthbound-rom-explorerr.herokuapp.com/)
Expand Down
11 changes: 9 additions & 2 deletions ccexpand.ccs
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import asm65816

// Additional CCScript codes v0.2 - Single file version
// CCExpand v0.3 - Additional CCScript codes
// Initial version by jtolmar
// Rework and additional support functions by cooprocks123e
// With thanks to Phoenixbound, Catador and Herringway
// Changelog:
// 0.3 - Correct bug with R_Read_Parameter_Bytes
// The parameter space was not properly zero'ed out, leading to issues with
// M_Read_Bytes_or_Arg not returning the argument when the value was 0.
// Thanks to 0xCrafty for discovering and helping troubleshoot this bug!
// 0.2 - Combine separate "library" and "implementation" files into single file
// 0.1 - Initial version!

// Many CCScript commands are "trees" that branch into more commands based on the
// next byte. Of these, 1A and 1B have very few commands and lots of space to
Expand Down Expand Up @@ -349,7 +356,7 @@ R_Read_Parameter_Bytes: M_EB_Function_Wrapper_UserStack(-0x12, {
TYA
LSR // Get lower order bit in carry, and branch if 0
LDA_i(0x0000)
BCC(13) // aligned
BCC(14) // aligned
// Align Y to next word
SEP(0x20)
STA_y(D_cc_argv)
Expand Down
11 changes: 9 additions & 2 deletions example/ccexpand.ccs
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import asm65816

// Additional CCScript codes v0.2 - Single file version
// CCExpand v0.3 - Additional CCScript codes
// Initial version by jtolmar
// Rework and additional support functions by cooprocks123e
// With thanks to Phoenixbound, Catador and Herringway
// Changelog:
// 0.3 - Correct bug with R_Read_Parameter_Bytes
// The parameter space was not properly zero'ed out, leading to issues with
// M_Read_Bytes_or_Arg not returning the argument when the value was 0.
// Thanks to 0xCrafty for discovering and helping troubleshoot this bug!
// 0.2 - Combine separate "library" and "implementation" files into single file
// 0.1 - Initial version!

// Many CCScript commands are "trees" that branch into more commands based on the
// next byte. Of these, 1A and 1B have very few commands and lots of space to
Expand Down Expand Up @@ -349,7 +356,7 @@ R_Read_Parameter_Bytes: M_EB_Function_Wrapper_UserStack(-0x12, {
TYA
LSR // Get lower order bit in carry, and branch if 0
LDA_i(0x0000)
BCC(13) // aligned
BCC(14) // aligned
// Align Y to next word
SEP(0x20)
STA_y(D_cc_argv)
Expand Down

0 comments on commit d665588

Please sign in to comment.