用户:
颜云墨yanyunmo0313查看:18 回复:6 评论:18 创建时间:2023-11-22T20:35:03
召集会汇编、C++的高手写程序 个人的号:http://afdian.net/a/Csharp 程序名:IGXOS 进度:写好UEFI(汇编),硬件驱动(汇编),启动第一阶段(C++) 用VScode编写
颜云墨yanyunmo0313; 定义引导加载器的入口点 ,UEFI
[BITS 16]
[ORG 0x7c00]
start:
; 打印字符串
mov ax, cs
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
mov sp, 0x9000
mov si, msg
call print_string
; 加载驱动程序
mov dl, 0x80
call load_driver
; 启动操作系统
load_driver:
system Hard_driver.a喵; 在此处实现加载驱动程序的代码
ret
section .data
message db 'UEFI start', 0xa ; 定义字符串常量并添加换行符
section .text
global _start
_start:
; 输出字符串到屏幕
mov eax, 4 ; 系统调用号(sys_write)
mov ebx, 1 ; 文件描述符(stdout)
mov ecx, message ; 要输出的字符串
mov edx, 10 ; 字符串长度
int 0x80 ; 调用内核
; 退出程序
mov eax, 1 ; 系统调用号(sys_exit)
xor ebx, ebx ; 返回码(0)
int 0x80 ; 调用内核
jmp 0x1000 : 0x1000 ; 假设操作系统位于 0x1000:0x0000 处
print_string:
lod喵
cmp al, 0
je done
mov ah, 0x0e ; BIOS中断10h的输出功能
int 0x10
jmp print_string
done:
ret
UEFI的代码
点赞0
评论