您的位置:首页 > 编程语言

代码着色测试

2011-11-01 10:58 204 查看
代码着色测试

;-----------------------------------------------------------------------

;--===-- FAT12 image file make By G-Spider

;--===-- fasm startOS.asm startOS.img

;-----------------------------------------------------------------------

; here is map of how the FAT12 system is laid out

;|----------------------------------------------------------------------|

;|BootSector| FAT table 1| FAT table 2 | Root Directory| Data Region |

;|512 bytes | 4,608 bytes| 4,608 bytes | 7,168 bytes | 1,457,664 bytes|

;|1 sector | 9 sectors | 9 sectors | 14 sectors | 2,847 sectors |

;|______________________________________________________________________|

struc _DATA
def

{

match d1=,d2=,d3,def

\{

.Data
dw ((d1-1980)
shl 9)
or ((d2
and 0fh)
shl 5) or
(d3 and
1fh)

\}

}

struc _TIME
def

{

match d1:d2:d3,def

\{

.Data
dw (d1
shl 11)
or ((d2
and 3fh)
shl 5) or
((d3 and
0fh)
shr 1)

\}

}

;-----------------------------------------------------------------------

;BootSector

;-----------------------------------------------------------------------

file 'BOOTER.SYS' ;0号扇区 512Byte

;-----------------------------------------------------------------------

;FAT table 1

;-----------------------------------------------------------------------

FATEntry1:

;db 00h,00h,00h,0ffh,0fh ;有效位 奇:0ffh,0fh 偶:0f0h,0ffh

;占用5个扇区2,3,4,5,6

;占用扇区7

db 00h,00h,00h,03h,40h,00h,05h,60h,00h,0ffh,0ffh,0ffh

FATEntrySize =
$-FATEntry1

db 9*512-FATEntrySize
dup (0) ;FAT1 01~09号扇区

;-----------------------------------------------------------------------

;FAT table 2

;-----------------------------------------------------------------------

FATEntry2: rb
FATEntrySize

repeat FATEntrySize

load a
byte from
FATEntry1+%-1

store byte
a at FATEntry2+%-1

end repeat

db 9*512-FATEntrySize
dup (0) ;FAT1 10~18号扇区

;-----------------------------------------------------------------------

;Root Directory 根目录

;-----------------------------------------------------------------------

RootDir1: ;19号扇区

.Name db
"SYSTEM SYS"

.Attr db
20h

.Reserved db
0,0,0,0,0,0,0,0,0,0

.WrtTime _TIME
<21:06:12>

.WrtDate _DATA
<2011,10,27>

.FstClus dw
0002h ;开始簇号2 (对应FAT table 1的第3字节处)

.FileSize dd
LOADERSIZE1

RootDir2: ;19号扇区

.Name db
"EXAMPLE1X3D"

.Attr db
20h

.Reserved db
0,0,0,0,0,0,0,0,0,0

.WrtTime _TIME
<21:06:12>

.WrtDate _DATA
<2011,10,27>

.FstClus dw
0007h ;开始簇号7

.FileSize dd
LOADERSIZE2

db 14*512-($-RootDir1)
dup (0)

;-----------------------------------------------------------------------

;Data Region

;-----------------------------------------------------------------------

LOADER1:

file 'SYSTEM.SYS' ;33号扇区 ;2347字节 占用5个扇区2,3,4,5,6

LOADERSIZE1 =
$-LOADER1

LOADER2:

file 'EXAMPLE1.X3D' ; *号扇区 ;69字节 扇区7

LOADERSIZE2 =
$-LOADER2

db (2880-1-18-14)*512-($-LOADER1)
dup (0)

;-----------------------------------------------------------------------

效果图:



图2:



图3:

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