- 2
- Posts
- 338
- Days
- Seen Jun 24, 2024
TL;DR: the make command prints the error message "error: layout.link(38): Cannot decrease the current address (from $... to $...)" and I currently have zero understanding of this error.
I use the pokered-gbc as a base and try to incorporate some quality of life enhancements from other rom hacks. Some of these attempts lead to the make command returning an error that I do not understand. The latest example of this happened when I tried to port the HM-auto-use feature (use an HM simply by pressing Select, if applicable) from shin pokered. Here's what I tried:
1. I added the folder "custom_functions" to the root folder of the pokered-gbc disassembly, since that did not have it already.
2. I copied "func_overworld.asm" from shin pokered into that folder. I did not edit this file, except for removing the surf-board check when trying to use SURF, since my romhack does not have that item.
3. I INCLUDED the file in "main.asm". I deliberately put it into a bank where it would not fit at first and make complained that there was not enough space ("would overflow ROMX..."). I changed it to a different bank and that error disappeared, so I am quite confident that there is enough space in the bank.
4. I changed "OverworldLoopLessDelay::" in "overworld.asm" to use the new function: FROM
; if A is pressed
ld a, [wd730]
bit 2, a
jp nz, .noDirectionButtonsPressed
call IsPlayerCharacterBeingControlledByGame
jr nz, .checkForOpponent
call CheckForHiddenObjectOrBookshelfOrCardKeyDoor
...
TO
; if A or SELECT is pressed
.AorSelectPressed
ld a, [wd730]
bit 2, a ;check if input is being ignored
jp nz, .noDirectionButtonsPressed
call IsPlayerCharacterBeingControlledByGame
jr nz, .checkForOpponent
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;joenote - for smart HM use
ld a, [hJoyPressed]
bit 2, a ;is Select being pressed?
jr z, .notselect
callba CheckForSmartHMuse ;this function jumps back to OverworldLoop on completion
jp OverworldLoop
.notselect
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
call CheckForHiddenObjectOrBookshelfOrCardKeyDoor
...
When I now run the make command, I get "error: layout.link(38): Cannot decrease the current address (from $1671 to $1665) Linking failed with 1 error". The error disappears if I comment out the three lines before ".notselect" and reappears if I then uncomment any of those three.
My main problem is that I do not understand what exactly the error is. I know what an address is, and what decreasing it means, but I see neither what address is decreased here (well, $1671, but I mean from a semantic point of view), nor do I see why it has to happen or why it is impossible. I could not find any pointers to this error message on the internet. Can someone here explain what the problem is? I think if I got a rough understanding I could work on finding a solution from there.
Cheers
aloha
I use the pokered-gbc as a base and try to incorporate some quality of life enhancements from other rom hacks. Some of these attempts lead to the make command returning an error that I do not understand. The latest example of this happened when I tried to port the HM-auto-use feature (use an HM simply by pressing Select, if applicable) from shin pokered. Here's what I tried:
1. I added the folder "custom_functions" to the root folder of the pokered-gbc disassembly, since that did not have it already.
2. I copied "func_overworld.asm" from shin pokered into that folder. I did not edit this file, except for removing the surf-board check when trying to use SURF, since my romhack does not have that item.
3. I INCLUDED the file in "main.asm". I deliberately put it into a bank where it would not fit at first and make complained that there was not enough space ("would overflow ROMX..."). I changed it to a different bank and that error disappeared, so I am quite confident that there is enough space in the bank.
4. I changed "OverworldLoopLessDelay::" in "overworld.asm" to use the new function: FROM
; if A is pressed
ld a, [wd730]
bit 2, a
jp nz, .noDirectionButtonsPressed
call IsPlayerCharacterBeingControlledByGame
jr nz, .checkForOpponent
call CheckForHiddenObjectOrBookshelfOrCardKeyDoor
...
TO
; if A or SELECT is pressed
.AorSelectPressed
ld a, [wd730]
bit 2, a ;check if input is being ignored
jp nz, .noDirectionButtonsPressed
call IsPlayerCharacterBeingControlledByGame
jr nz, .checkForOpponent
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;joenote - for smart HM use
ld a, [hJoyPressed]
bit 2, a ;is Select being pressed?
jr z, .notselect
callba CheckForSmartHMuse ;this function jumps back to OverworldLoop on completion
jp OverworldLoop
.notselect
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
call CheckForHiddenObjectOrBookshelfOrCardKeyDoor
...
When I now run the make command, I get "error: layout.link(38): Cannot decrease the current address (from $1671 to $1665) Linking failed with 1 error". The error disappears if I comment out the three lines before ".notselect" and reappears if I then uncomment any of those three.
My main problem is that I do not understand what exactly the error is. I know what an address is, and what decreasing it means, but I see neither what address is decreased here (well, $1671, but I mean from a semantic point of view), nor do I see why it has to happen or why it is impossible. I could not find any pointers to this error message on the internet. Can someone here explain what the problem is? I think if I got a rough understanding I could work on finding a solution from there.
Cheers
aloha