Category : C Source Code
Archive   : CEXPRESS.ZIP
Filename : DISKTYPE.ASM

 
Output of file : DISKTYPE.ASM contained in archive : CEXPRESS.ZIP
;unsigned short disk_type(drive_number);
; unsigned short drive_number;

EXTRN _memory_model:byte

_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT
PUBLIC _disk_type
_disk_type proc near
push bp ;save BP
mov bp,sp ;set up stack frame
cmp _memory_model,0 ;near or far?
jle begin ;jump if near
inc bp ;else add 2 to BP
inc bp ;
begin: push ds ;DS changed by interrupt
mov dl,[bp+4] ;drive number
mov ah,1ch ;DOS function number
int 21h ;get drive information
sub cx,cx ;CX holds return value
mov al,[bx] ;get drive ID
cmp al,0FCH ;one of top four codes?
jnae L1 ;jump ahead if not
sub al,0fBH ;change code number
mov cl,al ;ready for return
jmp short L2 ;go set return value
L1: mov cl,5 ;fifth code
cmp al,0F9h ;is it the one?
je L2 ;jump if so
mov cl,6 ;sixth code
cmp al,0f8h ;is it the one?
je L2 ;jump if so
mov cl,0 ;else return 0
L2: mov ax,cx ;set the return value
pop ds ;restore DS
pop bp ;restore BP and quit
cmp _memory_model,0 ;quit
jle Quit ;
db 0CBh ;RET far
Quit: ret ;RET near
_disk_type endp
_TEXT ENDS
END


  3 Responses to “Category : C Source Code
Archive   : CEXPRESS.ZIP
Filename : DISKTYPE.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/