Files
Digital-Research-Source-Code/CPM OPERATING SYSTEMS/CPM 86/CONCURRENT/CCPM-86 3.1 SOURCE/D5/MDISK.A86
Sepp J Morris 31738079c4 Upload
Digital Research
2020-11-06 18:50:37 +01:00

60 lines
1.5 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

title 'M disk module'
include diskhdr.equ
MDISKBASE EQU 6000H
cseg
public read_m_dsk, write_m_dsk
read_m_dsk:
;----------
call mdisk_calc ;calculate byte address
push es ;save UDA
les di,dword ptr dmaoff ;load destination DMA 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
ret
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:
;----------
; output: 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+1 ;plus base address of disk in memory
mov cx,64 ;length for move of 1 sector
mov al,mcnt
xor ah,ah
mul cx ;length * multi sector count
mov cx,ax
cld
ret