📄 boot1.asm
字号:
;Copyright 2004, Thejesh AP ,ALL rights reserved.
;______________________________________________________________________________________________;
; ;
; FAT-32 boot sector as per Microsoft specification. ;
;______________________________________________________________________________________________;
code_seg segment use16
assume cs:code_seg
jmp start
BS_OEMName db 'JAZMYN.1' ;Not required by Microsoft Os`s,but some FAT drivers need this
BPB_BytesPerSec dw 512 ;bytes/sector = 512
BPB_SecPerClus db 8 ;sect/clust = 4;1clust = 2k
BPB_RsvSecCnt dw 32 ;# reserved sect in reserved region
BPB_NumFats db 1 ;# FAT copies is 2
BPB_RootEntCnt dw 0 ;for FAT12/16,this contains count of 32byte root dir entries
BPB_TotSec16 dw 0 ;old 16-bit total cnt of sectors.Not used in FAT32
BPB_Media db 0F8h ;Media type : fixed non removable media
BPB_FATSz16 dw 0 ;# sectors occupied by FAT12/16
BPB_SecPerTrk dw 63 ;sectors/track = 63 for int 0x13
BPB_NumHeads dw 16 ;heads/cylindr=16/128 for int 0x13
BPB_HiddSec dd ? ;# hidden secs preceding partition
BPB_TotSec32 dd 20097 ;32bit cnt of # sectors
BPB_FATSz32 dd 20 ;# sectors occupied by one FAT
BPB_ExtFlags dw 0 ;flags
BPB_FSVer dw 0 ;fs version 0:0
BPB_RootClus dd 2 ;cluster no of the first cluster of root dir
BPB_FSInfo dw 1 ;sect no of FSINFO struct in reserved area
BPB_BkBootSec dw 6 ;sect no of copy of boot record
BPB_Reserved db 12 dup(0) ;reserved by Microsoft for future expansion
BS_DrvNum db 80h ;BIOS drive number 0x80 for HD
BS_Reserved1 db 0 ;reserved,used by Windows NT
BS_BootSig db 29h ;extended boot signature
BS_VolID dd ? ;vol id - generated by combining curr date & time
BS_VolLab db 11 dup(0) ;volume label set by format prog
BS_FileSysType db 'FAT32 ' ;fs type
Jaz_No386M db 'Sorry. Jazmyn needs atleast 386',13,10,'Press a key to reboot',0
Jaz_Loading db 'Loading Jazmyn....',0
Boot_Part db 4
display proc near ;procedure : displays strings
prnt:
lodsb ;loads ds:si to al
or al,al
jz over
mov ah,0Eh ;function
mov bh,0 ;page no 0
int 10h
jmp prnt
over:
ret
display endp
check_cpu proc near ;procedure : checks for 386 CPU if 386 then al=1 else al=0
pushf ;save flags
xor ah,ah ;check for 86
push ax
popf
pushf
pop ax
and ah,0f0h
cmp ah,0f0h ;86 sets high nibble of flag register to 0xF
je no386
mov ah,0f0h ;check for 286
push ax
popf
pushf
pop ax
and ah,0f0h ;286 sets high nibble of flag register to 0
jz no386
popf
mov al,1
jmp over
no386:
popf
mov al,0
over:
ret
check_cpu endp
key macro
mov ah,0
int 16h
endm
start:
mov ax,07C0h
mov ds,ax
cli ;setup boot stack
mov ax,1000h
mov ss,ax
mov sp,0ffffh
sti
mov si,offset Jaz_Loading ;display start message
call display
call check_cpu ;check for a 386
.if al == 0
mov si,offset Jaz_No386M
key
jmp reboot
.endif
db 0eah
dw 0000h
dw 0100h
reboot:
db 0eah
dw 0000h
dw 0ffffh
org 510
dw 0aa55h
dd 41615252h
org 1024
code_seg ends
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -