Game ROMs that runs at 0000h

Page 2/3
1 | | 3

By NYYRIKKI

Enlighted (5736)

NYYRIKKI's picture

03-09-2006, 15:25

Do you mean that if I set a start address OUTSIDE the page where AB is
the bios will activate both pages ??

Yes, that is how I understand it works.

By NYYRIKKI

Enlighted (5736)

NYYRIKKI's picture

03-09-2006, 15:52

I suggest, that you take a look at the boot process. Try reading from 7D75#0-0 (At least that is the address in my tR)
For this purpose I suggest using Super-X so that you can follow the calls by using cursor keys. (To get it, telnet to HispaBBS)

By ARTRAG

Enlighted (6493)

ARTRAG's picture

03-09-2006, 18:03

I give up. Now I have the singature at 8000h and it seems to work.

The code I have at 8000h is:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    psect   boot,class=CODE


;   MSX ROM Header

    global  _start,testend,pagestart

    defb 'A','B'
    defw pagestart
    
pagestart:
    di
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; set pages and subslot

    in a,(0xA8)
    ld l,a
    and 0xC0
    ld b,a             ; which slot is for ram (page 3)?

    ld a,l
    and 0x30           ; which slot are we in (for page 2)?
    ld c,a

    rrca
    rrca
    or c
    rrca
    rrca
    or c
    or b

    ld e,a             ; page 0,1 & 2 are at the same primary slot of page 2
                       ; page 3 stay unchanged
    rlc c
    rlc c
    ld a,l
    and 0x3F
    or c
    out (0xA8),a       ; page 3 is set to the same primary slot that was of page 2

    ld a,(-1)
    cpl
    and 0x30           ; which sub slot are we in (for page 2)?
    ld c,a

    rrca
    rrca
    or c
    rrca
    rrca
    or c
    ld (-1),a          ; page 0,1 & 2 are at the same sub slot of page 2
                       ; page 3 has subslot 0, but who cares ?

    ld a,e
    out (0xA8),a       ; page 0,1 & 2 are at the same primary slot of page 2
                       ; page 3 is unchanged

testend:
    jp _start
;;;;;;;;;;;;;

It selects at page 0 & 1 the same slot and subslot found for page 2,
while leaving the page 3 with the same configuration found at the startup.
Does anyone have a shorter code that does the same thing ?

By aoineko

Master (129)

aoineko's picture

05-03-2021, 00:40

BiFi wrote:

it is... the system only checks for the AB signature @ $4000 and $8000 and because of the mirroring a game in page 0 is booted perfectly. For that mirroring thing to work correctly the AB signature should be on $0000 as well even though the system doesn't read that particular address.

I'm also trying to make a 48K cartridge that start at 0000h.
It's working when I have my ROM header at 4000h but not when it is at 0000h.
Because I'm using SDCC (and it's not handy to put data at a given address manually), I would like to have the ROM header at 0000h, my ISR at 0038h and the start of my code/const data after 0100h.
I'm not sure to understand Bifi answer.
This is sure that startup sequence don't check ROM header in page 0?
How mirroring is working here?

By aoineko

Master (129)

aoineko's picture

05-03-2021, 00:45

OK https://www.msx.org/wiki/Develop_a_program_in_cartridge_ROM make thing clearer.
But I'm pretty sure I read somewhere in a documentation that page 0 was also checked...
Maybe I dreamed...

By lintweaker

Champion (368)

lintweaker's picture

05-03-2021, 08:32

aoineko wrote:

OK https://www.msx.org/wiki/Develop_a_program_in_cartridge_ROM make thing clearer.
But I'm pretty sure I read somewhere in a documentation that page 0 was also checked...
Maybe I dreamed...

MSX only checks pages 1 (4000-7fffh) and 2 (8000-bfffh) for ROM signatures ('AB') going through all the slots at startup/reset.
MSX2 and up does search for a 'CD' header for extended BIOS ROM at 0000h. But that is not meant for cartridges.

So basically your cartridge has to start in page 1 or 2 but after that you can enable other pages if needed.

By gdx

Enlighted (4204)

gdx's picture

05-03-2021, 11:10

lintweaker wrote:

MSX2 and up does search for a 'CD' header for extended BIOS ROM at 0000h.

Only the MSX2 and 2+ search for a 'CD' header and execute it at 0002h to initialise MSX a part of the MSX and display the logo. So we can display our own logo or do something else before the MSX logo but it will not work on Turbo R (nor on MSX1 of course).

lintweaker wrote:

So basically your cartridge has to start in page 1 or 2 but after that you can enable other pages if needed.

MSX only checks pages 1 and 2 but cartridges can start from any page.

By lintweaker

Champion (368)

lintweaker's picture

05-03-2021, 11:17

gdx wrote:

MSX only checks pages 1 and 2 but cartridges can start from any page.

How? MSX only looks in pages 1 and 2 and will only enable the ROM there and jumps to the routine pointed as start address. If that address points to a address in page 0 or 3 it will probably happily jump to it but your rom will not be there.

By gdx

Enlighted (4204)

gdx's picture

05-03-2021, 11:25

For example, if you set 41 42 00 30 in the header of a ROM of 48K at 4000h the ROM will start at 3000h.

By lintweaker

Champion (368)

lintweaker's picture

05-03-2021, 12:11

gdx wrote:

For example, if you set 41 42 00 30 in the header of a ROM of 48K at 4000h the ROM will start at 3000h.

That is what I mentioned. I am sure the MSX will not enable your rom at page 0 as there is the BIOS itself.

Page 2/3
1 | | 3