显示文字无间断 [英] Displaying text without interrupts

查看:88
本文介绍了显示文字无间断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作自己的引导加载程序.从16位模式更改为32位模式时,由于不会有任何中断,因此我将无法使用int 10h.

I am trying to make my own boot-loader. As I will not have any interrupts when I change from 16bit to 32 bit mode, I will not be able to use int 10h.

这是我到目前为止的代码:

Here is the code I have so far:

org 0x7c00            ; add to offsets
xor ax, ax            ; make it zero
mov ds, ax            ; ds=0
mov ss, ax            ; stack starts at 0

cld

mov ax, 0xb800        ; Ax = address of video memory
mov es, ax
xor di, di
call print            ; call thr print function

hang:
   jmp hang           ; constanly loop

print:
  mov si, msg         ; load msg into si
  mov cx, 4
  mov ah, 07h

printchar:
  lodsb               ; Hear we load a letter from si
  stosw
  loop printchar      ; if not end of msg, go back to printchar
  ret                 ; return

msg    db    'test'   ; msg = 'test'

times 510-($-$$) db 0 ; make sure file is 510 bytes in size
dw 0xaa55             ; write boot signiture

并使用nasm进行编译:

And compiled with nasm:

nasm -f bin bootloader.asm -o myos.hdd

我已经在我所理解的行中添加了评论.我不了解视频存储器的使用情况.有人可以向我解释一下,然后告诉我在哪里可以找到文档吗?

I have put comments in the lines I understand. What I don't understand is the usage of the video memory. Could someone explain this to me and show me where to find the documentation?

我已经搜索了互联网,但是找不到文档.

I have searched the internet but cannot find the documentation.

推荐答案

我想我现在明白了.

mov cx, 4是消息的长度. 测试"长四个字节.

mov cx, 4 is the length of the message. "test" is four bytes long.

mov ah, 07h正在设置颜色数据. 0 =黑色,7 =浅灰色.
第一个数字是背景色,第二个数字是文本色.
这意味着要打印的字符在黑色背景上将为浅灰色.

mov ah, 07h is setting the colour data. 0 = black, 7 = light grey.
First number is the background colour, second number is the text colour.
This means that the character to be printed will be light grey on a black background.

感谢所有提供帮助的人.

Thank you to everyone who helped.

这篇关于显示文字无间断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆