Jump to content
IGNORED

Compile 4k+4k


Cisano

Recommended Posts

Hi. My game needs 8k.

I use Visual Studio.

Bank 0

    org  $1000
    rorg $1000
;code
    org  $1FFA
    rorg $FFFA

Bank 1

    org  $2000
    rorg $1000
;code
    org  $2FFA
    rorg $FFFA

I know how to swtch the banks, thank to 8bitworkshop.

My question.

The code must be in the same file? Because I have "Failed to create compiled file" error. No other help about the reason.

Thanks.

Link to comment
Share on other sites

It might just be a typo, but org (binary file origin) should start counting from $0000, not $1000.  Also rorg (relocated "code" origin) should be within a 4k region ($1000 .. $1FFF, or $F000..$FFFA) for the start and end of each of your banks. Fixed in the following:

 

Bank 0

    org  $0000
    rorg $1000
;code
    org  $0FFA
    rorg $1FFA

Bank 1

    org  $1000
    rorg $1000
;code
    org  $1FFA
    rorg $1FFA
  • Like 1
Link to comment
Share on other sites

I just tried this and it worked:

 

;------------------------------------
;---- 8k DASM example

    processor 6502

;-----------
;-- Bank 0
    org  $0000
    rorg $1000

    
    lda $1ff8
boot:
    ;put code here

    
    org  $0FFA
    rorg $1FFA

    word 0
    word boot
    word boot

;-----------
;-- Bank 1
    org  $1000
    rorg $1000
    
    
goto_boot:
    lda $1ff8   ;-- switch back to bank 0 and continue execution at "boot"

    ;put code here
    
    org  $1FFA
    rorg $1FFA

    word 0
    word goto_boot
    word goto_boot

 

  • Like 1
Link to comment
Share on other sites

One last thing. From 8bitworkshop:

MAC BANK_SWITCH
.Bank	SET {1}
.Addr	SET {2}
lda #>(.Addr-1)
ldy #<(.Addr-1)
ldx #.Bank
jmp BankSwitch
ENDM

Having 2 label with the same name in the 2 banks "BankSwitch", I get "Label mismatch" error.

How to fix it?

 

You use:

lda $1ff8

Is it enough to use lda instruction for the switch?

Thanks for every info.

Link to comment
Share on other sites

Yes, reading/writing to 1FF8 (for bank 0) or 1FF9 (for bank 1) will switch banks in the 8k/F8 bank-switching scheme.  But, you need to be careful because the bank-switching happens immediately.

 

The code in 8bitworkshop is quite complex.  I don't really have any experience with using techniques like that.   In PaintTheCity, I use a much simpler technique which involves defining a jump table at the beginning of each bank.  (ChaoticGrill also uses a similar jump-table technique)

 

Here is an example of the jump-table bank-switching technique.  This example shows a layout where Display code and Graphics data would be located in bank 0, and game logic would be located in bank 1.

 

F8_banking_example.asm

  • Like 2
Link to comment
Share on other sites

I've taken the decision to use the code in F8 banking example.

It works and from Bank1 pressing the fire button it goes in the Bank0 and the game starts.

I have this problem now. The Bank0 has free memory.

 

If I write some instuctions (it doesn't matter which) I get, just started, "invalid instruction" by Stella.

If I delete one and check, one and check, etc ... it begins to work again.

The funny thing is, that code is not executed.

Thanks for every info.

 

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