📄 rxdosdev.asm
字号:
pop word ptr [ reqBlock.rwrBuffer. _segment ][ bp ] ; es
push word ptr [ _RxDOS_pCLOCKdriver. _segment ]
push word ptr [ _RxDOS_pCLOCKdriver. _pointer ]
call CharDevRequest
restoreRegisters cx, dx, di, es
Return
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Get Days/ Time From Bios ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; Output: ;
; ch hours ;
; cl minutes ;
; dh seconds ;
; dl hundredths of seconds ;
;...............................................................;
getExpandedDateTime:
Entry
defbytes _datedef, sizeCLOCKDATA
saveRegisters es, di
setES ss
lea di, offset _datedef [ bp ]
call getSysDate ; get system date
mov cx, word ptr [ _datedef. cl_minutes ][ bp ]
mov dx, word ptr [ _datedef. cl_hseconds ][ bp ]
mov ax, word ptr [ _datedef. cl_daysSince1980 ][ bp ]
restoreRegisters di, es
Return
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Get Date From Bios ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; Output: ;
; dh month ;
; dl day ;
; cx year ;
;...............................................................;
getExpandedDate:
Entry
defbytes _datedef, sizeCLOCKDATA
saveRegisters es, di
setES ss
lea di, offset _datedef [ bp ]
call getSysDate ; get system date
mov dl, byte ptr [ _datedef. cl_day ][ bp ]
mov dh, byte ptr [ _datedef. cl_month ][ bp ]
mov cx, word ptr [ _datedef. cl_year ][ bp ]
mov ax, word ptr [ _datedef. cl_daysSince1980 ][ bp ]
restoreRegisters di, es
Return
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Call Character Device Strategy /Interrupt Routines ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; Input: ;
; es:bx request block ;
; stack device ;
; ;
; Output: ;
; cy abort requested on error ;
;...............................................................;
CharDevRequest:
Entry 2
darg _device
ddef _strategy
ddef _interrupt
ddef _packet, es, bx
saveSegments bp, bx, ax
getdarg es, bx, _device ; get device
mov ax, es
or ax, bx ; if no device address
jz CharDevRequest_12 ; error exit -->
mov ax, word ptr es:[ devStrategy ][ bx ]
stordarg _strategy, es, ax
mov ax, word ptr es:[ devInterrupt ][ bx ]
stordarg _interrupt, es, ax
IFDEF RxDOS_TRACEBUILD
getdarg es, bx, _packet
cmp byte ptr es:[ rwrFunction ][ bx ], NONDESTRREAD
jz CharDevRequest_06 ; if idling -->
push word ptr [ _interrupt. _segment ][ bp ] ; driver address
push word ptr [ _interrupt. _pointer ][ bp ] ; driver address
call LogTraceCharDevRequest ; save/log
CharDevRequest_06:
ENDIF
push ds
push bp
getdarg es, bx, _packet
mov ds, word ptr [ _strategy. _segment ][ bp ]
call dword ptr [ _strategy ][ bp ] ; strategy
pop bp
push bp
getdarg es, bx, _packet
mov ds, word ptr [ _strategy. _segment ][ bp ]
call dword ptr [ _interrupt ][ bp ] ; interrupt
pop bp
pop ds
IFDEF RxDOS_TRACEBUILD
getdarg es, bx, _packet
cmp byte ptr es:[ rwrFunction ][ bx ], NONDESTRREAD
jz CharDevRequest_08 ; if idling -->
call LogTraceCharDevReturn ; save/ echo log trace
CharDevRequest_08:
ENDIF
getdarg es, bx, _packet
cmp word ptr es:[ mrStatus ][ bx ], 0
jz CharDevRequest_12
test word ptr es:[ mrStatus ][ bx ], OP_ERROR
jz CharDevRequest_16
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; time out, other error exit.
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CharDevRequest_12:
stc
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; exit
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CharDevRequest_16:
restoreSegments ax, bx, bp
Return
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Call Blocked Device Strategy /Interrupt Routines ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; Input: ;
; al drive unit ;
; es:bx request block ;
; ;
; Output: ;
; cy abort requested on error ;
;...............................................................;
BlockedDevRequest:
Entry
def _drive, ax
def _sectors
def _sectorsRead
ddef _strategy
ddef _interrupt
ddef _packet, es, bx
saveSegments bp, bx, ax
mov cx, word ptr es:[ rwrBytesReq ][ bx ]
storarg _sectors, cx ; sectors
call getAddrDPB ; (es:bx) Device Parameter Block
ifc BlockedDevRequest_28 ; no device info -->
cmp word ptr es:[ _dpbptrDeviceDriver. _segment ][ bx ], 0000
ifz BlockedDevRequest_28 ; no device info -->
les bx, dword ptr es:[ _dpbptrDeviceDriver ][ bx ]
mov ax, word ptr es:[ devStrategy ][ bx ]
stordarg _strategy, es, ax
mov ax, word ptr es:[ devInterrupt ][ bx ]
stordarg _interrupt, es, ax
BlockedDevRequest_06:
getarg ax, _sectors
getdarg es, bx, _packet ; restore packet address
mov word ptr es:[ rwrBytesReq ][ bx ], ax ; bytes request
mov word ptr es:[ rhStatus ][ bx ], 0000 ; (kill prev error code)
IFDEF RxDOS_TRACEBUILD
push word ptr [ _interrupt. _segment ][ bp ] ; driver address
push word ptr [ _interrupt. _pointer ][ bp ] ; driver address
call LogTraceBlockDevRequest ; save/ echo log trace
ENDIF
push ds
push bp
mov ds, word ptr [ _strategy. _segment ][ bp ]
call dword ptr [ _strategy ][ bp ] ; strategy
pop bp
push bp
getdarg es, bx, _packet
nop
mov ds, word ptr [ _strategy. _segment ][ bp ]
call dword ptr [ _interrupt ][ bp ] ; interrupt
nop
pop bp
pop ds
IFDEF RxDOS_TRACEBUILD
getdarg es, bx, _packet ; restore packet address
call LogTraceBlockDevReturn ; save/ echo log trace
ENDIF
getdarg es, bx, _packet ; restore packet address
mov cx, word ptr es:[ rwrBytesReq ][ bx ] ; actual sectors read
storarg _sectorsRead, cx ; sectors read
cmp word ptr es:[ rhStatus ][ bx ], 0
jz BlockedDevRequest_08
test word ptr es:[ rhStatus ][ bx ], OP_ERROR
jz BlockedDevRequest_32
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Abort, Retry, Ignore ?
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BlockedDevRequest_08:
cmp word ptr ss:[ _RxDOS_AbortInProgress ], 0 ; already in critical error ?
jnz BlockedDevRequest_28 ; ignore error -->
mov ax, word ptr es:[ rhStatus ][ bx ] ; get error report
call _callCriticalError ; switch context stack
Goto CRITERROR_TERMINATE , BlockedDevRequest_24
Goto CRITERROR_IGNORE , BlockedDevRequest_32
Goto CRITERROR_FAIL , BlockedDevRequest_28
Goto CRITERROR_RETRY , BlockedDevRequest_20
jmp short BlockedDevRequest_28
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; retry
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BlockedDevRequest_20:
SaveAllRegisters
xor ax, ax
mov al, byte ptr [ _drive ][ bp ] ; get drive letter
call getDPB ; check for drive change/ inv buffers
RestoreAllRegisters ; restore registers
jmp BlockedDevRequest_06
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; terminate application
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BlockedDevRequest_24:
xor ax, ax
call _TerminateProcess ; terminate curr process
cli
mov ax, -2
add ax, word ptr ss:[ _RxDOS_StackLongJump ]
mov sp, ax ; cancel stack, return
xor ax, ax
sti
ret ; does a long jump out of RxDOS
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; exit
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BlockedDevRequest_28:
stc
BlockedDevRequest_32:
getarg cx, _sectorsRead ; sectors read
restoreSegments ax, bx, bp
Return
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Init Request Block ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; Input: ;
; ax drive (-1 if char device ) ;
; cx bytes requested ;
; ss:di request block offset on stack ;
; ;
; Output: ;
; es:bx request block ;
;...............................................................;
initReqBlock:
push ax ; drive
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -