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

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

PUBLIC _SecRed

;========================================================
; Read diskette sectors. The usage is:
;
; push ;drive number
; push ;head (side) number
; push ;track number
; push ;sectors number
; push ;number of sectors to write
; push ;segment of buffer
; push ;offset of buffer
; call _SecRed ;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.

SecRedStk 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 ?
SecRedStk ENDS

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

.CODE

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

;--- read 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, 2 ;read function
int 13h ;execute
pop es
jnc Scrd1

;--- error, reset disk and try again

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

push es
mov ah, 2 ;read function
int 13h ;execute
pop es
jnc Scrd1 ;jump if okay

;--- error reading sectors

mov al, ah
sub ah, ah
jmp Scrd2

;--- sector is read

Scrd1: sub ax, ax

Scrd2: pop es
pop bp
pop si
pop di
pop dx
pop cx
pop bx
ret 14
_SecRed ENDP

END


  3 Responses to “Category : Miscellaneous Language Source Code
Archive   : BDISK10.ZIP
Filename : SECRED.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/