FDOG.ASM
资源名称:schdgurd.zip [点击查看]
上传用户:yugezi
上传日期:2007-01-06
资源大小:18k
文件大小:3k
源码类别:
磁盘编程
开发平台:
Others
- code segment
- assume cs:code;ds:code
- org 100h
- start:jmp init
- old13h dd ?
- buf db 512 dup(0)
- lmsg db 'Babysoft (R) Floppy Disk Dog version 1.0',0Ah,0Dh
- db 'Copyright (C) 1997.11 LiuYaDing,Babysoft Corp.',0Ah,0Dh,'$'
- hhmsg db 'Floppy Disk Dog installed.',0Ah,0Dh,'$'
- jxok db 'Floppy Disk Dog has installed flag on disk.',0Ah,0Dh,'$'
- msg db 'Invalid floppy!!!'
- dev db 0
- jsz db 0
- set dd 0ffff0000h
- new13h proc far
- pushf
- cmp ah,2
- jb old
- cmp ah,3
- ja old
- cmp dl,80h
- jz old
- jmp jx
- old:popf
- jmp cs:old13h
- jx: popf
- pushf
- push ds
- push es
- push ax
- push bx
- push cx
- push dx
- push si
- push di
- mov ax,cs
- mov ds,ax
- mov es,ax
- mov dev,dl
- mov jsz,3
- mov ax,201h
- mov cx,2
- mov dh,0
- mov bx,offset buf
- pushf
- call cs:old13h
- readfat:
- mov ax,201h
- mov cx,2
- mov dh,0
- mov bx,offset buf
- pushf
- call cs:old13h
- jnc cmpid
- cmp jsz,3
- jz cmpid
- dec jsz
- mov ax,0e07h
- int 10h
- mov ah,0
- mov dl,dev
- call cs:old13h
- pushf
- jmp readfat
- cmpid:
- mov ax,word ptr [buf+1]
- cmp ax,3456h
- jz oold
- mov ah,3
- mov bh,0
- int 10h
- push dx
- mov dx,30h
- lea si,msg
- mov cx,17
- loop1:
- mov ah,2
- int 10h
- mov bl,70h
- mov ah,9
- lodsb
- int 10h
- inc dl
- loop loop1
- mov ah,2
- pop dx
- int 10h
- mov ah,0
- int 16h
- or al,20h
- cmp al,'y'
- jnz reset
- pop di
- pop si
- pop dx
- pop cx
- pop bx
- pop ax
- pop es
- pop ds
- popf
- mov ah,4ch
- int 21h
- reset:
- mov bx,0
- mov si,0
- xor ax,ax
- mov ds,ax
- mov word ptr ds:[472h],1234h
- push cs
- pop ds
- jmp set[bx][si]
- oold:
- pop di
- pop si
- pop dx
- pop cx
- pop bx
- pop ax
- pop es
- pop ds
- popf
- assume ds:nothing
- jmp cs:old13h
- new13h endp
- init:
- push cs
- pop ds
- mov dx,offset lmsg
- mov ah,9
- int 21h
- mov si,80h
- mov al,[si]
- cmp al,0
- jz zl
- mov si,82h
- mov al,[si]
- and al,0fh
- dec al
- cmp al,1
- ja error
- push ax
- mov cx,1
- mov dx,1
- mov bx,offset buf
- int 25h
- mov ax,3456h
- mov word ptr [buf+1],ax
- popf
- pop ax
- mov cx,1
- mov dx,1
- int 26h
- jnc exit
- error:
- mov ah,9
- mov dx,offset er
- int 21h
- mov ax,4c00h
- int 21h
- exit:
- mov dx,offset jxok
- mov ah,9
- int 21h
- mov ax,4c00h
- int 21h
- er db 07h,'Write-protected or Invalid driver!',0Ah,0Dh,'$'
- zl: mov ax,3513h
- int 21h
- mov di,bx
- mov si,offset new13h
- mov cx,offset init
- sub cx,si
- cld
- repz cmpsb
- jnz zl1
- mov dx,offset hmsg
- mov ah,9
- int 21h
- mov ax,4c00h
- int 21h
- hmsg:
- db 07h,'Floppy Disk Dog has already installed!',0Ah,0Dh,'$'
- zl1:
- mov dx,offset hhmsg
- mov ah,9
- int 21h
- mov word ptr old13h,bx
- mov word ptr old13h+2,es
- mov dx,offset new13h
- mov ax,2513h
- int 21h
- mov dx,offset init
- int 27h
- code ends
- end start