ram in page 0

By monant

Resident (48)

monant's picture

02-03-2011, 21:43


is this also true for RAM in page 0 ?

if not ,would you suggest a safe method to switch RAM in page 0 ?


Login or register to post comments

By flyguille

Prophet (3028)

flyguille's picture

02-03-2011, 22:00

that information is ok, that is the standard way.


By sd_snatcher

Prophet (3367)

sd_snatcher's picture

02-03-2011, 23:05

There's one problem with the "slightly better method" mentioned on that page, though: It doesn't comply with the MSX Technical Handbook (pg-38) and may cause compatibility problems on some configurations.

By RetroTechie

Paragon (1563)

RetroTechie's picture

03-03-2011, 15:42

the "slightly better method" wouldn't work on MSX(1) machines that have RAM in different slots - there exist some... oO Therefore I'd recommend to check if disk BASIC present. If so, use that RAMAD0 slot. If no diskBASIC, check if it's an MSX2. If so, the "slightly better method" should be OK. If neither is the case (MSX1 without diskdrive), only reliable method is to search all slots for RAM.

Next: with RAM in page 0 (but not MSX-DOS), if I'm not mistaken there's no guarantee anything's there. Read: no slotswitch entry points, no interrupt entry point (0038h), etc. If you just want to use it for some extra code/data, perhaps an easier way it to use WRSLT to 'poke' a few bytes there, and then do CALSLT to those few bytes. With contents = some jump or call to continue once RAM is switched into page 0. And better leave interrupts disabled in that case - for the duration of using stuff in RAM page 0.

A lot of trouble for litte gain - easier: make MSX-DOS program (instead of starting from BASIC), or add memory mapper to the requirements. Cool

By ro

Guardian (4202)

ro's picture

03-03-2011, 16:37

Setting page 0 to use RAM is great; it gives you extra linear 16k of RAM to use for you program. As RetroDude mentioned, there's no "standard" code in the RAM page unless you've put it there yourself. But that's obvious, not? You'll "hide" the BIOS ROM hence no direct BIOS ROM calls possible. Ofcourse you can use the romcall routines, in page 3 where system stuff is located, to call ROM BIOS routines.

you sure need the "poke -1,xxx" trick to make sure RAM is positioned right on page 0. If've got all such routines on my HD somewhere, it's part of the f-kernel we wrote. If you wan'm.... I can post the source.


By JohnHassink

Ambassador (5471)

JohnHassink's picture

03-03-2011, 18:48

Can this be done in combination with NestorBASIC as well?



By Metalion

Paragon (1215)

Metalion's picture

04-03-2011, 08:54

It may be obvious to a lot of us, but it's better to remind it nonetheless : if you switch page 0 to RAM, you'll have to write your own ISR (Interruption Service Routine) in 0038h. It may be a simple 'RET', 'RETI' or 'RETN' but it has to be there, otherwise the system will freeze.

Or you can choose to get out of the IM1 interruption mode of the Z80, and select either the IM0 (device driven interruption code mode) or IM2 (vectored table interruption mode), and the subsequent code needed to handle those interrupt modes.

By monant

Resident (48)

monant's picture

05-03-2011, 12:13

thanks for all of your replies ,
on my NMS8245 , to set RAM in page 0 I poke-1,170 and out (&ha8),&Bxxxxxx11
, but , as you said before on other MSX systems may be different ,so i'll follow your advices

in this case i need RAM in page 0 to place my own ISR at address 0038h. IM1
it is a short stand alone program for MSX2...... written for testing vdp reg.18 behavior.
it runs on Horizontal retrace interrupt by modifyng reg 18 each scanline
it is the same code (simplyfied) i used in my pseudo-demo Rainbow , you can find here in the download section


By hit9918

Prophet (2897)

hit9918's picture

05-03-2011, 15:38

on my NMS8245 , to set RAM in page 0 I poke-1,170 and out (&ha8),&Bxxxxxx11
, but , as you said before on other MSX systems may be different

An important thing: every slot got its own FFFF subslot register. To properly select a subslot, you first need to select the slot into page 3, then write FFFF.

Blindly setting FFFF often works because page 3 already is selected in to the RAM slot.