Change screen mode without BIOS call

By kanageddaamen

Rookie (25)

kanageddaamen's picture

03-04-2018, 16:00

For my (eventual) end use case for a v9958, I won't be able to use MSX Bios calls for setting the screen mode, so I am attempting to do so in pure asm. Unfortunately the screen mode does not seem to be changing when I update the relevant VDP registers. I am pretty certain my register write code is fine as other changes are being made that are not related to the screen mode. I am just not sure if I am missing something. Here is a snippet of the relevant code

KEYS: EQU #FBE5
PORT0: EQU #98
PORT1: EQU #99
PORT2: EQU #9A
PORT3: EQU #9B

start_prog:
	di
	call setvideomode
	ei
keycheck: 
	ld a,(KEYS+8)
	bit 0,a
	jp nz,keycheck
	ret
setvideomode:
	ld a, 0
	ld b, 00000100B 
	call writetoregister ; set mode 3 bits, disable all other flags
	ld a, 1
	ld b,01100000B 
	call writetoregister ; set mode 3 bits and enable screen and v-retrace interrupt
	ld a,8
	ld b,00001000b
	call writetoregister ; set DRAM refresh
	ld a,9
	ld b,0
	call writetoregister ; clear rest of mode flags
	ld a,7
	ld b,00000000b
	call writetoregister ; sets border to black, works
	ret
writetoregister: ; a contains register number, b contains data
	and 10111111B
	or 10000000B
	ld c, PORT1
	out (c),b
	out (c),a
	ret

NOTE: I also tried updating the bios mirror of R#0 (as that is the only one that really changes) and it still stays in teh default screen mode.

Login or register to post comments

By NYYRIKKI

Enlighted (5384)

NYYRIKKI's picture

03-04-2018, 16:42

I just tested the code and it seems to switch correctly to SCREEN 4... There must be something else wrong outside of this routine.

By kanageddaamen

Rookie (25)

kanageddaamen's picture

03-04-2018, 19:36

I was seeing some corruption of the screen and not having some of the data written I was expecting. Turned out to be a address bug. Oops. Thanks!