1.6:系统启动-实验操作

《冬夜读书示子聿》
(南宋)陆游
古人学问无遗力,少壮工夫老始成。
纸上得来终觉浅,绝知此事要躬行。

实验目的:

能对启动进行相应的控制,加深对启动的过程的深入认识

实验内容:

1)修改启动显示内容,能在屏幕上打印一段提示信息“XXX is booting…”,其中 XXX 是你给自己的操作系统起的名字
2)改写 setup.s 主要完成如下功能:
bootsect.s 能完成 setup.s 的载入,并跳转到 setup.s 开始地址执行。而 setup.s 向屏幕输出一行"Now we are in SETUP"。

实验步骤:

1)修改启动显示内容,能在屏幕上打印一段提示信息“XXX is booting…”,其中 XXX 是你给自己的操作系统起的名字

代码修改如下:
1.修改字符串
2.修改需要显示的字符串长度

shiyanlou@fa07fb9ea8cd:~/oslab/oslab/linux-0.11$ git diff boot/bootsect.s 
diff --git a/boot/bootsect.s b/boot/bootsect.s
index 15307f8..d9c6099 100644
--- a/boot/bootsect.s
+++ b/boot/bootsect.s
@@ -95,7 +95,7 @@ ok_load_setup:
        xor     bh,bh
        int     0x10
        
-       mov     cx,#24
+       mov     cx,#26
        mov     bx,#0x0007              ! page 0, attribute 7 (normal)
        mov     bp,#msg1
        mov     ax,#0x1301              ! write string, move cursor
@@ -243,7 +243,7 @@ sectors:
 
 msg1:
        .byte 13,10
-       .ascii "Loading system ..."
+       .ascii "xiang is booting ..."
        .byte 13,10,13,10
 
 .org 508

2)改写 setup.s 主要完成如下功能:

bootsect.s 能完成 setup.s 的载入,并跳转到 setup.s 开始地址执行。而 setup.s 向屏幕输出一行"Now we are in SETUP"。

代码修改如下:
按照上面的打印写一段代码即可

diff --git a/boot/setup.s b/boot/setup.s
index 851c356..1207644 100644
--- a/boot/setup.s
+++ b/boot/setup.s
@@ -30,6 +30,22 @@ begbss:
 entry start
 start:
 
+! Print some inane message
+
+       mov     ax,#SETUPSEG
+       mov     es,ax
+
+
+        mov     ah,#0x03                ! read cursor pos
+        xor     bh,bh
+        int     0x10
+
+        mov     cx,#25
+        mov     bx,#0x0007              ! page 0, attribute 7 (normal)
+        mov     bp,#msg1
+        mov     ax,#0x1301              ! write string, move cursor
+        int     0x10
+
 ! ok, the read went well so we get current cursor position and save it for
 ! posterity.
@@ -39,6 +55,7 @@ start:
        xor     bh,bh
        int     0x10            ! save it in known place, con_init fetches
        mov     [0],dx          ! it from 0x90000.
+
 ! Get memory size (extended mem, kB)
 
        mov     ah,#0x88
@@ -221,6 +238,11 @@ gdt_48:
        .word   0x800           ! gdt limit=2048, 256 GDT entries
        .word   512+gdt,0x9     ! gdt base = 0X9xxxx
        
+msg1:
+        .byte 13,10
+        .ascii "Now we are in SETUP"
+        .byte 13,10,13,10
+
 .text
 endtext:
 .data
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值