Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!rpi!bu.edu!att!rutgers!gatech!prism!bb16 From: bb16@prism.gatech.EDU (Scott Bostater) Newsgroups: comp.lang.pascal Subject: Re: How to detect MS Mouse driver Message-ID: <17855@hydra.gatech.EDU> Date: 30 Nov 90 13:29:54 GMT References: <25098@adm.brl.mil> <1990Nov29.141927.243@maytag.waterloo.edu> <6405@vice.ICO.TEK.COM> Organization: Georgia Institute of Technology Lines: 57 In article <6405@vice.ICO.TEK.COM> bobb@vice.ICO.TEK.COM (Bob Beauchaine) writes: >In article <1990Nov29.141927.243@maytag.waterloo.edu> dmurdoch@watstat.waterloo.edu (Duncan Murdoch) writes: > >>The test that Turbopower uses for the presence of an INT 33 ISR is just to >>look at the vector: if it's not nil, they assume it's valid. >> > > The other possibility is that the INT 33 vector points to a vector in > low memory that is nothing but an IRET. Just checking for a nil > vector won't guarantee that a mouse driver is/is not present. > > Something like this will check both: > > const IRET = $CF; > > var mouse_vec : pointer absolute $0000:0033; > mouse_present : boolean; > > mousepresent := not((longint(mouse_vec) = 0) or > (word(mouse_vec^) = iret)); First, the interrupt table at low memory is made up of double word addresses, hence int 0's address occupies $0000:$0000 through $0000:$0003, int 1's address occupies address $0000:$0004 through $0000:$0007, etc. Int $33's address would be $0000:$00CC through $0000:$00CF. Secondly, this is a poor programming technique. Don't rely on absolute memory references unless it absolutly neccessary. In this case its better to let the operating system give you the correct memory address. Turbo pascal even has this built in. .... uses Dos; const IRET = $CF; var Mouse_Vec: ^Byte; MousePresent: Boolean; Begin GetIntVec( $33, Mouse_Vec); MousePresent := Not ( Mouse_Vec = Ptr(0,0)) or (Mouse_Vec^ = IRET)); ... Granted, the chance of the interrupt vector table ever moving is pretty slim (or none), it's still safer to go through the OS. -- Scott Bostater Georgia Tech Research Institute - Radar Systems Analysis "My soul finds rest in God alone; my salvation comes from Him" -Ps 62.1 uucp: ...!{allegra,amd,hplabs,ut-ngp}!gatech!prism!bb16 Internet: bb16@prism.gatech.edu Brought to you by Super Global Mega Corp .com