Category : Miscellaneous Language Source Code
Archive   : BDISK10.ZIP
Filename : SECWRT.ASM

 
Output of file : SECWRT.ASM contained in archive : BDISK10.ZIP
DOSSEG
.MODEL medium

PUBLIC _SecWrt

;========================================================
; Write diskette sectors. The usage is:
;
; push ;drive number
; push ;head (side) number
; push ;track number
; push ;sector number
; push ;number of sectors to write
; push ;segment of buffer
; push ;offset of buffer
; call _SecWrt ;write
;
; The values are not checked. AX = 0 if no errors,
; otherwise the disk status is returned in AL and
; AH = 0.
;
; The stack is cleared on exit and all registers are
; preserved except AX.

SecWrtStk STRUC
registers dw 7 DUP (?)
retaddr dw 2 DUP (?)
buf_off dw ?
buf_seg dw ?
count dw ?
sector dw ?
track dw ?
head dw ?
drive dw ?
SecWrtStk ENDS

ASSUME ds:NOTHING, es:NOTHING, ss:NOTHING

.CODE

_SecWrt PROC
push bx
push cx
push dx
push di
push si
push bp
push es
mov bp, sp

;--- write the sectors

mov al, byte ptr [bp].count ;sector count
mov ch, byte ptr [bp].track ;track number
mov cl, byte ptr [bp].sector ;sector number
mov dh, byte ptr [bp].head ;head number
mov dl, byte ptr [bp].drive ;drive number
mov bx, [bp].buf_off ;buffer offset
mov es, [bp].buf_seg ;buffer segment

push es
mov ah, 3 ;write function
int 13h ;execute
pop es
jnc Scwr1

;--- error, reset disk and try again

push es
mov ah, 0 ;reset function
int 13h ;execute
pop es

push es
mov ah, 4 ;write function
int 13h ;execute
pop es
jnc Scwr1 ;jump if okay

;--- error writing sectors

mov al, ah
sub ah, ah
jmp Scwr2

;--- sector is written

Scwr1: sub ax, ax

Scwr2: pop es
pop bp
pop si
pop di
pop dx
pop cx
pop bx
ret 14
_SecWrt ENDP

END


  3 Responses to “Category : Miscellaneous Language Source Code
Archive   : BDISK10.ZIP
Filename : SECWRT.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/