描述:
blockdev.asm
;desige to be compiled in a small model
;cs=ds
.model small
;-------------------------------------------------
;constant define
;-------------------------------------------------
USBDevAddr EQU 01H ;usb device address
CR EQU 0DH ;carriage return
LF EQU 0AH ;Line feed
MAXCMD EQU 25 ;DOS3.0
readErr EQU 800BH ;read ERROR
writeErr EQU 800AH ;write ERROR
locateErr EQU 8008H ;look for sector error
ERROR EQU 8000H ;Set error bit
BUSY EQU 0200H ;Set busy bit
DONE EQU 0100H ;Set completion bit
UNKNOWN_CMD EQU 8003H ;Set unknown status
OP_COMPLETE EQU 0000h ;Set no error
cseg segment public 'code' ;Start the code segment
org 0
assume cs:cseg,ds:cseg
;------------------------------------------------------------------
drvr proc far ;FAR procedure
DD -1 ;NEXT driver pointer
DW 0800H ;support open/close/movable;block device
DW strategy ;Pointer to strategy
DW interrupt ;Pointer to interrupt
DB 01 ;support one device
DB 7 dup(0)
_BPB dw 0200H
db 01H
dw 0001H
db 01H
dw 0100H
dw 0F000H
db 0F0H
dw 0100H
dw 0001H
dw 0001H
dw 0001H
dd 00000000H
;-------------------------------------------------------------------
rh_seg DW ? ;RH segment address
rh_off DW ? ;RH offset address
physicalAddr DD ?
;====================================================================
;strategy routine,must be declared far
;is the first routine dos called
;====================================================================
strategy PROC far
mov cs:rh_seg,es;
mov cs:rh_off,bx;
ret
strategy ENDP
;=====================================================================
; dispatch table
;=====================================================================
dispatchTable:
dw init
dw unsupport
dw unsupport
dw unsupport
dw unsupport
dw unsupport ;nondestructive read
dw unsupport
dw unsupport
dw unsupport
dw unsupport ;may change the CBWCB to apply the command
dw unsupport
dw unsupport
dw unsupport
dw unsupport
dw unsupport
dw unsupport
dw unsupport
dw unsupport
dw unsupport
dw unsupport
dw unsupport
dw unsupport
dw unsupport
dw unsupport
dw unsupport
;RH STRUC ;request head
;RHLength DB ? ;request head length
;unit DB ? ;request function number
;command DB ? ;request command n