⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 password.asm

📁 给硬盘启动时加把锁
💻 ASM
字号:
PartLoad equ 600h
TableBegin equ 7BEh
BootLoc equ 7c00h
IDAddr equ 7DFEh
PassMaxLen equ 15
            .MODEL tiny
            .CODE
            org 0
Head:
start:
            cli
            xor ax,ax
            mov ss,ax
            mov sp,7c00h
            push ax
            pop es
            push ax
            pop ds
            sti
            cld
            mov si,offset Continue+7c00h
            mov di,offset Continue+600h
            mov cx,200h
            repne movsb
            db 0EAh
            dw offset Continue+600h,0000h
Continue:
            mov cx,0004h
www:
            push cx
            mov si,offset ReadKey+600h
            call PrintStr
            mov di,800h
            call ReadStr
            mov si,800h
            mov di,offset Password+600h
            xor ch,ch
            mov cl,byte ptr [di]
            repe cmpsb

            jz @next1
            mov si,offset WrongKey+0600h
            call PrintStr
            pop cx
            dec cx
            jnz www
            jmp $
@next1:
            mov si,TableBegin
            mov bl,4
FindBoot:
            cmp byte ptr[si],80h
            je SaveRec
            cmp byte ptr[si],0
            jne Invalid
            add si,10h
            dec bl
            jnz FindBoot
            int 18h
SaveRec:
            mov dx,[si]
            mov cx,[si+2]
            mov bp,si
FindNext:
           add si,10h
           dec bl
           jz SetRead
           cmp byte ptr[si],0
           je FindNext
Invalid:
           mov si,offset ErrMsg1+600h
PrintMsg:
           call PrintStr
DeadLock:
           jmp short DeadLock
SetRead:
           mov di,5
ReadBoot:
           mov bx,BootLoc
           mov ax,0201h
           push di
           int 13h
           pop di
           jnc Goboot
           xor ax,ax
           int 13h
           dec di
           jnz ReadBoot
           mov si,offset ErrMsg2+600h
           jmp short PrintMsg
GoBoot:
           mov si,offset ErrMsg3+600h
           mov di,IDAddr
           cmp word ptr[di],0AA55h
           jne PrintMsg
           mov si,bp
           db 0eah,00h,7ch,00h,00h
ErrMsg1    db 'invalid partition table',0,
ErrMsg2    db 'Error loading operating system',0
ErrMsg3    db 'Missing operating system',0
ReadKey    db 'PASSWORD:',0
WrongKey   db 0ah,0dh,'Unauthorized User!',0ah,0dh,0
Plength    db 0
PrintStr:
           lodsb
           cmp al,0
           je @exit
           push si
           mov bx,7
           mov ah,0eh
           int 10h
           pop si
           jmp short PrintStr
@exit:
           retn
Readstr    proc near
           push es
           push di
           push cs
           pop es
           inc di
           mov Plength,0
Next:
         cmp Plength,PassMaxLen
         jge @11
         mov ah,1
         int 16h
         jz Next
         mov ax,0
         int 16h
         cmp al,0
         je Next
         cmp al,08
         je @12
         cmp al,13
         je @11
		   
         ;sub al,20
         ;or  al,80h
          stosb
		   
          mov al,'*'
          mov bx,0
          mov ah,0eh
          int 10h
          inc Plength

          jmp Next
@12:
          cmp Plength,0
          je Next
          dec di
          mov al,00h
          stosb

          mov ah,03h
          mov bh,00h
          int 10h
          dec dx
          mov ah,02h
          int 10h
          mov al,' '
          mov ah,0eh
          int 10h
          mov ah,02h
          int 10h
          dec Plength

          dec di
          jmp Next
@11:
           pop di
           mov al,byte ptr Plength
           mov byte ptr [di],al
           pop es
           ret
Readstr    endp
		    
Tail:
FillNum    equ 1BEh-(Tail-Head)-16
           db FillNum dup(0)
Password   db 5,'wangrwwwwwwwwww'
PartTable  db 80h,01h,01h,00h,04h,04h
           db 0D1h,02h,11h,00h,00h,00h
           db 0EEh,0FFh,00h,00h,00h,00h
           db 0C1h,03h,05h,04h,0D1h,0FEh
           db 0FFh,0FFh,00h,00h,0ACh,53h
           db 00h,00h,00h,00h,00h,00h
           db 00h,00h,00h,00h,00h,00h
           db 00h,00h,00h,00h,00h,00h
           db 00h,00h,00h,00h,00h,00h
           db 00h,00h,00h,00h,00h,00h
           db 00h,00h,00h,00h
MagicID    dw 0AA55h
           END start

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -