How to do a MegaROM?

Page 2/5
1 | | 3 | 4 | 5

By thegeps

Master (255)

thegeps's picture

06-09-2019, 23:53

Grauw, as you know I use your Glassa ti assemblee my code. Actually my ROM Is 32K. Both banks end with "ds -$ & 3FFFH ". No ORG address at the begin of second bank. I'd like to have all the code in the first bank and all the data banks switching in the second 16K bank (8000h). I need RAM Fe C000h (unpacking tilemap, all game's variabile, RAM SAT etc.). So? I have to end second bank with "ds -$ & 3FFFH " and then writer ORG 8000h at the begin of next bank and so on?

By Grauw

Ascended (8388)

Grauw's picture

07-09-2019, 00:37

Yes, that’s the standard assembly way.

If you include the macros.asm file from the examples folder you can also use ALIGN 4000H instead of ds -$ & 3FFFH.

With Glass you can also use DS and SECTION to define target memory blocks as follows:

ROM_BANK0: ds 4000H
ROM_BANK1: ds 4000H
ROM_BANK2: ds 4000H
ROM_BANK3: ds 4000H

    SECTION ROM_BANK0
    org 4000H
    ; code & data for bank 0 here, include etc.
    ENDS

    SECTION ROM_BANK1
    org 8000H
    ; code & data for bank 1 here, include etc.
    ENDS

    SECTION ROM_BANK2
    org 8000H
    ; code & data for bank 2 here, include etc.
    ENDS

Whatever is inside the SECTION blocks will be moved into the DS buffers. The advantage there is that it can become a bit easier to group your code, but then again there also isn’t much wrong with the traditional way I described before. See also the documentation in the readme.

For the RAM I typically have the initial values also stored in ROM, and then copy it to C000H at start-up.

By thegeps

Master (255)

thegeps's picture

07-09-2019, 01:16

Grauw wrote:

For the RAM I typically have the initial values also stored in ROM, and then copy it to C000H at start-up.

I do the same, I was explaining how is organized my project just to know if It were possible ti do a megarom with these specifications (4000h-7fffh bank0/code, 8000h-bfffh bank1/data- bank n/data, c000h-ffffh RAM for game tilemap, game and system variables, int hook etc etc Smile

By gdx

Prophet (2979)

gdx's picture

07-09-2019, 10:40

A method that works with zasm (but I never tested):

; Example to create an MegaRom of 128kB that use an ASCII 16K Mapper


#target rom
#code	Seg0,04000h,04000h

	db	41h,42h
	dw	START_ADRS,0,0,0,0,0,0

START_ADRS:
	; code & data (include, incbin, etc) for Segmemt 0 here.

#code	Seg1,08000h,04000h

Seg1:
	; code & data (include, incbin, etc) for Segmemt 1 here.

#code   Seg2,08000h,04000h

Seg2:
	; code & data (include, incbin, etc) for Segmemt 2 here.

#code   Seg3,08000h,04000h

Seg3:
	; code & data (include, incbin, etc) for Segmemt 3 here.

#code   Seg4,08000h,04000h

Seg4:
	; code & data (include, incbin, etc) for Segmemt 4 here.

#code   Seg5,08000h,04000h

Seg5:
	; code & data (include, incbin, etc) for Segmemt 5 here.

#code   Seg6,08000h,04000h

Seg6:
	; code & data (include, incbin, etc) for Segmemt 6 here.

#code   Seg7,08000h,04000h

Seg7:
	; code & data (include, incbin, etc) for Segmemt 7 here.

END

By thegeps

Master (255)

thegeps's picture

09-09-2019, 15:47

Well, this evening I'll have some time to fix the bug that make half of midlevel boss disappear (I know for sure it's related to
Early Clock Bit) and then I'll try to make a megarom... Fingers crossed

By gdx

Prophet (2979)

gdx's picture

14-09-2019, 12:35

Grauw, can you check the example for Glass assembler please?
https://www.msx.org/wiki/Develop_a_program_in_cartridge_ROM

By Thom

Hero (576)

Thom's picture

14-09-2019, 12:45

Amazing work, gdx.

By gdx

Prophet (2979)

gdx's picture

14-09-2019, 12:59

Thanks. There are still many things to add. People will probably run away when they will open this page. Big smile

By thegeps

Master (255)

thegeps's picture

17-09-2019, 01:15

I'm experimenting but I have some issues. I think it's my fault, of course, and now I have a doubt (probably the solution to my issues). First, issue description:
bank_sw: equ 7000h
Ld a,1
Ld (bank_sw),a
Code code code and data from bank1 (8000h)
All works fine.

Then, when triggered condition:
Ld a,2
Ld (bank_sw),a
Glitches and I'm sure it's loading data from bank1, because I have:

Bank1 at 8000h
Tileset definitions label
Data of tileset
Scoreboard data for first game setup label:
Data of scoreboard
Level1map label
Data of level1 map

Bank2 at 8000h
Tileset definitions label
Data of tileset
Level2map label
Data of level2 map

Well, as you see level2map label has the same address that scoreboard data has. Infact when starting level2 the map starts with scoreboard data on screen (scrolling down with other graphics).

Now my thought: have I to define all segment for a megarom? I ask this cause actually I have a 48k ROM (just copied first 8000h bank and deleted unused data, so I may be able to test the code). Can be this the cause of my mistake? I can't check right now but the boubt will keep me awake...

By Manuel

Ascended (15691)

Manuel's picture

17-09-2019, 07:38

How are you running this code?

Page 2/5
1 | | 3 | 4 | 5