🆕 创建了loader.asm

This commit is contained in:
fslongjin 2022-01-17 14:15:26 +08:00
parent 14ea45b62e
commit 51e5a0ffb8
2 changed files with 38 additions and 3 deletions

View File

@ -48,7 +48,7 @@ Label_Start:
mov bx, 0x0700 ;设置白色字体,不闪烁,字体正常亮度,黑色背景
mov cx, 0
mov dx, 0184fh
int 10h
int 0x10
;设置屏幕光标位置为左上角(0,0)的位置
mov ax, 0x0200
@ -60,7 +60,7 @@ Label_Start:
mov ax, 0x1301 ;设置显示字符串,显示后,光标移到字符串末端
mov bx, 0x000a ;设置黑色背景,白色字体,高亮度,不闪烁
mov dx, 0x0000 ;设置游标行列号均为0
mov cx, 24 ;设置字符串长度为20
mov cx, 24 ;设置字符串长度为24
push ax
mov ax, ds
@ -186,7 +186,9 @@ Label_Go_On_Loading_File:
jmp Label_Go_On_Loading_File
Label_File_Loaded:
jmp $
; 跳转到loader
; 这个指令结束后目标段会复制到CS寄存器中
jmp BaseOfLoader:OffsetOfLoader
; 从软盘读取一个扇区

33
bootloader/loader.asm Normal file
View File

@ -0,0 +1,33 @@
; |==================|
; | 这是loader程序 |
; |==================|
; Created by longjin, 2022/01/17
; 由于实模式下物理地址为CS<<4+IP而从boot的定义中直到loader的CS为0x1000 因此loader首地址为0x10000
org 0x10000
mov ax, cs
mov ds, ax ; 初始化数据段寄存器
mov es, ax ; 初始化附加段寄存器
mov ax, 0x00
mov ss, ax ;初始化堆栈段寄存器
mov sp, 0x7c00
;在屏幕上显示 start Loader
mov ax, 0x1301
mov bx, 0x000f
mov dx, 0x0100 ;在第2行显示
mov cx, 23 ;设置消息长度
push ax
mov ax, ds
mov es, ax
pop ax
mov bp, Message_Start_Loader
int 0x10
jmp $
; 要显示的消息文本
Message_Start_Loader: db "[DragonOS] Start Loader"
len_Message_Start_Loader: db 23