Assembly Source series of Cdcheck

Source: Internet
Author: User
Tags exit

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.