PDA

Click to See Complete Forum and Search --> : My DOS driver?


Jhd.Honza
Jun 27th, 2000, 04:45 AM
How can I make my own drivers for DOS, wich will be placed in high memory? (Such mouse, sound, net-cards, etc.)

Jun 27th, 2000, 06:20 AM
Writing drivers? I don't think QB is the language to do it in. Anyhow, someone gave me thid code awhile back. It adds support for a Mouse

DEFINT A-Z
DECLARE SUB basicint (IntType AS INTEGER) 'the routine

DECLARE SUB mouseinit (scrmode) 'starts the mouse(in SCREEN scrmode)
DECLARE SUB mouseshow ()
DECLARE SUB mousehide ()
DECLARE SUB updatemouse () 'call this each time new data from
'the mouse is wanted

DECLARE FUNCTION mousex ()
DECLARE FUNCTION mousey ()
DECLARE FUNCTION lbutton () 'Ä¿
DECLARE FUNCTION rbutton () ' Å 1 if pressed, 0 if not pressed
DECLARE FUNCTION bothbs () 'ÄÙ

COMMON SHARED xfactor, yfactor

TYPE REGISTERS
ax AS INTEGER
bx AS INTEGER
cx AS INTEGER
dx AS INTEGER
END TYPE
DIM SHARED regs AS REGISTERS

SCREEN 0: CLS
PRINT "Select from 0,1,2,7,8,9,10,11,12,13 please!"
INPUT "What screen mode???", scr
mouseinit (scr)
SCREEN scr: CLS

PRINT "Yippy do dah day... A mouse routine..."
LOCATE 10, 1: PRINT "Press any key to exit."
mouseshow

DO
updatemouse
LOCATE 2, 1
PRINT "X:"; mousex, "Y:"; mousey
PRINT "L:"; lbutton, "R:"; rbutton, "BOTH:"; bothbs
LOOP UNTIL INKEY$ <> ""
mousehide
END

DATA 1566,3669,-30457,-29723,2678,-30547,-20284,9933,18083,-29952,3190,20653,-30291,-21053,-15991,-30291,-29758,3190,-14717,-21236,-16351,1396,-16242,-30291,-29753,3190

DATA
-31970,2246,8621,29888,7941,-21168,-14711,-29096,22744,-28528,28299,-30452,70,24201,-30462,1102,22153,-29690,2142,30345,-29686,3142,32393,-24818,18057,23824,7943,714,0

SUB basicint (IntType AS INTEGER) STATIC
DIM ASM%(54)
DEF SEG = VARSEG(ASM%(0))

IF ASM%(1) = 0 THEN
FOR l = 0 TO 54: READ ASM%(l): NEXT
END IF

CALL ABSOLUTE(regs, IntType, VARPTR(ASM%(0)))
DEF SEG
END SUB

FUNCTION bothbs
IF lbutton = 1 AND rbutton = 1 THEN
bothbs = 1
ELSE
bothbs = 0
END IF
END FUNCTION

FUNCTION lbutton
lbutton = regs.bx AND 1
END FUNCTION

SUB mousehide
regs.ax = 2: CALL basicint(&H33)
END SUB

SUB mouseinit (scrmode)
regs.ax = 3: CALL basicint(&H33)
SELECT CASE scrmode
CASE 0: xfactor = 8: yfactor = 8
CASE 1: xfactor = 2: yfactor = 1
CASE 2: xfactor = 1: yfactor = 1
CASE 7: xfactor = 2: yfactor = 1
CASE 8: xfactor = 1: yfactor = 1
CASE 9: xfactor = 1: yfactor = 1
CASE 10: xfactor = 1: yfactor = 1
CASE 11: xfactor = 1: yfactor = 1
CASE 12: xfactor = 1: yfactor = 1
CASE 13: xfactor = 2: yfactor = 1
CASE ELSE: PRINT "What kind of screen mode is that?!?!": END
END SELECT
END SUB

SUB mouseshow
regs.ax = 1: CALL basicint(&H33)
END SUB

FUNCTION mousex
mousex = regs.cx / xfactor
END FUNCTION

FUNCTION mousey
mousey = regs.dx / yfactor
END FUNCTION

FUNCTION rbutton
rbutton = (regs.bx AND 2) / 2
END FUNCTION

SUB updatemouse
regs.ax = 3: CALL basicint(&H33)
END SUB

Jhd.Honza
Jun 30th, 2000, 05:47 AM
Thank you for a mouse driver, but I meaned ho to make program, which I can link to config.sys
(LOAD[HIGH]= or DEVICE=) as a resident dos application.