Jump to content
IGNORED

Conditional compilation?


Karl G

Recommended Posts

Thanks! Is there any chance of this or some of your 7800basic enhancements getting backported to bB eventually? I'm also thinking of your TIA sound driver.

 

 

Nope, but you can break out to assembly and do it yourself...

 asm
 ifconst OFFICIAL_RELEASE
end
 rem some conditional code here
 asm
 endif
end
I added "#ifconst" "#else" and "#endif" to 7800basic. Nice to be able to skip the "asm" wrappers.

 

Link to comment
Share on other sites

The #ifconst, #else, #endif would be easy enough, so I may do that when I next have my hands in it. I've back ported bug-fixes as I've run across them.

 

I'm not really sure there's a lot more in 7800basic that would be useful in bB; the trade-offs for a machine with 4k address space and 128 bytes of RAM are fairly different than one with 64k address space and 4k of RAM.

 

The TIA SFX driver in particular doesn't pack the sound data into ROM as efficiently as it might, in part because the format is extendable to pokey.

Link to comment
Share on other sites

  • 1 year later...

Why can't I get this to work, I get a bunch of errors with 2600basic_variable_redefs.h

This compiles but doesn't work as it should

 

 asm

PFRESOLUTION = 22

end



 asm

 if PFRESOLUTION == 22

distance = 132 ;66 for two bytes, 132 for four bytes etc.

bytesInColumn = 4

increments = 2

padding = 1 ; 1 or 0



 endif

end



 asm

 if PFRESOLUTION == 11

distance = 66 ;66 for two bytes, 132 for four bytes etc.

bytesInColumn = 2

increments = 1

padding = 0 ; 1 or 0



 endif

end

and this compiles and work correctly

 asm

PFRESOLUTION = 22

end



 asm

 if PFRESOLUTION == 22

end

 const distance = 132 ;66 for two bytes, 132 for four bytes etc.

 const bytesInColumn = 4

 const increments = 2

 const padding = 1 ; 1 or 0

 asm

 endif

end

but if I add more conditions like that I get a bunch of old value new value/value mismatch errors

 asm

 if PFRESOLUTION == 22

end

 const distance = 132 ;66 for two bytes, 132 for four bytes etc.

 const bytesInColumn = 4

 const increments = 2

 const padding = 1 ; 1 or 0

 asm

 endif

end



 asm

 if PFRESOLUTION == 11

end

 const distance = 66 ;66 for two bytes, 132 for four bytes etc.

 const bytesInColumn = 2

 const increments = 1

 const padding = 0 ; 1 or 0

 asm

 endif

end

 

Link to comment
Share on other sites

It's the bB const statements. The bB compiler operates at a higher level than assembly, so it doesn't know about your asm conditionals. It processes both sets of constants in the different blocks, and then it sticks those contradictory definitions into 2600basic_variable_redefs.h.

 

Solution 1 - don't use differing constants in each block.

Solution 2 - use assembly constants. If you need to reference the constants in bB commands, then you need to tell bB they're constants with a self-referencing constant definition, like "const bytesInColumn=bytesInColumn"

 

I honestly didn't consider this before, but it's a wider problem for any command that saves intermediate state in the compiler - like "set". I'll need to add some warnings into the 7800basic manual. (these aren't official bB commands, no updates are needed for bB docs)

  • Like 1
  • Thanks 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...