MSX1 pages and slots

صفحة 3/7
1 | 2 | | 4 | 5 | 6 | 7

بواسطة zeilemaker54

Champion (315)

صورة zeilemaker54

21-07-2006, 17:12

Can you still have the signature at $4000 or $8000 but have the init address point to somewhere in page 0? Or must program execution start on the same page as the signature?

Well, the init address is read from 4002 or from 8002, and then the init routine is started with a CALSLT bios call. So this means that you can use an address in any page. using page 3 is not very wise, because then the systemvariables are switched away, and a crash is the result. page 0 should work ok, but take care there because the BIOS is switched away and you have to take care of interrupts and other stuff.

بواسطة tokumaru

Expert (83)

صورة tokumaru

21-07-2006, 19:19

Well, the init address is read from 4002 or from 8002, and then the init routine is started with a CALSLT bios call.
OK, it uses that magic routine! I get it!

using page 3 is not very wise, because then the systemvariables are switched away, and a crash is the result.the BIOS is switched away and you have to take care of interrupts and other stuff.
But that's exactly the point. If the BIOS is switched away (meaning I have my own interrupt routine, or don't use one at all, whatever) there is no problem in switching the system variables away, isn't that correct? Anyway, I think I could still use ROM in page 3 momentarily as long as interrupts were disabled, and RAM was switched back in before enabling them again. But that's not the point, the point is whether ROM can or can not be maped to page 3, regardless of how carefull the programmer must be about that. Smile

بواسطة NYYRIKKI

Enlighted (5889)

صورة NYYRIKKI

21-07-2006, 20:11

But that's not the point, the point is whether ROM can or can not be maped to page 3, regardless of how carefull the programmer must be about that. Smile

Yes, you can map ROM to page 3 just like any other page. If you map ROM to all pages, you can't use stack so you can't call anything, but yes it is still possible.

There might be some hardware limitations (like SVI-738 slot 3-x) that prevents this kind of mapping but in any normal situation (external ROM) this should not be a problem.

بواسطة tokumaru

Expert (83)

صورة tokumaru

21-07-2006, 22:02

If you map ROM to all pages, you can't use stack so you can't call anything, but yes it is still possible.
Yeah, it'd be a very limited thing. But, as I said, if you use that space for graphics, for example, it is possible to come up with a routine that does not use any RAM or even the stack to copy that data to VRAM. After the transfer is done, just switch RAM back in. C'mon, it's usefull!!! =)

There might be some hardware limitations (like SVI-738 slot 3-x) that prevents this kind of mapping but in any normal situation (external ROM) this should not be a problem.
By "external ROM" you mean cartridges, right? I don't know what a "SVI-738" is.

بواسطة NYYRIKKI

Enlighted (5889)

صورة NYYRIKKI

22-07-2006, 10:29

right

بواسطة AuroraMSX

Paragon (1902)

صورة AuroraMSX

22-07-2006, 10:44

But that's not the point, the point is whether ROM can or can not be maped to page 3, regardless of how carefull the programmer must be about that. Smile

Yes, you can map ROM to page 3 just like any other page. If you map ROM to all pages, you can't use stack so you can't call anything, but yes it is still possible.
And you will have to disable interrupts, because the z80 will try to push a return address onto the stack when an interrupt occurs. Which leaves only the registers to play with. I'd say: "yes it is possible to map ROM to the complete z80 address space, but it's pretty useless for all practival purposes."

بواسطة NYYRIKKI

Enlighted (5889)

صورة NYYRIKKI

22-07-2006, 13:45

Well, you can enable interrups in order to make a timed jump, you just can't return from it. Tongue
yes it is possible to map ROM to the complete z80 address space, but it's pretty useless for all practival purposes
I wouldn't say that... I think page 3 is very good for storing graphics, samples and other this kind of stuff. This kind of mapping also works as a pretty good copy protection because you can't load this kind of game in real MSX without real cartridge or at least external memory. If you expect that the coputer has more than 16KB RAM you can also put RAM to page 2.

بواسطة tokumaru

Expert (83)

صورة tokumaru

22-07-2006, 19:00

Yeah, not useless at all. There's a ton of stuff you can fit in 16kb. You can fit 4 uncompressed mode 2 background tilesets. That would be more than enough for most games. If you use some simple compression, who knows how much you can fit in there! Before a level begins you could easily disble interrupts, switch ROM in page 3, copy the data to VRAM using only registers (no RAM/stack), and then switch RAM back in and enable interrupts. The Z80 has a lot of registers, so it's easy to code a simple routine that makes no use of memory. I doubt it could be done with a 6502, for example.

بواسطة ARTRAG

Enlighted (6579)

صورة ARTRAG

28-08-2006, 22:49

Help !!

I am doing the startup code on a rom that has the AB signature in page 0
why this code doed not work ?

    in a,(0xA8)              
    and 3                   ; which slot are we?
    ld c,a     
    sla a
    sla a
    or c
    sla a
    sla a
    or c
    out (0xA8),a            ; page 0,1 & 2 are at the same primary slot of page 0

    ld a,(-1)
    cpl
    and 3                   ; which sub slot are we?
    ld c,a     
    sla a
    sla a
    or c
    sla a
    sla a
    or c
    ld (-1),a               ; page 0,1 & 2 are at the same secondary slot of page 0

بواسطة DamageX

Master (217)

صورة DamageX

28-08-2006, 23:45

@ARTRAG
In order to check which secondary slot your code is running from (in page 0) you need to (temporarily) set page 3 to the same primary slot as page 0. Then you can read from $FFFF of the primary slot that your code is in.

صفحة 3/7
1 | 2 | | 4 | 5 | 6 | 7