侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

自制操作系统4

2023-11-07 星期二 / 0 评论 / 0 点赞 / 60 阅读 / 2375 字

让我们直接对显示器说点什么吧 在上几节中,我们使用的BIOS的中断向量表来进行字符的输出,现在我们直接使用显存对显示器说点什么吧 编写mbr_3.S ;主引导程序;------------------

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

在上几节中,我们使用的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=notrunc1+0 records in1+0 records out512 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 themachine that you want to simulate.  Bochs has already searched for aconfiguration file (typically called bochsrc.txt) and loaded it if itcould be found.  When you are satisfied with the configuration, goahead and start the simulation.You can also start bochs with the -q option to skip these menus.1. Restore factory default configuration2. Read options from...3. Edit options4. Save options to...5. Restore the Bochs state from...6. Begin simulation7. Quit nowPlease choose one: [6] 

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

 

广告 广告

评论区