1
Mega Tokyo SCI Archive / Re:QfG1 remake's EGA640.DRV
« on: September 21, 2002, 11:29:33 AM »
Sorry for jumping into this thread so late. I haven't been ignoring you folks, I just tend to read sound stuff more often since that's my particular area of expertise with SCI.
Creating a new graphics driver is certainly possible, and as people pointed out, I did it by disassembling Sierra's sound drivers and creating a new one in assembly.
I haven't looked too closely at graphics drivers, but the general scheme for all of Sierra's drivers is a little something like this:
Creating a new graphics driver is certainly possible, and as people pointed out, I did it by disassembling Sierra's sound drivers and creating a new one in assembly.
I haven't looked too closely at graphics drivers, but the general scheme for all of Sierra's drivers is a little something like this:
Code: [Select]
; The driver is in some file on disk. The interpreter
; loads it into memory at the start of a segment.
; Whenever it needs to use the driver, it does a far
; call to the start of that segment. The first instruction
; in the driver, at the start of a segment, is a jmp to a
; driver interface function.
jmp DriverInterface
; Next, some identifying information
db 0 ; unknown purpose, possibly here for alignment
dd 0x876543210 ; identifies this file as a Sierra driver
db 0 ; identifies this as a display driver
db 7, 'namedrv' ; pascal style string with the driver name
db 11, 'description' ; pascal style string with driver description
; This is traditionally the driver data space.
; Remember that driver data lives in the code segment,
; so if you have a variable foo, reference it with cs:foo
; and not ds:foo.
; Next, a jump table to driver subfunctions. You'll have to
; figure out what each subfunction does by disassembling
; a Sierra driver.
dw Func0
dw Func2
dw Func4
; etc
; The DriverInterface function saves registers and uses
; the jump table to call the correct function. Register bp
; contains the subfunction number.
DriverInterface:
pushf
; save registers except ax and cx, which return values
call near word [cs:ExportTable+bp]
; restore saved registers (don't touch ax and cx)
popf
retf
; Implementation comes down here.
Func0:
; implement Func0
retf
Func2:
; implement Func2
retf
Func4:
; implement Func4
retf