;************************************************************** ; M DISK EQUATES ;************************************************************** ; mdiskbase equ 0c00h ;base paragraph ;address of mdisk ;************************************************************** ; DATBCB Definition ;************************************************************** drv equ byte ptr 0 record equ byte ptr 1 wflg equ byte ptr 4 seq equ byte ptr 5 track equ word ptr 6 sector equ word ptr 8 bufseg equ word ptr 10 link equ word ptr 12 pdadr equ word ptr 14 ;************************************************************** ; M DISK INITIALIZATION ;************************************************************** init_m_disk: mov cx,mdiskbase push es ! mov es,cx xor di,di mov ax,0e5e5h ;check if already initialized cmp es:[di],ax ! je mdisk_end mov cx,2000h ;initialize 16K bytes rep stos ax ;of Mdisk directory to 0e5h's mdisk_end: pop es ret ;************************************************************** ; M DISK CODE ;************************************************************** ;======= IO READ: ;Function 11 Read sector ;======= ; Reads the sector on the current disk, track and ; sector into the current DMA buffer. ; entry: AL = 00 if no error occurred ; exit: AL = 01 if an error occurred read_m_dsk: ;------------- call mdisk_calc ;calculate byte address push es ;save UDA les di,dword ptr dmaoff ;load destination MDA address xor si,si ;setup source DMA address push ds ;save current DS mov ds,bx ;load pointer to sector in memory rep movsw ;execute move of 128 bytes.... pop ds ;then restore user DS register pop es ;restore UDA xor ax,ax ;return with good return code ;======== IO_WRITE: ;FUNCTION 12: Write disk ;======== ;Write the sector in the current Dma buffer ;to the current disk on the current ;track in the current sector ; entry: CL = 0 - Deferred Writes ; 1 - nondeferred writes ; 2 - def-wrt lst sect unalloc blk ; exit: AL = 00H if no error occurred ; 01H if error occurred ; 02H if read only disk write_m_dsk: ;----------- call mdisk_calc ;calculate byte address push es ;save UDA mov es,bx ;setup destination DMA address xor di,di push ds ;save user segment register lds si,dword ptr dmaoff ;load source DMA address rep movsw ;move from user to disk in memory pop ds ;restore user segment pointer pop es ;restore UDA xor ax,ax ;return no error ret mdisk_calc: ;---------- ; entry: IOPB variables on the stack ; exit: BX = sector paragraph address ; CX = length in words to transfer mov bx,track ;pickup track number mov cl,3 ;times eight for relative ; sector number shl bx,cl mov cx,sector ;plus sector add bx,cx ;gives relative sector number mov cl,3 ;times eight for paragraph ; of sector start shl bx,cl add bx,mdiskbase ;plus base address of disk ; in memory mov cx,64 ;length in words for move ; of 1 sector mov al,mcnt xor,ah,ah mul cx ;length * multisector count mov cx,ax cld ret ;************************************************************** ; M DISK - DISP PARAMETER BLOCK ;************************************************************** dpb0 equ offset $ ;Disk Parameter Block dw 8 ;Sectors Per Track db 3 ;Block Shift db 7 ;block mask db 0 ;Extnt Mask dw 126 ;Disk size - 1 dw 31 ;Directory Max db 128 ;Alloc0 db 0 ;Alloc1 dw 0 ;Check Size dw 0 ;Offset db 0 ;Phys Sec Shift db 0 ;Phys Sec Mask xlt5 equ 0 ;No Translate Table als5 equ 16*2 ;Allocation Vector Size clss5 equ 0 ;Check Vector Size hss5 equ (32 * 4) ;Hash Table Size ;----------------------------------------------------------------