文档介绍:drives:汇编源码系列的drives
疯狂代码/ ĵ:http://assembler/
这个都是过去DOS时代汇编源码虽然已经过去了但是对于学习汇编还是有帮助汇编语言只是员门基
础语言大多人掌握即可不定要深入研究.......
; Drive detection by: Lee Hamel (******@) - July 6th, 1994
; Partial credit to : Paul Schlyter
;
; Goes thru drives A-Z and determines they:
; 1) Exist
; 2) Are removable or fixed
; 3) Are local, remote, or shared
; 4) Are a floppy, hard, RAM, subst, or CD-ROM drive
.model tiny
.286
DRIVEXISTS EQU 1
REMOVEDRV EQU 0
FIXEDDRV EQU 1
LOCALDRV EQU 0
REMOTEDRV EQU 1
SHAREDRV EQU 2
FLOPPY EQU 0
HARD EQU 1
RAM EQU 2
SUBST EQU 3
CDROM EQU 4
.code
org 100h
start: mov ah,19h
21h ; get start drive
mov [curdrive],al
mov ax,40h
mov es,ax
mov bh,es:[10h] ; 40:10h is # of floppies-1
shr bh,6
inc bh ; # of actual floppy drives
mov bl,1
mov di,off drives
nextchkfloppy: mov ax,4409h ; check drive exists
21h
jc nextfloppy
test dh,10000000b ; check SUBST drive
jz chkfloppy
dec bh ; dec actual drive count
mov ptr [di+3],SUBST
floppyexist: mov ptr [di],DRIVEXISTS
jmp nextfloppy
chkfloppy: dec bh ; dec actual drive count
js nextfloppy
mov ptr [di+1],REMOVEDRV
mov ptr [di+3],FLOPPY
jmp floppyexist
nextfloppy: add di,4
inc bl
cmp bl,2 ; B then jump back
je nextchkfloppy
mov ch,24 ; loop 24 times (drives C - Z)
mov cl,3 ; star