您的位置:首页 > 其它

软盘(1.44M)引导区程序源码

2010-06-16 08:44 162 查看
软盘(1.44M)引导区程序源码


答:我有一个BIN文件(引导扇区用),求牛人反汇编成汇编代码

http://tieba.baidu.com/f?kz=789586015



;File Name : boot.com
;代码长度(Bytes): 200h
;

.386
.model tiny

code segment byte public 'CODE' use16
assume cs:code, ds:code
org 100h
;Physical Sector:Cyl 0,Side 0,Sector 1
public start
start proc near
jmp short @13E

nop

db 'MSWIN4.1';OEM ID 制造商
dw 512 ;Bytes per Sector 比特数/扇区
db 1 ;Sectors per cluster 扇区数/簇
dw 1 ;Reserved Sectors at beginning 头部保留扇区数
db 2 ;FAT Copies 文件分配表份数
dw 224 ;Root directory entries 根目录个数
dw 2880 ;Total Sectors on disk 磁盘总扇区数
db 0F0H ;Media descriptor byte 介质描述符
dw 9 ;Sectors per FAT 扇区数/每份分配表
dw 18 ;Sectors per track 扇区数/每簇
dw 2 ;Sides 面数
dd 0 ;Special hidden Sectors 特别隐含扇区数
dd 0 ;(Unused)Big total number of Sectors (未用)大总扇区数
dw 0 ;Physical drive number 物理驱动器数
db 29h ;Extended Boot Record Signature 扩展引导记录标记
dd 1B271AF7h ;Volume Serial Number 卷连续数
db 'PM',9 dup(20h) ;Volume Label 卷标
db 'FAT12' ;File System ID 文件系统标志符
db 3 dup(20h) ;(Unused) 未用

@13E:
xor cx, cx
mov ss, cx
mov sp, 7BFCh
push ss
pop es
mov bp, 78h
lds si, [bp+0]
push ds
push si
push ss
push bp
mov di, 522h
mov [bp+0], di
mov [bp+2], cx
mov cl, 0Bh
cld
rep movsb
push es
pop ds
mov bp, 7C00h
mov byte ptr [di-2], 0Fh
cmp [bp+24h], cl
jge short @18D
mov ax, cx
cwd
call sub_2F1
sub bx, 3Ah
mov eax, ds:7C1Ch

@17A:
cmp eax, [bx]
mov dl, [bx-4]
jnz short @188
or dl, 2
mov [bp+2], dl

@188:
add bl, 10h
jnb short @17A

@18D:
xor cx, cx
inc byte ptr ds:7DD8h

@193:
mov al, [bp+10h]
cbw
mul word ptr [bp+16h]
add ax, [bp+1Ch]
adc dx, [bp+1Eh]
add ax, [bp+0Eh]
adc dx, cx
mov si, [bp+11h]
pusha
mov [bp-4], ax
mov [bp-2], dx
mov ax, 20h
mul si
mov bx, [bp+0Bh]
add ax, bx
dec ax
div bx
add [bp-4], ax
adc [bp-2], cx
popa

@1C3:
mov di, 700h
call sub_2F1
jb short @209

@1CB:
cmp [di], ch
jz short @1E6
pusha
mov cl, 0Bh
mov si, 7DD8h
repe cmpsb
popa
jz short @217
dec si
jz short @1E6
add di, 20h
cmp di, bx
jb short @1CB
jmp short @1C3

@1E6:
dec byte ptr ds:7DD8h
jnp short @193
mov si, 7D7Fh

@1EF:
lodsb
cbw
add si, ax

@1F3:
lodsb
cbw
inc ax
jz short @204
dec ax
jz short @20E
mov ah, 0Eh
mov bx, 7
int 10h ; - VIDEO - 写字符并移动光标 (TTY WRITE)
; AL = 字符, BH = 显示页码 (alpha 模式)
; BL = 字符前景色 (图形模式)
jmp short @1F3

@204:
mov si, 7D82h
jmp short @1EF

@209:
mov si, 7D80h
jmp short @1EF

@20E: ; KEYBOARD -
int 16h
pop si
pop ds
db 66h, 8Fh, 04 ;pop large dword ptr [si]
int 19h ; 系统重启 DISK BOOT
;
@217:
mov si, 7D81h
mov di, [di+1Ah]
lea ax, [di-2]
mov cl, [bp+0Dh]
mul cx
add ax, [bp-4]
adc dx, [bp-2]
mov cl, 4
call sub_2F2
jb short @209
db 0EAh, 0, 2, 70h, 0 ;jmp far ptr 70h:200h
start endp ;
;
@237:
push dx
push ax
push es
push bx
push 1
push 10h
xchg ax, cx
mov ax, [bp+18h]
mov ds:526h, al
xchg ax, si
xchg ax, dx
xor dx, dx
div si
xchg ax, cx
div si
inc dx
xchg cx, dx
div word ptr [bp+1Ah]
mov dh, dl
mov ch, al
ror ah, 2
or cl, ah
mov ax, 201h
cmp byte ptr [bp+2], 0Eh
jnz short @26B
mov ah, 42h
mov si, sp

@26B:
mov dl, [bp+24h]
int 13h ; DISK -
popa
popa
jb short locret_27E
inc ax
jnz short @278
inc dx

@278:
add bx, [bp+0Bh]
dec cx
jnz short @2F5

locret_27E:
retn
;
db 3
;offset 280h
db 18h, 1, 27h
;offset 283h
db 0Dh, 0Ah, 'Invalid system disk',0FFh
db 0Dh, 0Ah, 'Disk I/O error',0FFh
db 0Dh, 0Ah, 'Replace the disk, and then press any key',0Dh,0Ah,0
db 0
;offset 2d8h
db 'IO', 6 dup(20h), 'SYS'
;offset 2e3h
db 'MSDOS', 3 dup(20h), 'SYS'
db 7Fh, 1, 0

sub_2F1 proc near
inc cx
sub_2F1 endp ;

sub_2F2 proc near
mov bx, 700h

@2F5:
pusha
db 66h, 6ah, 0 ;push large 0
jmp @237
sub_2F2 endp

db 2 dup(0), 55h, 0AAh

code ends
end start
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: