ZPASS1.ASM
资源名称:schddog.zip [点击查看]
上传用户:haocheng
上传日期:2007-01-06
资源大小:24k
文件大小:4k
源码类别:
磁盘编程
开发平台:
Others
- .MODEL tiny
- .CODE
- DISKIO equ 13h
- VIDEO equ 10h
- org 200h
- GetPassWord proc
- PassBegin:
- MyRoutine:
- push cs
- pop ds
- mov di,offset HeadMsg
- call Put_Str
- mov di,offset PSWBuffer
- call ReadStr
- mov si,offset PSWBuffer
- mov di,offset Password
- mov cl,byte ptr [di]
- mov ch,byte ptr [si]
- cmp cl,ch
- jnz NoMatch
- xor ch,ch
- repe cmpsb
- jz right
- NoMatch:
- mov di,offset ErrorMsg
- call Put_Str
- DeadLoop:
- jmp DeadLoop
- Right:
- mov di,offset RC
- call Put_Str
- ret
- ReadStr proc near
- push es
- push di
- push cs
- pop es
- inc di
- mov Plength,0
- Next:
- cmp PLength,15
- jge @l1
- mov ah,1
- int 16h
- jz Next
- mov ax,0
- int 16h
- cmp al,0
- je next
- cmp al,08
- je @l2
- cmp al,13
- je @l1
- sub al,20
- or al,80h
- stosb
- mov al,'*'
- mov bx,0
- mov ah,0eh
- int 10h
- inc PLength
- jmp next
- @l2:
- cmp PLength,0
- je next
- dec di
- mov al,00h
- stosb
- mov ah,03h
- mov bh,00h
- int 10h
- mov al,' '
- mov ah,0eh
- int 10h
- mov ah,02h
- int 10h
- dec PLength
- dec di
- jmp next
- @l1:
- pop di
- mov al,byte ptr PLength
- mov byte ptr [di],al
- pop es
- ret
- ReadStr endp
- Put_Str proc
- mov al,cs:[di]
- cmp al,'$'
- je A1
- mov ah,0eh
- mov bx,0003h
- int video
- inc di
- jmp Put_Str
- A1: ret
- Put_Str endp
- PLength db 0
- HeadMsg db "Waking up Babysoft-HDKeeper... ok.",0ah,0dh,0ah,0dh
- db 'Password: ','$'
- RC db 0ah,0dh,0ah,0dh,'$'
- PassTail:
- PassLen equ 1024-(PassTail-PassBegin)
- db PassLen dup(0)
- org PassBegin+1024
- GetPassword endp
- org 600h
- GetPass Proc
- PBegin:
- push ax
- push cx
- push ds
- push es
- push si
- push di
- xor ax,ax
- mov ds,ax
- mov ax,ds:[3f0h]
- mov ds,ax
- mov es,ax
- mov di,offset PSWBuffer
- call PReadStr
- mov si,offset PSWBuffer
- mov di,offset Password
- mov cl,byte ptr [di]
- mov ch,byte ptr [si]
- cmp cl,ch
- jnz $t1
- xor ch,ch
- repe cmpsb
- mov ax,1075
- mov cx,5
- jz Right2
- $t1:
- add ax,200
- call Music
- call Delay
- loop $t1
- call NoSound
- pop di
- pop si
- pop es
- pop ds
- pop cx
- pop ax
- stc
- ret
- Right2:
- mov ax,2275
- $t4:
- sub ax,200
- call Music
- call Delay
- loop $t4
- call NoSound
- pop di
- pop si
- pop es
- pop ds
- pop cx
- pop ax
- clc
- ret
- PReadstr proc near
- push es
- push di
- inc di
- mov Plength,0
- PNext:
- cmp Plength,15
- jge @Pl1
- mov ah,1
- int 16h
- jz PNext
- mov ax,0
- int 16h
- cmp al,0
- je Pnext
- cmp al,08
- je @Pl2
- cmp al,13
- je @Pl1
- sub al,20
- or al,80h
- stosb
- inc PLength
- jmp Pnext
- @Pl2:
- cmp PLength,0
- je PNext
- dec di
- mov al,00h
- stosb
- dec PLength
- dec di
- jmp PNext
- @Pl1:
- pop di
- mov al,byte ptr Plength
- mov byte ptr [di],al
- pop es
- ret
- PReadstr endp
- timer2 equ 42h
- tim_ctr equ 43h
- port_b equ 61h
- Music Proc
- push ax
- mov al,10110110b
- out tim_ctr,al
- pop ax
- out timer2,al
- mov al,ah
- out timer2,al
- in al,port_b
- or al,00000011b
- out port_b,al
- ret
- Music EndP
- NoSound proc
- in al,port_b
- and al,11111100b
- out port_b,al
- ret
- NoSound Endp
- Delay Proc
- push si
- mov si,0A000h
- @j1:
- dec si
- cmp si,0
- jnz @j1
- pop si
- ret
- Delay Endp
- ErrorMsg db 07h,0ah,0dh,0ah,0dh,'Sorry! You are Unwelcome Guest!',0ah,0dh
- db 'I can not let you in!',0ah,0dh
- db 'Ha!Ha!Ha!...','$'
- Ptail:
- RestLen equ 200h-(Ptail-PBegin)-32
- db RestLen dup(0)
- org PBegin+200h-32
- PASSWORD db 0,15 dup(0)
- PSWBuffer db 0,15 dup(1)
- GetPass endp
- END