WEB开发网
开发学院软件开发汇编语言 汇编源码系列之cdcheck 阅读

汇编源码系列之cdcheck

 2008-04-29 09:34:50 来源:WEB开发网   
核心提示:这个都是过去DOS时代的汇编源码,虽然已经过去了,汇编源码系列之cdcheck,但是对于学习汇编还是有帮助的,汇编语言只是程序员一门基础语言

这个都是过去DOS时代的汇编源码,虽然已经过去了,但是对于学习汇编还是有帮助的,汇编语言只是程序员一门基础语言,大多人掌握即可,不一定要深入研究.......

.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 30 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 you 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

Tags:汇编 源码 系列

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接