Hey all,
Another quick DOS2 question... I'm currently working on a small project that will eventually need to grab a file from RAMdisk, decompress it and shove it down the VDP's throat. Since I want to support DOS2 so ppl with a harddisk can use it, I'll need to use DOS2's mapping routines. A little digging got me no further.
I know I'm somehow supposed to get my hands on a jump table address which I can then use to use the ALLSEG, GET_P2 and PUT_P2 functions. From what I understand I should somehow get the address of the jumptable in HL, and should then be able to jump to:
HL+$00 to allocate a segment
HL+$24 to set a segment at $8000
HL+$27 to get the segment at $8000
The problem is I do not know where to get the jumptable address in the >>BASIC<< environment. I assume the functions should be available under BASIC in DOS2 mode, but I've got no idea how to get my hands on the jumptable address.
Furthermore, would the following code do what it's supposed to do? Sorry to bother you all, but I haven't even touched an assembler for like 7 years and am finding it difficult to get the hang of it again...
{sorry, due to a small bug in our forums it wasn't possible to post the code rite here, working on a workaround  )} |
GEM DOS2 init code:
DOS: EQU 0005h
EXTBIO: equ 0FFCAh
HOKVLD: equ 0FB20h
MprVarTab: dw 0
MprSupAdr: dw 0
MprSupCall:
jp 0 ; self-modified!
Initialize:
ld c,6Fh ; check DOS version
call DOS
or a
jp nz,0 ; No DOS, jump to 0
ld a,b
cp 2
jp c,DOS1
ld a,[HOKVLD] ; check EXTBIO
bit 0,a
ld a,85h
jp z,Error ; no extended bios, return "wrong MSX-DOS"
xor a ; get mapper support stuff
ld d,4
ld e,1
call EXTBIO
or a
ld a,85h
jp z,Error ; no mapper support, return "wrong MSX-DOS"
ld [MprVarTab],hl
ld d,4
ld e,2
call EXTBIO
ld [MprSupAdr],hl
ret
That's the init code.
Then you can use it like this:
ld hl,[MprSupAdr]
ld de,15h ; check page 0-3 segments (GET_PH)
add hl,de
ld [MprSupCall+1],hl
ld h,0C0h
call MprSupCall
or a
ld a,85h
jp nz,Error
ld h,80h
call MprSupCall
cp 1
ld a,85h
jp nz,Error
ld h,40h
call MprSupCall
cp 2
ld a,85h
jp nz,Error
ld h,0
call MprSupCall
cp 3
ld a,85h
jp nz,Error
That code (just an example) checks if page 0-3 are actually segments 3-0.
|