This is the past DOS era of the compilation of source code, although has passed, but for the study of the assembly is still helpful, assembly language is just a basic programmer language, most people can grasp, not necessarily in-depth research.
. Model Small; It ' s A flaw of mine ... I really like this model
; I know I should do a. com with the tiny model.
; But I just love the small:>
. stack 100h; Plenty Stack;>
.386
. Data
Info db DUP (0)
Right db ' right cd$ '
Wrong db ' wrong cd$ '
Nomscdex db ' Mscdex not installed$ '
. Code
mov ax, @data; Make Ds&es point to the DATA
MOV Ds,ax
MOV Es,ax
Lea EdX, Nomscdex
XOR EBX,EBX
mov eax, 1500h; MSCDEX installed?
int 2FH
Test EBX,EBX
JZ exit
MOV edi,10h
Nextloop:
MOV Ecx,edi
mov ax, 150BH; is drive ECX supported by MSCDEX (is it a CDROM?)
int 2FH
Test Ax,ax; ax!=0 If drive is CDrom
JZ Continiue
mov ax, 440DH
MOV dx, offset info
MOV bl,5
MOV ch,8
MOV cl,66h
int 21h; Fetch Volume serial number (same as when to do dir)
mov eax, DWORD ptr [info+2]
cmp eax, 0ffb7f724h; ; <<<<calibrate this to fit your own ' right ' CD
JNZ continiue
Lea EdX, right
JMP exit
Continiue:
Dec EDI; Next Drive
JNZ Nextloop
Lea edx, wrong; Not in any drive!
Exit
mov ah, 9h
int 21h
MOV ax,4c00h; terminate!
int 21h
End