无文件系统的u盘启动与文件加载处理程序-boot部分
2014-08-07 00:00
543 查看
摘要: vi编辑与阅读代码,nasm编译文件,dd写映像文件,bochs/真机运行程序
配合loader可以用于载入kernel文件
;bash脚本 [载入loader,loader_pro]
#!/bin/bash
nasm -o boot.bin boot.asm
nasm -I include/ -o loader.bin loader.asm
nasm -o loader_pro.bin loader_pro.asm
cat boot.bin loader.bin loader_pro.bin > j_boot.bin
sudo dd if=boot.bin of=c.img bs=5...
配合loader可以用于载入kernel文件
;bash脚本 [载入loader,loader_pro]
#!/bin/bash
nasm -o boot.bin boot.asm
nasm -I include/ -o loader.bin loader.asm
nasm -o loader_pro.bin loader_pro.asm
cat boot.bin loader.bin loader_pro.bin > j_boot.bin
sudo dd if=boot.bin of=c.img bs=5...
org 07c00h jmp short BOOT_START nop BOOT_START: ;init mov ax,cs mov ds,ax mov es,ax mov ss,ax mov sp,BaseOfStack ;clear screen call cls ;message ->BootMessage [(cs:BootMessage,4,(0,0))] mov ax,cs push ax mov ax,BootMessage push ax mov ax,4 push ax mov ax,0000h push ax call dispstr add sp,8 ;--message end ;test disk xor ax,ax mov ah,41h mov bx,055aah mov dl,80h int 13h ;--test end jc BOOT_ERROR ;message ->pass test [(cs:PassMessage,4,(1,0))] mov ax,cs push ax mov ax,PassMessage push ax mov ax,4 push ax mov ax,0100h push ax call dispstr add sp,8 ;--message end jmp BOOT_LOADER BOOT_ERROR: ;message ->fail test [(cs:ErrorMessage,5,(1,0))] mov ax,cs push ax mov ax,ErrorMessage push ax mov ax,5 push ax mov ax,0100h push ax call dispstr add sp,8 ;--message end jmp $ ;load loader BOOT_LOADER: call cls ;message ->LoadMessage [(cs:LoadMessage,7,(0,0))] mov ax,cs push ax mov ax,LoadMessage push ax mov ax,7 push ax mov ax,0000h push ax call dispstr add sp,8 ;--message end ;readsector [1,100,1000h:0h] mov eax,1 push eax mov ax,100 push ax mov ax,1000h push ax mov ax,0h push ax call readsector add sp,10 ;--end readsector ;jmp to loader jmp 1000h:0000h ;--end jmp jmp $ ;data ->BootData BaseOfStack equ 07c00h BootMessage: db "boot " PassMessage: db "pass " ErrorMessage: db "error " LoadMessage: db "loading" TestMessage: db "test " DAP: PacketSize: db 10h Reserved: db 0 BlockCount: dw 100 BufferAddr_off: dw 0000h BufferAddr_Seg: dw 1000h BlockNum: dq 1 ;--data end ;function ->cls [clean screen] cls: mov ax,0600h mov bx,0700h mov cx,0 mov dx,0184fh int 10h mov ah,02h mov bh,00h mov dx,00h int 10h ret ;--function end ;function ->dispstr(u32 source,u16 lens,u16 (pos_x,pos_y)) [display string] ;[source es:bp 串地址,lens cx 串长度,pos_x dh 行,pos_y dl 列] dispstr: mov ax,sp add sp,2 pop dx pop cx pop ax mov bp,ax pop ax mov es,ax sub sp,10 mov ax,01301h mov bx,0007 int 10h ret ;--function end ;function ->readsector(u32 Blocknum,u16 blockcount,u16 seg,u16 off) ;[Blocknum 起始块数量,blockcount 读取块总数,seg:off 缓存区地址] readsector: add sp,2 pop ax mov [DAP+4],ax pop ax mov [DAP+6],ax pop ax mov [DAP+2],ax pop eax mov [DAP+8],eax sub sp,12 mov ax,0 mov ds,ax mov ax,DAP mov si,ax mov dl,80h mov ah,42h int 13h ret ;--function end times 200h-2-($-$$) db 0 dw 0xaa55
相关文章推荐
- 关于请求的内容似乎是脚本,因而将无法由静态文件处理程序来处理。系统X64 IIS找不到 将“启动32位应用程序”改为“true”
- S3C6410 启动u-boot 加载内核和文件系统
- u-boot 使用 jffs2 文件系统加载内核 备忘
- 基于嵌入式系统中的OS 启动加载程序
- Linux系统启动引导程序配置文件解析
- 基于嵌入式系统中的 OS 启动加载程序
- Windows Mobile 启动自带程序处理文件
- VS2008 无法启动程序 系统找不到指定的文件
- 3种使用不同根文件系统 u-boot传递的内核启动参数
- 【windows】将程序启动加载到系统服务
- 由于使用了一个未经验证的清除垃圾文件的程序,导致Oracle数据库无法接(能启动),系统报错:
- 配置节处理程序时出错,未能加载文件或程序集
- 系统启动文件BOOT.INI说明
- Linux系统启动引导程序配置文件解析
- 为单位领导远程制作u盘启动pe恢复系统中毒后桌面文件
- 系统启动引导文件BOOT.InI详细解读
- 如何使Object Arx.Net 程序随ACAD系统启动加载?
- Linux 系统启动过程(initrd部分) --- Linux boot process (initrd part)
- 双系统启动boot.ini文件的秘密
- Linux加载ntfs、fat32分区、光驱、U盘 FAT32文件系统的分区的加载(转http://hi.baidu.com/hzyhome/blog/item/6b8ef080ed67d9d69023d936.html)