informedcitizenry / 6502.Net

A .Net-based Cross-Assembler for Several 8-Bit Microprocessors
MIT License
58 stars 17 forks source link

Suggestion: user controlled bank size. #7

Closed JettMonstersGoBoom closed 3 years ago

JettMonstersGoBoom commented 3 years ago

Currently the .bank command is 64kb. for the NES for example this would be more useful at 8,16,or 32kb. I considered using .dsection but the end address can't be $10000 or higher which means I can't use that approach.

informedcitizenry commented 3 years ago

The .bank directive is currently only available for 65816 assembly to support long addressing (>64Kb). If we had a way to do what you are asking, do you have sample code demonstrating how it might be used?

JettMonstersGoBoom commented 3 years ago

for example i'd suggest only allowing one size specification like .banksize=$4000 .bank 0 .relocate $8000 some code set second code bank to 2 ( depends on hardware ) NES for example has two pagable rom banks for code individually selectable. .endbank .bank 1 .relocate $c000 more code .endbank .bank 2 .relocate $c000 more code .endbank .bank 3 .relocate $c000 more code .endbank .bank 4 .binclude "chars.chr" .endbank .bank 5 .binclude "sprites.chr" .endbank

expected result is a file $18000 bytes

informedcitizenry commented 3 years ago

Okay thanks. Yes, currently the output buffer is static 64KiB byte array, so this would require a rework, which I have been thinking about anyway, since an 65816 can conceivably support 16MiB program. I'll mark this as an enhancement to track and hopefully can include this in a couple releases.

informedcitizenry commented 3 years ago

The latest release should address what you are wanting to do (if I understand correctly the intent). You will need to pass the --long-addressing option. The sample code you wrote above would be like this:

        * = $8000

bank0     lda #$00
        tax
        jsr $c000
        // more code
        .fill $4000 - (* - bank0)

bank1      nop
        // more code
        .fill $4000 - (* - bank1), 0

bank2      nop
        // more code
        .fill $4000 - (* - bank2), 0

bank3      nop
        // more code
        .fill $4000 - (* - bank3), 0

               // etc....
JettMonstersGoBoom commented 3 years ago

works for me . thanks