Detect text mode in MSX-DOS and switch to 32/40/80 column mode?

By Prodatron

Paragon (1836)

Prodatron's picture

21-05-2014, 15:03

I would like to switch to SCREEN 0 (with 40 columns) in my MSX-DOS2 application. The MSX-BIOS "chgmod" (#005F) function only seem to be able to change the screen mode, but as screen 0 can have both 40 and 80 coloumns, I am not sure if this is the correct way. I don't want to "hack" and program the VDP directly, but only want to use MSX-DOS/BIOS functions.
What I would like to know is...
- how do I call BIOS functions from an MSX-DOS application?
- how do I switch to 40 column mode?
- is it possible to detect the current screen and column mode? I would like to restore it, when the application returns to DOS

Login or register to post comments

By Wolverine_nl

Paragon (1160)

Wolverine_nl's picture

21-05-2014, 15:08

so, you have an application in MSXDOS2 and when you exit this app the screen isn't in the mode/colour that you would like to see, you could create a batchfile you put in the folder, put the correct screen and mode in it. Unless you want to create an extra shell around something, that is an easy way

By Wolverine_nl

Paragon (1160)

Wolverine_nl's picture

21-05-2014, 15:08

wasnt there a totext function in MSX BIOS?

By Wolverine_nl

Paragon (1160)

Wolverine_nl's picture

21-05-2014, 15:18

just checked the msx handbook, its in there Wink

By Prodatron

Paragon (1836)

Prodatron's picture

21-05-2014, 15:53

Well, I would like to switch to 40 column mode within the COM-application without using an additional BATch file.
To which text mode would TOTEXT switch? ( http://map.grauw.nl/resources/msxbios.php - no additional information here )
And I guess I can't just do a CALL #00D2 in MSX-DOS, can I?

By Wolverine_nl

Paragon (1160)

Wolverine_nl's picture

21-05-2014, 16:09

i think it switches default to the 40 col mode.
Do you have the un-compiled/unassembled files of the .com app ? Or is it an existing app?

By Manuel

Ascended (19273)

Manuel's picture

21-05-2014, 16:26

I think it switches to the mode you were in when starting the COM app. But I'm not sure, it's just what I've seen with MSX-DOS apps in my life Smile

By Grauw

Ascended (10699)

Grauw's picture

21-05-2014, 16:30

How to switch to 40 column mode:

INITXT: equ 6CH
LINL40: equ 0F3AEH

VDP_InitScreen0:
	ld a,40
	ld (LINL40),a
	call INITXT
	ret

Replace ld a,40 with ld a,80 to switch to 80-column mode.

By Manuel

Ascended (19273)

Manuel's picture

21-05-2014, 17:16

Grauw: that works in MSX-DOS?

By Prodatron

Paragon (1836)

Prodatron's picture

21-05-2014, 17:18

Great, that works!
So in MSX-DOS it looks like this:

        ld a,40
        ld (LINL40),a
        ld iy,(#fcc1-1)
        ld ix,INITXT
        call #1c

(I didn't use interslot calls before, so I was a little bit confused first)

@Manuel: You were faster Big smile

By Grauw

Ascended (10699)

Grauw's picture

21-05-2014, 17:22

No you need to do an interslot call, like so:

CALSLT: equ 1CH
INITXT: equ 6CH
LINL40: equ 0F3AEH
EXPTBL: equ 0FCC1H

VDP_InitScreen0:
	ld a,40
	ld (LINL40),a
        ld iy,(EXPTBL - 1)
        ld ix,INITXT
	call CALSLT
	ret

I highlighted the relevant bits for the interslot call.

[Edit: @Prodatron yes Smile.]