自制操作系统4

让我们直接对显示器说点什么吧

在上几节中,我们使用的BIOS的中断向量表来进行字符的输出,现在我们直接使用显存对显示器说点什么吧

编写mbr_3.S

;主引导程序
;--------------------------------------------------------------------
SECTION MBR vstart=0x7c00
	mov ax,cs
	mov ds,ax
	mov	es,ax
	mov ss,ax
	mov fs,ax
	mov sp,0x7c00
	mov ax,0xb800
	mov gs,ax
;--------------------------------------------------------------------
	mov ax,0600h
	mov bx,0700h
	mov cx,0
	mov dx,184fh
	int 10h
	mov byte [gs:0x00],'1'
	mov byte [gs:0x01],0xA4

	mov byte [gs:0x02],' '
	mov byte [gs:0x03],0xA4

	mov byte [gs:0x04],'M'
	mov byte [gs:0x05],0xA4

	mov byte [gs:0x06],'B'
	mov byte [gs:0x07],0xA4

	mov byte [gs:0x08],'R'
	mov byte [gs:0x09],0xA4

	jmp $

	times 510-($-$$) db 0
	db 0x55,0xaa

[root@makeOS software]# nasm -o mbr.bin mbr_3.S
[root@makeOS software]# dd if=./mbr.bin \
> of=bochs/hd60M.img \
> bs=512 count=1 conv=notrunc
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.0317031 s, 16.1 kB/s
[root@makeOS bochs]# bin/bochs -f bochsrc.disk 
========================================================================
                       Bochs x86 Emulator 2.6.2
                Built from SVN snapshot on May 26, 2013
                  Compiled on May 25 2017 at 21:59:04
========================================================================
00000000000i[     ] reading configuration from bochsrc.disk
------------------------------
Bochs Configuration: Main Menu
------------------------------

This is the Bochs Configuration Interface, where you can describe the
machine that you want to simulate.  Bochs has already searched for a
configuration file (typically called bochsrc.txt) and loaded it if it
could be found.  When you are satisfied with the configuration, go
ahead and start the simulation.

You can also start bochs with the -q option to skip these menus.

1. Restore factory default configuration
2. Read options from...
3. Edit options
4. Save options to...
5. Restore the Bochs state from...
6. Begin simulation
7. Quit now

Please choose one: [6] 

这里我们启动之后,就能看到在屏幕的左上角有1MBR闪烁的样子

230031_ZJoP_3424826.png

 

转载于:https://my.oschina.net/u/3424826/blog/915870

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值