Professional Documents
Culture Documents
.model tiny
.code
ORG 0
HEADER:
dd -1 ;Link to next device driver
dw 0C840H ;Device attribute word
dw OFFSET STRAT ;Pointer to strategy routine
dw OFFSET INTR ;Pointer to interrupt routine
db ’DEVICE’ ;Device name
;This is the strategy routine. Typically it just takes the value passed to it
;in es:bx and stores it at RHPTR for use by the INTR procedure. This value is
;the pointer to the request header, which the device uses to determine what is
;being asked of it.
STRAT:
mov WORD PTR cs:[RHPTR],bx
mov WORD PTR cs:[RHPTR+2],es
retf
;This is the interrupt routine. It’s called by DOS to tell the device driver
;to do something. Typical calls include reading or writing to a device,
;opening it, closing it, etc.
INTR:
push bx
push si
push di
push ds
push es
push cs
pop ds
les di,[RHPTR] ;es:di points to request header
mov al,es:[di+2] ;get command number
INTRX: pop es
pop ds
pop di
pop si
pop bx
retf