Sega Master System / Mark III / Game Gear|
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew
[SOLVED] WLA DX calculating same memory addresses for different variables.Posted: Mon Nov 04, 2019 12:24 am
Last edited by SavagePencil on Mon Nov 04, 2019 4:51 pm; edited 3 times in total
UPDATE. WLA DX will not advance the memory address in a struct, union, or enum if the variable is declared with a dot before the size type. Per the documentation:
.ENUM $C000 DESC EXPORT
...will alias the bigapple and bigapple_h to the same address, with bigapple_l to one byte lower.
Thanks Colindro for pointing this out.
I'm having an issue where WLA DX (9.10a) is generating incorrect memory addresses and I want to make sure I'm not doing anything incorrect.
Here is the issue I am seeing in the assembly and .SYM file:
Note that multiple objects are sharing 0xC048. This is incorrect. Here are the structs that are defining this:
; FSM governing the screen's state transitions.
ScreenFSM INSTANCEOF FSM
; Module used to ensure the player releases buttons before we accept input from them.
Controller1DebounceModule INSTANCEOF DebounceModule_Instance
; Independent variables unique to each state.
TimingCounter DB ; Current counter value
CharsRemaining DB ; How many characters are left?
BlinkTimer DB ; How long before we blink?
IsOn DB ; Are we currently displayed, or no?
ButtonReleased DB ; Have we seen a button released yet?
The debounce module, which seems to be at the heart of the problem, is defined here:
; The parameters that drive debounce logic. Can be in ROM or RAM.
DesiredVal .DB ; What value are we looking for to know when we're done?
Mask .DB ; Current val is AND'd against this
; Maintains the state of a debounce module. Must be in RAM.
DebounceFSM INSTANCEOF FSM
DebounceParams .DW ; Pointer to parameters
CurrentVal .DB ; Current value to be tested against
Where it's most unsettling is right here:
DebounceParams is a .DW, and should take up C048 and C049, with CurrentVal taking up C04A. However, this isn't the case, as everyone is taking up C048.
I thought at first it might be an issue with the UNION, but even after removing it, I'm still seeing the same issue.
Here is how the TitleScreen struct is instantiated:
.RAMSECTION "Mode - Title Screen Context" SLOT 3
gModeTitleScreen INSTANCEOF TitleScreen
||Posted: Mon Nov 04, 2019 5:23 am|
It's because of the dot you put before the sizes (e.g. .db). It tells WLA to not increase the address counter.
||Posted: Mon Nov 04, 2019 5:33 am|
holy Christmas how did I miss that
||Posted: Mon Nov 04, 2019 5:53 am|
The forum tells me it's your birthday today. In case it's correct: Happy Birthday! :)
||Posted: Mon Nov 04, 2019 2:04 pm|
|Well yours is the best gift I’ve gotten so far!|