『楼 主』:
[分享]数据软磁盘启动程序制作工具(源程序)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 程序名: FDBOOT.ASM 程序版本: 0.04? 最后修定日期:2002.11.21 ;;
;; 程序主要功能: 在 PC DOS、DR DOS、MS DOS、Novell DOS、WINDOWS 9x 或者是 ;;
;; Windows Me 的命令行模式(即 DOS 模式)中运行本程序,程序通过检查软盘引导 ;;
;; 扇区内容是否被更改来判断数据软盘是否支持自动引导功能,若不支持则用修正的 ;;
;; 引导代码写入引导扇区中,使数据软磁盘支持自动引导功能。 ;;
;; 使用说明: 进入DOS模式后运行本程序,程序即自动完成数据软盘引导程序的制作。;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PAGE 59,132
.386p
.387
data_1 equ 68Bh
data_2 equ 7C00h
data_3 equ 7DFEh
segment_av segment para public use16
assume cs:segment_av, ds:segment_av, es:segment_av, ss:segment_av
org 100h
Boot db 0EBh,040h,090h,0F1h,0BCh,020h,0BDh,0DCh,020h,0BBh,0D4h,000h,002h,001h,001h,000h
db 002h,0E0h,000h,040h,00Bh,0F0h,009h,000h,012h,000h,002h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,00Fh,000h,000h,000h,000h,001h,000h,000h,000h,000h,000h,000h
db 000h,001h,002h,000h,001h,010h,021h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,0FAh,033h,0C0h,08Eh,0D0h,0BCh,000h,07Ch,0B8h,0B0h,007h,050h,050h,01Fh
db 007h,0BEh,000h,001h,0BFh,000h,003h,0B9h,000h,001h,0F3h,0A5h,0B8h,0D0h,007h,050h
db 050h,050h,01Fh,007h,0B8h,069h,001h,050h,0CBh,0FBh,0BEh,0B9h,001h,0E8h,03Ah,000h
db 0B8h,001h,002h,0B9h,001h,000h,0BAh,080h,000h,033h,0DBh,053h,007h,0BBh,000h,07Ch
db 006h,053h,0CDh,013h,072h,00Ah,026h,081h,03Eh,0FEh,07Dh,055h,0AAh,075h,001h,0CBh
db 0BEh,076h,002h,0E8h,014h,000h,0B4h,001h,0CDh,016h,074h,006h,032h,0E4h,0CDh,016h
db 0EBh,0F4h,032h,0E4h,0CDh,016h,033h,0D2h,0CDh,019h,0FCh,0ACh,00Ah,0C0h,075h,001h
db 0C3h,056h,0B4h,00Eh,0CDh,010h,05Eh,0EBh,0F2h,046h,044h,042h,04Fh,04Fh,054h,020h
db 046h,06Ch,06Fh,070h,070h,079h,020h,044h,069h,073h,06Bh,020h,042h,06Fh,06Fh,074h
db 020h,075h,074h,069h,06Ch,069h,074h,079h,02Eh,00Ah,00Dh,042h,06Fh,06Fh,074h,069h
db 06Eh,067h,020h,066h,072h,06Fh,06Dh,020h,068h,061h,072h,064h,064h,069h,073h,06Bh
db 02Eh,02Eh,00Ah,00Dh,000h,043h,061h,06Eh,06Eh,06Fh,074h,020h,06Ch,06Fh,061h,064h
db 020h,066h,072h,06Fh,06Dh,020h,068h,061h,072h,064h,064h,069h,073h,06Bh,02Eh,00Ah
db 00Dh,049h,06Eh,073h,065h,072h,074h,020h,073h,079h,073h,074h,065h,06Dh,064h,069h
db 073h,06Bh,020h,061h,06Eh,064h,020h,070h,072h,065h,073h,073h,020h,061h,06Eh,079h
db 020h,06Bh,065h,079h,02Eh,00Ah,00Dh,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,055h,0AAh
tab db 055h,0AAh ; 以上为修正的软盘引导记录内容
buffers db 512 dup (0)
Version_e db ''Floppy Disk Boot utility Maker Version 0.04'', 0E1h,'' - Compile date: 2002.11.21'',0Ah, 0Dh,''$''
Version_c db ''FDBOOT 数据软磁盘引导程序制作工具 0.04 '', ''β测试版'','' 编译日期: 2002年11月21日'',0Ah, 0Dh, ''$''
Copyright_e db ''(C)Copyright Kinglion Software Workroom, All Rights Reserved. '',0Ah, 0Dh,''$''
Copyright_c db ''(C)版权所有:金狮计算机软件工作室 窦杰晖 保留所有权利.'',0AH, 0Dh, 0Ah, 0Dh,0Ah, 0Dh, ''$''
Virus_e db 0Ah, 0Dh,'' Warning! Not found boot utility in diskette boot sector!'',7,7, 0Ah, 0Dh,0Ah, 0Dh, ''$''
Virus_c db '' 警报: 在软磁盘引导扇区内没有找到引导程序代码!'', 7, 7, 7, 0Ah, 0Dh,0Ah, 0Dh, ''$''
Writed_e db 0Ah, 0Dh,'' Boot utility created successfully!'',7, 7, 0Ah, 0Dh, 0Ah, 0Dh,''$''
Writed_c db '' 软盘引导工具已成功制作完毕! '', 7, 7, 7, 0Ah, 0Dh, 0Ah, 0Dh,''$''
OK_e db 0Ah, 0Dh,'' Congratulations, Boot utility has been Created! '', 0Ah, 0Dh, 0Ah, 0Dh,''$''
OK_c db '' 祝贺: 在软盘引导扇区中已创建引导程序代码!'', 0Ah, 0Dh, 0Ah, 0Dh, ''$''
fdboot proc far
start:
push ds
xor ax,ax
push ax
mov ax,cs
mov ds,ax
mov es,ax
call test_cc
jz Version_cc ; 启动汉字系统转 Version_cc
mov dx,offset Version_e ; 显示程序的英文版本信息
mov ah,09h
int 21h
mov dx,offset Copyright_e ; 显示程序作者的英文信息
mov ah,09h
int 21h
jmp readboot
Version_cc:
mov dx,offset Version_c ; 显示程序的中文版本信息
mov ah,9
int 21h
mov dx,offset Copyright_c ; 显示程序作者的中文信息
mov ah,09h
int 21h
readboot:
mov ax,0201h ; 读 A 驱 0 面 0 道 1 - 1 扇区
mov cx,1
mov bx,offset buffers ; 读取引导扇区内容到内存缓冲区 es:bx
mov dx,00h
int 13h
jc readboot
mov si,bx
mov di,offset Boot
mov cx,1BDh
cld
repe cmpsb ; 判断主引导扇区是否已经被修改
jz short WriteOK ; 已经修改则跳转到 WriteOK
call test_cc
jz Virus_cc
mov dx,offset Virus_e ; 没有被修改,显示英文警告信息
mov ah,9
int 21h
jmp loc_2
Virus_cc:
mov dx,offset Virus_c ; 没有修改,显示中文警告信息
mov ah,9
int 21h
loc_2:
mov di,offset tab
mov si,offset buffers
add si,di
mov cx,42h
rep movsb ; 将修定的引导代码写入引导扇区
mov ax,301h
mov cx,1
mov dx,00h
mov bx,offset Boot
int 13h
call test_cc
jz Writed_cc
mov dx,offset Writed_e ; 显示英文结束信息
mov ah,9
int 21h
jmp loc_3
Writed_cc:
mov dx,offset Writed_c ; 显示中文结束信息
mov ah,9
int 21h
loc_3:
jmp short exit
nop
WriteOK:
call test_cc
jz WriteOK_c
mov dx,offset OK_e ; 显示英文引导代码已写入
mov ah,9
int 21h
jmp exit
WriteOK_c:
mov dx,offset OK_c ; 显示中文引导代码已写入
mov ah,9
int 21h
exit:
mov ah,4Ch
int 21h
test_cc:
mov si,bx
mov byte ptr ds:[si],''0''
mov ax,0db00h
int 2fh
cmp al,0ffh ; 测试是否启动中文系统
jz Ccdos ; 启动中文则转 Ccdos
Test_tw: mov ax,0db10h
int 10h ; 判断启动天汇否
cmp al,0ffh
Ccdos: retn
fdboot endp
segment_av ends
end start
[此贴子已经被作者于2004-1-19 10:24:17编辑过]
|