Safe set BIOS and restore RAM on page 0 from MSX-DOS?

Page 4/4
1 | 2 | 3 |

By zeilemaker54

Master (244)

zeilemaker54's picture

15-10-2016, 11:55

Quote:

It is better to use the ROMSLT instead the EXPTBL. It has the full SlotId info for BIOS. I think EXPTBL maybe miss the secondary slot info and only has the primary and the expanded bit.

ROMSLT value is indentical to the value of EXPTBL+0. Even on the Ma20 msx2 upgrade expansion. MSX system software always use EXPTBL+0 for maximum compatibility, because ROMSLT is only available on MSX2 and up. So I doubt ROMSLT is beter.

By DarkSchneider

Paladin (854)

DarkSchneider's picture

15-10-2016, 12:17

@hit9918 Thanks! I was crazy because it didn't work on a modified NMS 8245 with BIOS on slot 0-0 and mapped RAM on 0-3. That is the notation of M80 assembler that is the one I use because integration with MSX-C. It is a bit annoying to put a 0 before the hex value.

Much work saved Big smile

Now is working even on that scenario.

Tested using EXPTBL and works too. So if is the one used by system software then fine to use it. Any case if is for MSXDOS I think MSX2 is required.
The remarks of the function changed, here is the current function:

; Set page 0 SlotId
; Input: A - SlotId
; Registers: AF, BC, DE, HL
; Remarks: ISR must preserve page 0 SlotId and page 3 memory mapping. Function must be placed within address range [4000h, BFFFh]
setpg0@:
	ld c, a ; save
	; primary slot
	and 3 ; get only primary slot
	ld b, a ; B = primary slot for page 0
	in a, (0a8h)
	and 0fch ; clean page 0
	or b
	out (0a8h), a
	; secondary slot
	ld a, c ; restore original SlotId value
	rlca ; check for expanded bit
	ret nc ; if not expanded return
	rrca
	and 00ch ; get only subslot
	rrca ; put it for page 0
	rrca
	ld c, a ; C = secondary slot for page 0
	; set SLTTBL on HL
	ld hl, SLTTBL
	ld d, 0
	ld e, b ; add primary slot value to SLTTBL
	add hl, de ; HL = SLTTBL pointer
	; check if is the same already in SSSR
	ld a, (hl) ; get SLTTBL
	ld d, a ; save
	and 3 ; get only page 0
	xor c ; compare if the same
	ret z ; if xor = 0 then is the same, return
	; pre-compute new SSSR
	ld a, d ; recover SLTTBL
	and 0fch ; clean page 0
	or c ; set secondary slot for page 0
	ld e, a ; E = new SSSR
	ld a, b ; recover primary slot
	rrca ; set it for page 3
	rrca
	ld b, a ; B = primary slot for page 3
	; change SSSR
	in a, (0a8h)
	ld d, a ; save original value
	and 03fh ; clean page 3
	or b
	di ; we are going to change page 3
	out (0a8h), a ; set page 3 for SSSR
	ld a, e ; recover new SSSR
	ld (0ffffh), a ; set new SSSR
	ld a, d ; restore page 3
	out (0a8h), a
	; update SLTTBL
	ld a, e ; recover new SSSR
	ld (hl), a ; save on its corresponding SLTTBL
	ei ; finished with page 3
	ret

By zeilemaker54

Master (244)

zeilemaker54's picture

15-10-2016, 12:14

CALSLT to a page 0 address in an expanded slot 0 is only compatible on later versions of the msx1 bios. So MSX2 and up it should be working fine.

By DarkSchneider

Paladin (854)

DarkSchneider's picture

15-10-2016, 12:27

zeilemaker54 wrote:

CALSLT to a page 0 address in an expanded slot 0 is only compatible on later versions of the msx1 bios. So MSX2 and up it should be working fine.

Yes for setting the BIOS works fine. The problem is when restoring the RAM.

Another solution could be to have the used functions mirrored in the program. MSX-C includes many wrappers to MSX functions. But is always good to have alternatives and be able to use the BIOS ones in ROM.

By hit9918

Prophet (2864)

hit9918's picture

15-10-2016, 12:44

Quote:

CALSLT to a page 0 address in an expanded slot 0 is only compatible on later versions of the msx1 bios.

yeah but just before we had an MSX2 HB-F5 crashing on it.
the own enaslt is more reliable than bios and DOS.

By hit9918

Prophet (2864)

hit9918's picture

15-10-2016, 12:55

well and MSXDOS runs on MSX1.
the exptbl fcc1 always works because VIP software is using it and then bios retargeters must patch it.

Page 4/4
1 | 2 | 3 |