+Gemintronic Posted December 20, 2018 Share Posted December 20, 2018 So, I'm trying to save variables yet again. I'm thinking that a status bar color will never change during the game and want to use a constant. How would I declare a constant in bB and have it referenced in the assembly code of a mini kernel? For instance, I changed the color of the status bar to yellow (#$2F) in 6lives_statusbar.asm ifconst statusbarcolor ; only write COLUPF if color variable exists, otherwise use existing PF color lda #$2E sta COLUPF endif How would I declare a constant in bB const _mystatusbarcolor = $2E and have that replace the lda #$2E in the code? 3 Quote Link to comment Share on other sites More sharing options...
RevEng Posted December 20, 2018 Share Posted December 20, 2018 The "#$2E" in the original ASM isn't a memory location, it's a literal constant value. So no memory would be saved by substituting your bB constant for the #$2E. If you want it just for convenience, then you can just put "lda #_mystatusbarcolor" in the asm code, instead of "lda #$2E". 1 Quote Link to comment Share on other sites More sharing options...
+Gemintronic Posted December 20, 2018 Author Share Posted December 20, 2018 The "#$2E" in the original ASM isn't a memory location, it's a literal constant value. So no memory would be saved by substituting your bB constant for the #$2E. If you want it just for convenience, then you can just put "lda #_mystatusbarcolor" in the asm code, instead of "lda #$2E". Holy cow that's amazing!! Thank you for the tip!! ^_^ 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.