;Author:Cryin
;copy the NASM assembler, and use the command
;nasm.exe -f bin boot.asm
;Date:2010年05月14日
;连接:http://hi.baidu.com/justear
;安装方法:
;我用的是VC,写一个简单的安装程序;主要工作如下
;将原始MBR拷贝到第二扇区,并将本程序编译生成的二进制代码拷贝到第一扇区,另外请确认第一扇区的分区表信息
;与原始MBR的分区表信息完全相同,不同机器分区表都不尽相同
;密码为:kevin
;注:一扇区512个字节,空间比较小暂时没有添加修改密码功能,一时兴起之作,只为误乐。
;希望能认识高手,能学到真正的技术。
;=================================================================
CPU 486
BITS 16
jmp 0x0:0x7c00 ;jmp to original mbr from hard drive
;======================================================================
SHOWMESSAGE:
mov bx,0007h ; Page Number = 0, Attribute = 07h
mov ah,0Eh ; Function 0Eh: Teletype Output
cs lodsb ; load the first character
Next_Char:
int 10h
cs lodsb ; al = next character
or al,al ; last letter?
jnz Next_Char ; if not print next letter
RETURNBACK:
ret
;===========================================================
GETKEY:
XOR CX,CX
LOOP:
MOV AH,0
INT 16H
mov bl,al
AND BX,0xFF
CMP AL,0DH ;判断是否Enter键
JZ RETURNBACK
ADD CX,bx ;存入CX中
MOV AL,2AH
MOV BX,07H
MOV AH,0EH
INT 10H ;显示*号,继续等待输入
JMP LOOP
;======================================================
GETENTER: ;判断是否Enter键,如果是则返回,若不是继续等待输入
MOV AH,0
INT 16H
AND AX,0xFF
CMP AL,0DH
JNZ GETENTER
RET
;=======================================================
ShowAuthorMessage db 10, 13, "Author:sbha0909@yahoo.com.cn", 0
ShowEnterMessage db 10, 13, "Enter PassWord:", 0
ShowError db 10, 13, "wrong password!...Try again", 0
ShowLastError db 10, 13, "wrong password!...Try Last Time", 0
PassWordLength EQU 021DH ;"lenght of 'kevin'"
ShowByeBye db 10, 13, "Sorry...Please Don't Use My PC!", 0
ShowWelcome db 10, 13, "Welcome kevin...!Press Enter to load Windows", 0
;=================================================================
CodeEnd EQU $
times 510-($-$$) db 0 ;填充00h
Boot_Signature dw 0AA55h
;===============================================================
;程序结束,使用nasm.exe -f bin boot.asm编译生成bin文件就可以在安装程序中使用
;相关文章:http://bbs.pediy.com/showthread.php?t=121414