Jump to content
IGNORED

Pass bB constants to assembly?


Gemintronic

Recommended Posts

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?
post-13304-0-58693900-1545346662_thumb.jpg
  • Like 3
Link to comment
Share on other sites

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".

  • Like 1
Link to comment
Share on other sites

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!! ^_^

  • Like 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...