PacManPlus Posted March 29, 2020 Share Posted March 29, 2020 (edited) I am using bank switching in my PMC_XM game, but I'd really like to put code in some of the banks (right now I'm using it for tables, graphics, and data only). The only issue I see is addressing. I am compiling the main program (fixed at $C000-$FFFF) separately from the banks (7 banks switchable from $8000-$BFFF). However the banks are listed from $0000-$1BFFF to compile (like I did for Bentley Bear). I am assuming when I compile them, any direct jumps (JMP, JSR) are going to use the $0000-$1BFFF addresses and not the $8000-$BFFF for each bank (as it doesn't know about them). Is there a way to either: a) Force DASM to compile the banks as repeating $8000-$BFFF blocks, or b) Combine the source code for the main program and 'DataBanks' (BTW, excellent unreleased Prince song of the same name), compile them together and tell DASM to use $8000-$BFFF for each bank before $C000-$FFFF? Thanks, guys Bob Edited March 29, 2020 by PacManPlus Quote Link to comment Share on other sites More sharing options...
TailChao Posted March 29, 2020 Share Posted March 29, 2020 Option a) is a little easier, for each bank you can do something like this... SEG OBJ_STAGE_F ORG ADDR_OC_STGF,EMPTY_FILL RORG BANK_SWAP ;------------------------------------------------------------------------------- BANK_THIS SET BANK_OC_STGF INCDIR "./SUB/OBJ_Over" INCLUDE "ANI_OverMis.asm" INCLUDE "OBJ_OverMis.asm" INCDIR "./SUB/RBX" INCLUDE "ANI_Fiddler.asm" INCLUDE "OBJ_Fiddler.asm" INCDIR "./SUB/RMX" INCLUDE "ANI_Launcher.asm" INCLUDE "OBJ_Launcher.asm" INCLUDE "ANI_Pipe.asm" INCLUDE "OBJ_Pipe.asm" INCLUDE "ANI_Laser.asm" INCLUDE "OBJ_Laser.asm" INCLUDE "ANI_Sentry.asm" INCLUDE "OBJ_Sentry.asm" INCLUDE "ANI_FoxBot.asm" INCLUDE "OBJ_FoxBot.asm" INCDIR "./SUB/OBJ_Glue" INCLUDE "ANI_GoodEnd.asm" INCLUDE "OBJ_GoodEnd.asm" BANK_USED SET (* - BANK_SWAP) ROM_USED SET (ROM_USED + BANK_USED) ECHO "[OC] OBJ_STAGE_F :",BANK_USED,(BANK_SIZE - BANK_USED) REND Where BANK_SWAP = $8000 (start of bank from Sally's view), ADDR_[NAME] is the start of the bank in ROM, and BANK_[NAME] is the bank number. The value of BANK_THIS is changed at the start of each bank definition so that any object code will use this instead of a fixed bank number. This makes it easier to "defragment" objects later on. 4 Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted March 29, 2020 Share Posted March 29, 2020 FYI - since dasm is used for development for a number of systems we've started club dasm as a central place for dasm Q & A. 3 Quote Link to comment Share on other sites More sharing options...
PacManPlus Posted March 29, 2020 Author Share Posted March 29, 2020 Thanks guys! I'll give that a shot... and Darrell, I joined 'club dasm'. Thank you for alerting me to that. 2 Quote Link to comment Share on other sites More sharing options...
+Pat Brady Posted July 22, 2020 Share Posted July 22, 2020 Bump! Thanks for the tip, TailChao. If I need to put certain things at specific addresses within a bank, must I use both ORG and RORG every time? That is unwieldy. I could use ALIGN, but then dasm won’t detect overflows, so I’d want to add macros to do that, which is getting back to unwieldy. And out of curiosity, does anybody else think of RORG addresses as virtual and ORG addresses as physical? Or is there some other terminology people use here? Quote Link to comment Share on other sites More sharing options...
TailChao Posted July 23, 2020 Share Posted July 23, 2020 On 7/21/2020 at 10:24 PM, bizarrostormy said: If I need to put certain things at specific addresses within a bank, must I use both ORG and RORG every time? That is unwieldy. I could use ALIGN, but then dasm won’t detect overflows, so I’d want to add macros to do that, which is getting back to unwieldy. If you're creating labels to access this data, then yes - ORG and RORG or ALIGN it. Don't forget you can do math in the ORG and RORG directives to make this a little cleaner, something like ORG (ADDR_CD_STG2 + SS_A). On 7/21/2020 at 10:24 PM, bizarrostormy said: And out of curiosity, does anybody else think of RORG addresses as virtual and ORG addresses as physical? Or is there some other terminology people use here? Yeah, RORG is creating the logical addresses for your resources and ORG is generating the physical addresses in ROM (or other storage). 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.