Created
July 10, 2016 01:59
-
-
Save DankRank/7f66c73176e6128359f2b2ce03dd8f8a to your computer and use it in GitHub Desktop.
novert mouse driver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ORG 100h | |
USE16 | |
JMP SHORT start | |
oldaddr DW 0h | |
oldseg DW 0h | |
;------------------------------ | |
tsr: | |
CMP AH,99h ;Installation Check | |
JZ SHORT tsr_check | |
CMP AH,9Ah ;Get old INT33 seg/addr | |
JZ SHORT tsr_oldint | |
CMP AX,0003h | |
JZ SHORT tsr_override | |
CMP AX,000Bh | |
JZ SHORT tsr_override | |
JMP DWORD PTR CS:oldaddr | |
;------------------------------ | |
tsr_check: | |
MOV AX,1234h | |
IRET | |
;------------------------------ | |
tsr_oldint: | |
MOV DX,CS | |
MOV ES,DX | |
MOV DX,WORD PTR CS:oldaddr | |
MOV DS,WORD PTR CS:oldseg | |
IRET | |
;------------------------------ | |
tsr_override: | |
PUSHF | |
CALL DWORD PTR CS:oldaddr | |
XOR DX,DX ;clear y-pos/y-mickeys | |
IRET | |
;------------------------------ | |
;------------------------------ | |
start: | |
;Welcome message | |
MOV AH,9h | |
MOV DX,s_welcome | |
INT 21h | |
;Check DOS version. (2.00 is min) | |
MOV AH,30h | |
INT 21h | |
XCHG AH,AL | |
CMP AX,200h | |
JNB SHORT loc_ver | |
MOV DX,s_wrongver | |
MOV AH,09h | |
INT 21h | |
JMP NEAR quit | |
loc_ver: | |
;Installation Check. CL=(is installed?) | |
MOV AH,99h | |
INT 33h | |
CMP AX,1234h | |
JE SHORT loc_inst | |
MOV CL,0h | |
JMP SHORT loc_notinst | |
loc_inst: | |
MOV CL,1h | |
loc_notinst: | |
;Switch check | |
MOV AL,BYTE PTR 81h | |
CMP AL,'/' | |
JNE NEAR usage | |
;Switch-switch, hehe. | |
MOV AL,BYTE PTR 82h | |
CMP AL,'i' | |
JE SHORT install | |
CMP AL,'u' | |
JE SHORT uninstall | |
CMP AL,'s' | |
JE SHORT status | |
JMP NEAR usage | |
;------------------------------ | |
install: | |
OR CL,CL | |
JNZ loc_cantinst | |
;Get INT33 seg/addr | |
MOV AX,3533h | |
INT 21h | |
MOV WORD PTR oldaddr,BX | |
MOV WORD PTR oldseg,ES | |
;Set new INT33 address | |
MOV AX,2533h | |
MOV DX,tsr | |
INT 21h | |
;TSR | |
CALL NEAR success | |
MOV DX,15h | |
MOV AX,3100h | |
INT 21h | |
loc_cantinst: | |
MOV AH,09h | |
MOV DX,s_error | |
INT 21h | |
MOV DX,s_already | |
INT 21h | |
MOV DX,s_installed | |
INT 21h | |
JMP SHORT quit | |
;------------------------------ | |
uninstall: | |
OR CL,CL | |
JZ SHORT loc_cantuninst | |
;Get uninstall data | |
MOV AH,9Ah | |
INT 33h | |
;Restore INT 33 | |
MOV AX,2533h | |
INT 21h | |
;Free enviroment | |
PUSH ES | |
MOV ES,WORD PTR ES:2Ch | |
MOV AH,49h | |
INT 21h | |
;Free NVMD TSR itself | |
POP ES | |
MOV AH,49h | |
INT 21h | |
;Restore DS | |
PUSH CS | |
POP DS | |
JMP SHORT success | |
loc_cantuninst: | |
MOV AH,09h | |
MOV DX,s_error | |
INT 21h | |
MOV DX,s_not | |
INT 21h | |
JMP SHORT quit | |
;------------------------------ | |
status: | |
OR CL,CL | |
JZ SHORT loc_noinst2 | |
MOV CX,s_installed ;Installed | |
JMP SHORT loc_inst2 | |
loc_noinst2: | |
MOV CX,s_not ;Not installed | |
loc_inst2: | |
MOV AH,09h | |
MOV DX,s_status | |
INT 21h | |
MOV DX,CX | |
INT 21h | |
JMP SHORT quit | |
;------------------------------ | |
usage: | |
MOV AH,09h | |
MOV DX,s_usage | |
INT 21h | |
;------------------------------ | |
quit: | |
MOV AX,4C00h ;don't care about exit code | |
INT 21h | |
;------------------------------ | |
success: | |
MOV AH,09h | |
MOV DX,s_success | |
INT 21h | |
OR CL,CL | |
JZ SHORT loc_succinst | |
MOV DX,s_un | |
INT 21h | |
PUSH quit | |
loc_succinst: | |
MOV DX,s_installed | |
INT 21h | |
RET | |
;------------------------------ | |
;------------------------------ | |
s_welcome DB 'NVMD - NoVert Mouse Driver',0Dh,0Ah,'$' | |
s_usage DB 'Usage:',0Dh,0Ah | |
DB 'nvmd/i - install',0Dh,0Ah | |
DB 'nvmd/u - uninstall',0Dh,0Ah | |
DB 'nvmd/s - status',0D,0Ah,'$' | |
s_status DB 'Status: $' | |
s_error DB 'Error: $' | |
s_already DB 'already $' | |
s_not DB 'not ' | |
s_installed DB 'installed',0Dh,0Ah,'$' | |
s_un DB 'un$' | |
s_success DB 'Successfully $' | |
s_wrongver DB 'Incorrect DOS version',0Dh,0Ah,'$' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment