How to access to BIOS system variables from MSX-DOS?

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

By litwr

Resident (46)

litwr's picture

09-05-2016, 20:24

I need to get the variable at $2B to get VSYNC value at a MSX-DOS program. It looks like a big problem to me. Sad Is there other way to get this v-sync value? I am seeking for help. BTW I used MSX2 Yamaha at 1988 only... I am trying to make some assembler code now. Wink

Login or register to post comments

By tvalenca

Paladin (747)

tvalenca's picture

09-05-2016, 22:03

You have to place the code to read this value outside the $0000-$3FFF (page 0) boundary (either copying it anywhere over $4000 or making your program big enough so this code will be outside page 0), then this code will change the slot at page 0 to the BIOS slot, read the value you want and store it elsewhere (outside page 0) then you change back the slot on page 0 to the RAM slot to RAM slot and resume your program.

By litwr

Resident (46)

litwr's picture

09-05-2016, 23:10

Thank you. I tried to call to RDPRIM (f380) to read a byte but it doesn't work. Sad This routine is at MSX-DOS RAM - is it possible to use it? The direct IN/OUT magic looks too complicated when the only one byte is required. I made the code

   ld a,$54
   out ($a8),a
   ld a,($2b)
   ld c,a
   ld a,$55
   out ($a8),a

I am not sure in it... The matter with slots and subslots is difficult for a newbie. Sad My program is small so this routine will require reallocation...

By AxelF

Champion (386)

AxelF's picture

09-05-2016, 23:53

Welcome to MRC,

I'm affaid your example will not work, because you are switching page0 where your currend code runs in.

A nicer way is to use the RDSLT (#0C) function that is allso available in dos (Same function as in BIOS)

xor a             ;Not expanded, Primary Slot0, Secondary Slot 0
ld hl,#002b       ;Read adress #2b
call #0c          ;Call RDSLT

Now the value of adress #2d is stored in Accu

Address : #000C
Function : Reads the value of an address in another slot
Input : A - ExxxSSPP
| || Primary slotnumber (00-11)
| - Secundary slotnumber (00-11)
+----------- Expanded slot (0 = no, 1 = yes)
HL - Address to read
Output : A - Contains the vaule of the read address
Registers: AF, C, DE
Remark : This routine turns off the interupt, but won't turn it on again

By gdx

Enlighted (4634)

gdx's picture

10-05-2016, 01:14

litwr, the best way is:

ld a,(0fcc1h)     ;Get main-ROM slot number
ld hl,002bh       ;Read address #2b
call 000ch        ;Call RDSLT
ei                ;Because RDSLT disables interruptions

A - Contains the readed value at address 002bh
Registers: AF, BC, DE are modified.

By litwr

Resident (46)

litwr's picture

10-05-2016, 05:58

Thanks! RDSLT works. Smile It looks like F380 call is not proper documented. Sad I checked its code under MSX-DOS and found that it uses 3 parameters:
A - slot number to read,
D - slot number of call,
HL - address.
It returns result in E. It works... Shocked! Any comments?

By gdx

Enlighted (4634)

gdx's picture

10-05-2016, 08:46

Do not use the routine at F380h because it is valid only for primary slots (on bank 0~2) and it is just a sub-routine of RDSLT, not a complet routine.

(A = Primary slots, D = Current primary slots status)

By DarkSchneider

Paladin (941)

DarkSchneider's picture

10-05-2016, 11:00

In a DOS environment you have to use interslot, that is the reason of my question at
So for call or read the interslot functions are needed.

Also, what is the?


the variable at $2B to get VSYNC value

I never heard about it. Could someone explain or put a reference of BIOS values to read?

By Grauw

Ascended (10015)

Grauw's picture

10-05-2016, 11:48

On MSX1 bit 7 indicates whether the system is PAL or NTSC. Of course on MSX2 it only indicates the default mode, and you should instead check bit 1 of the VDP register 9 mirror.

By litwr

Resident (46)

litwr's picture

10-05-2016, 14:35

'Curiouser and curiouser!'
V9938 MSX-VIDEO Technical Data Book Programmer’s Guide says


*NT (RGB output only) If set to 1, PAL mode (313 lines, 50Hz); if set to 0, NTSC mode (262 lines, 60Hz)
“*” will mean that value of the bit does not matter

What is it?! Shocked! I need to detect the timer ($FC9E) frequency... Is it possible to get wrong value from 2B?

By hit9918

Prophet (2904)

hit9918's picture

10-05-2016, 16:33

on MSX2 one can switch the VDP to other hz.
the bios variable just tells the boot time value.

rdslt the MSX version
if msx1 then rdslt the hz from ROM else check vdp register

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