hello世界以真实的模式

问题描述 投票:0回答:1
这个是

boot.asm

文件:

format binary org 0x7C00 ; Bootloader loaded at 0x7C00 start: ; Set up segment registers mov ax, cs mov ds, ax mov es, ax ; Set up stack mov ax, 0x0000 mov ss, ax mov sp, 0x7C00 ; Print message using BIOS interrupt mov si, msg print_loop: lodsb ; Load next character test al, al jz halt ; Jump if null terminator mov ah, 0x0E ; BIOS teletype function int 0x10 ; Call BIOS jmp print_loop halt: cli ; Disable interrupts hlt ; Halt processor msg db "Hello, World!", 0 times 510 - ($-$$) db 0 ; Pad to 510 bytes dw 0xAA55 ; Boot signature

这是makefile:

# Makefile for FreeBSD bootloader example ASM = fasm QEMU = qemu-system-i386 TARGET = boot.bin SOURCE = boot.asm all: $(TARGET) $(TARGET): $(SOURCE) $(ASM) $(SOURCE) $(TARGET) run: $(TARGET) $(QEMU) -fda boot.bin -serial stdio -display none clean: rm -f $(TARGET)
当我组装文件并通过qemu运行时,这就是我得到的:

$ make fasm boot.asm boot.bin flat assembler version 1.73.32 (16384 kilobytes memory) 2 passes, 512 bytes. $ make run qemu-system-i386 -fda boot.bin -serial stdio -display none WARNING: Image format was not specified for 'boot.bin' and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the 'raw' format explicitly to remove the restrictions.
一些问题:

我期望-Serial STDIO从样本引导程序显示的消息中捕获输出,但没有显示消息。
我如何指定QEMU的文件格式,因此不再显示警告。

    对于问题(1),您将输出打印到屏幕上,而不是串行控制台。 因此,很明显,在串行控制台上没有产生输出。 如果要输出出现在串行控制台上,请使用Service INT 14H/AH = 01H发送字符。 或使用
  1. -display curses
  2. 在控制台上显示视频输出。
  3. 为问题(2),使用
  4. -drive format=raw,file=boot.bin,if=floppy
而不是
assembly x86 x86-16 qemu fasm
1个回答
0
投票


最新问题
© www.soinside.com 2019 - 2025. All rights reserved.