fasm完成一个简单的FAT12的镜像文件
来源:互联网 发布:淘宝星店怎么申请 编辑:程序博客网 时间:2024/05/21 10:25
fasm完成一个简单的FAT12的镜像文件,方便裸机编程,以自己动手写操作系统的FAT12布局为例。
;-----------------------------------------------------------------------;--===-- 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 | ;|______________________________________________________________________| ;-----------------------------------------------------------------------;BootSector;-----------------------------------------------------------------------file 'myboot.bin' ;0号扇区 512Byte;-----------------------------------------------------------------------;FAT table 1;-----------------------------------------------------------------------FATEntry:db 00h,00h,00h,0ffh,0fh ;有效位 奇:0ffh,0fh 偶:0f0h,0ffhFATEntrySize = $-FATEntrydb 9*512-FATEntrySize dup(0) ;FAT1 01~09号扇区;-----------------------------------------------------------------------;FAT table 2;-----------------------------------------------------------------------db 00h,00h,00h,0ffh,0fhdb 9*512-FATEntrySize dup(0) ;FAT2 10~18号扇区;-----------------------------------------------------------------------;Root Directory;-----------------------------------------------------------------------RootDir: ;19号扇区 .Name db "LOADER BIN" .Attr db 20h .Reserved db 0,0,0,0,0,0,0,0,0,0 .WrtTime dw 7a5bh .WrtDate dw 3185h .FstClus dw 0002h ;开始簇号2 (对应FAT table 1的第3字节处) .FileSize dd 0000000fh ;loader.bin文件大小RootDirSize =$-RootDir ;32 Bytedb 14*512-RootDirSize dup(0);-----------------------------------------------------------------------;Data Region;-----------------------------------------------------------------------LOADER:file 'loader.bin' ;34号扇区LOADERSIZE = $-LOADERdb (2880-1-9-9-14)*512 -LOADERSIZE dup (0);-----------------------------------------------------------------------
效果(日期随便设置一下):
vmware加载效果:
升级一下:
;-----------------------------------------------------------------------;--===-- 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 'boot.bin' ;0号扇区 512Byte;-----------------------------------------------------------------------;FAT table 1;-----------------------------------------------------------------------FATEntry:db 00h,00h,00h,0ffh,0fh ;有效位 奇:0ffh,0fh 偶:0f0h,0ffhFATEntrySize = $-FATEntrydb 9*512-FATEntrySize dup(0) ;FAT1 01~09号扇区;-----------------------------------------------------------------------;FAT table 2;-----------------------------------------------------------------------db 00h,00h,00h,0ffh,0fhdb 9*512-FATEntrySize dup(0) ;FAT2 10~18号扇区;-----------------------------------------------------------------------;Root Directory;-----------------------------------------------------------------------RootDir: ;19号扇区 .Name db "EXAMPLE COM" .Attr db 20h .Reserved db 0,0,0,0,0,0,0,0,0,0 .WrtTime _TIME <15:56:12> .WrtDate _DATA <2011,10,26> .FstClus dw 0002h ;开始簇号2 (对应FAT table 1的第3字节处) .FileSize dd LOADERSIZE ;loader.bin文件大小RootDirSize =$-RootDir ;32 Bytedb 14*512-RootDirSize dup(0);-----------------------------------------------------------------------;Data Region;-----------------------------------------------------------------------LOADER:file 'loader.bin' ;33号扇区LOADERSIZE = $-LOADERdb (2880-1-9-9-14)*512 -LOADERSIZE dup (0);-----------------------------------------------------------------------
再升级一下:
;-----------------------------------------------------------------------;--===-- 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;占用扇区7db 00h,00h,00h,03h,40h,00h,05h,60h,00h,0ffh,0ffh,0ffhFATEntrySize = $-FATEntry1db 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+%-1end repeatdb 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 LOADERSIZE1RootDir2: ;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,6LOADERSIZE1 = $-LOADER1LOADER2:file 'EXAMPLE1.X3D' ; *号扇区 ;69字节 扇区7LOADERSIZE2 = $-LOADER2db (2880-1-18-14)*512 -($-LOADER1) dup (0);-----------------------------------------------------------------------
- fasm完成一个简单的FAT12的镜像文件
- 简单的窗体透明示例 fasm 汇编
- 适于fasm的DirectDraw头文件定义
- 一个小脚本---拷贝编译完成的镜像
- FAT12中,如何定位大于一个扇区(512B)的文件内容
- 一个用FASM写的Win32小程序
- Pyos 支持的 FAT12 文件系统~~~~
- FAT12格式的引导程序
- 对FAT12文件系统的理解
- 完成端口的一个简单封装类
- 用Ajax完成一个简单的验证
- 完成端口的一个简单封装类
- 一个简单的完成端口类
- Ajax完成一个简单的HelloWorld程序
- Apache+花生壳完成一个简单的网站
- 用Scroller完成一个简单的ViewPager
- 使用AngularJS完成一个简单的todoList
- 将一个很大的ISO镜像文件分割成单独的两个镜像
- 在大学的日子
- 《C陷阱与缺陷》 第一章 词法“陷阱”
- 素数的另一编法
- Servlet会话跟踪技术
- 网页图片放大镜
- fasm完成一个简单的FAT12的镜像文件
- 实现Serializable接口的可控制序列化实现
- 实现JFileChooser选择多文件放入JTable中,然后删除鼠标指定的行
- Android Widget开发的相关技术点记录
- Arrays - 判断两个数组是否一致 以及常用的判断
- 高精度四则运算---加减
- ceo的每天都要做13件事情
- 找最小的K个数
- 10.24仿京东网页开发日程