我正在编写小型操作系统 - 用于练习.我从bootloader开始.
我想创建一个以16位实模式运行的小命令系统(现在).
我创建了重置驱动器的bootloader,然后在bootloader之后加载扇区.
问题是因为jmp功能后没有任何实际发生.
我不想尝试在0x7E00加载下一个扇区(我不完全确定如何使用es:bx指向地址,这可能是一个问题,我相信它的地址:偏移),就在引导加载程序之后.
这是代码:
;
; SECTOR 0x0
;
;dl is number of harddrive where is bootloader
org 0x7C00
bits 16
;reset hard drive
xor ah,ah
int 0x13
;read sectors
clc
mov bx,0x7E00
mov es,bx
xor bx,bx
mov ah,0x02 ;function
mov al,0x1 ;sectors to read
mov ch,0x0 ;tracks
mov cl,0x1 ;sector
mov dh,0x0 ;head
int 0x13
;if not readed jmp to error
jc error
;jump to 0x7E00 - executed only if loaded
jmp 0x7E00 …Run Code Online (Sandbox Code Playgroud) 通过Ralph Brown的中断列表,我发现有许多不同的方法可以将文本字符输出到屏幕上.
ROM BIOS API提供以下功能:
DOS API提供以下功能:
这些功能有什么作用?我怎么称呼他们?我如何在它们之间做出选择?
我一直在用头撞墙,试图理解为什么以下程序集没有正确转储“HELLO_WORLD”的内容。
; Explicitly set 16-bit
[ BITS 16 ]
[ ORG 0x7C00 ]
; Create label for hello world string terminated by null.
HELLO_WORLD db 'hello world', 0
start:
; Move address of HELLO_WORLD into si
mov SI, HELLO_WORLD
call print_string
; Continue until the end of time
jmp $
print_string:
loop:
; Retrieve value stored in address at si
mov al, [SI]
mov ah, 0x0E
cmp al, 0
; Finish execution after hitting null terminator
je return …Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个引导扇区,将字符串打印到屏幕上。我正在使用 nasm。我的教程说,当调用 int 10h 时,您已将值 07h 放入 bl 中。这是文本的颜色。我尝试将 bl 的值更改为 08h 但它没有打印任何内容!所以我尝试将其更改为06h,但仍然没有任何结果!是否可以使用 bl 中的值更改颜色?如果是这样,什么值与什么颜色相匹配?
如果我更改 ah 中的值,int 10h 会执行其他操作(例如将文本扫描到 al 中)吗?