ASM源码:最简洁完整的DOS设备驱动程序
cseg segment
assume cs:cseg,ds:cseg,es:cseg
org 0
hander dd -1
attrib dw 8000h
struct dw offset strutegy
inter dw offset interrupt
namee db 'simple '
rh_off dw 0
rh_seg dw 0
mseg db 07h,'my drive is installed!'
db 0dh,0ah,07h,'$'
comdtab dw init
strutegy proc far
mov cs:rh_off,bx
mov cs:rh_seg,es
ret
strutegy endp
interrupt proc far
push ds
push es
push ax
push bx
push dx
push di
les bx, dword ptr cs:rh_off
mov al,es:[bx+2]
cmp al,0
jnz exit2
shl al,1
lea di,comdtab
xor ah,ah
mov di,ax
call word ptr [di+comdtab]
jmp exit1
exit2:mov word ptr es:[bx+3],8003h
exit1:mov word ptr es:[bx+3],100h
pop di
pop dx
pop bx
pop ax
pop es
pop ds
ret
interrupt endp
init proc near
lea dx,mseg
mov ah,9
int 21h
mov word ptr es:[bx+0eh],offset init
mov es:[bx+10h],cs
xor ax,ax
ret
init endp
cseg ends
end