]
] Hi, folks.
]
] I was making some proggies for MSXDOS and tried using the MSX2
] SUBROM under DOS2. Simple like this:
]
] LD IY,(FAF7h)
] LD IX,subrom_routine_i_want_to_call
] CALL 001Ch
]
] Well, what is the result?
] For some routines, a great CRASH.
] For setting palette, NOTHING.
] For reading VDP registers, in some MSX, CRASH.
] For saving a screen area (copy(x,y) to "file.pic"), CRASH.
]
Hi MSX friends,
After browsing through a huge stack of old MCM's (a dutch MSX computer
magazine), I found an explanation and solution for the above mentioned
problem in issue 48.
The explanation is that it is illegal to directly call the MSX2 subrom from
the MSXDOS environment. The interslot call of some implementations of MSXDOS
can not handle the fact that the MSX2 subrom is in page 0. It seems that the
DOS2 subrom is one of those versions.
The idea of the solution is to call the MSX2 subrom via the EXTROM function
in the ROMBIOS. Below, you can find a routine which should work with all
versions of MSXDOS. It pushes a small routine on the stack which calls the
EXTROM function in the bios. The NMI hook (which has no real usage on MSX) is
changed to jump to this function. The NMI hook is called via an interslot
call to the NMI entry in the ROMBIOS.
Don't ask me why it is legal to do an interslot call to the ROMBIOS, which is
in page 0, while it is illegal to do an interslot call to the MSX2 subrom,
also in page 0...
Anyway, the method seams to be officially recommended by ASCII corporation.
At least, according to the article in MCM 48 where I found this information.
Here it is:
; CALSUB
;
; In: IX = addr of routine in MSX2 subrom
; AF, HL, DE, BC = parameters for the routine
;
; Out: AF, HL, DE, BC = depending on the routine
;
; Changes: IX, IY, AF', BC', DE', HL'
;
; Call MSX2 subrom from MSXDOS. Should work with all versions of MSXDOS.
;
; Notice: NMI hook will be changed. This should pose no problem as NMI is
; not supported on the MSX at all.
;
CALLSLT equ 001ch
NMI equ 066h
EXTROM equ 015fh
EXPTBL equ 0fcc1h
H_NMI equ 0fdd6h
;
CALSUB: exx
ex af,af' ; store all registers
ld hl,EXTROM
push hl
ld hl,0c300h
push hl ; push NOP ; JP EXTROM
push ix
ld hl,021ddh
push hl ; push LD IX,<entry>
ld hl,03333h
push hl ; push INC SP; INC SP
ld hl,0
add hl,sp ; HL = offset of routine
ld a,0c3h
ld (H_NMI),a
ld (H_NMI+1),hl ; JP <routine> in NMI hook
ex af,af'
exx ; restore all registers
ld ix,NMI
ld iy,(EXPTBL-1)
call CALLSLT ; call NMI-hook via NMI entry in ROMBIOS
; NMI-hook will call SUBROM
exx
ex af,af' ; store all returned registers
ld hl,10
add hl,sp
ld sp,hl ; remove routine from stack
ex af,af'
exx ; restore all returned registers
ret
Kind regards,
Alex Wulms
--
Alex Wulms/XelaSoft - MSX of anders NIX - Linux 4 ever
See my homepage for info on the *** XSA *** format
http://www.inter.nl.net/users/A.P.Wulms
****
MSX Mailinglist. To unsubscribe, send an email to [EMAIL PROTECTED] and put
in the body (not subject) "unsubscribe msx [EMAIL PROTECTED]" (without the
quotes :-) Problems? contact [EMAIL PROTECTED] (www.stack.nl/~wiebe/mailinglist/)
****