Jump to content
IGNORED

DASM question about ORG/RORG


PacManPlus

Recommended Posts

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 by PacManPlus
Link to comment
Share on other sites

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.

  • Like 4
Link to comment
Share on other sites

  • 3 months later...

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?

Link to comment
Share on other sites

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

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