+Karl G Posted September 1, 2018 Share Posted September 1, 2018 I wasn't able to find anything in the docs, or discussion in the forum, but is there a way to do conditional compilation in bB? Something that is equivalent of "ifconst" in asm? Quote Link to comment Share on other sites More sharing options...
RevEng Posted September 1, 2018 Share Posted September 1, 2018 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. 1 Quote Link to comment Share on other sites More sharing options...
+Karl G Posted September 1, 2018 Author Share Posted September 1, 2018 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. Quote Link to comment Share on other sites More sharing options...
RevEng Posted September 2, 2018 Share Posted September 2, 2018 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. Quote Link to comment Share on other sites More sharing options...
Lillapojkenpåön Posted April 22, 2020 Share Posted April 22, 2020 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 Quote Link to comment Share on other sites More sharing options...
+Karl G Posted April 22, 2020 Author Share Posted April 22, 2020 Get rid of the C-style double equal sign operator, and see if that works. Quote Link to comment Share on other sites More sharing options...
Lillapojkenpåön Posted April 22, 2020 Share Posted April 22, 2020 Unfortunately not ☹️ Quote Link to comment Share on other sites More sharing options...
+Karl G Posted April 22, 2020 Author Share Posted April 22, 2020 To be clear, a single equal sign instead of two, not none at all. Quote Link to comment Share on other sites More sharing options...
Lillapojkenpåön Posted April 22, 2020 Share Posted April 22, 2020 I got that but didn't make a difference, same errors Quote Link to comment Share on other sites More sharing options...
+Karl G Posted April 22, 2020 Author Share Posted April 22, 2020 If you post the whole source or send it to me, I can take a look at it tomorrow. Quote Link to comment Share on other sites More sharing options...
Lillapojkenpåön Posted April 22, 2020 Share Posted April 22, 2020 Thanks! I sent it. Quote Link to comment Share on other sites More sharing options...
RevEng Posted April 22, 2020 Share Posted April 22, 2020 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) 1 1 Quote Link to comment Share on other sites More sharing options...
Lillapojkenpåön Posted April 22, 2020 Share Posted April 22, 2020 I did think that it was because the bB code was compiled first and ignored the conditionals, but I didn't know you had to reference an assembly constant like that, thanks! that worked like a charm. 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.