小编Key*_*ing的帖子

如果我尝试将其指向标签,为什么x86-assembly(r)中的寄存器会自动移入?

我想写一个bootloader,它只是打印"Hello World!" 在屏幕上,我不知道为什么我的字节混淆了.我正在尝试用AT&T语法编写它(请不要推荐英特尔语法)并尝试将本教程中的代码转换为AT&T语法.

现在这里是我的bootloader的相当短的代码:

start:
.code16         #real mode
.text
.org 0x0
.globl _main
_main:
    movw hello, %si
    movb $0x0e, %ah

loophere:
    lodsb
    or %al, %al     #is al==0 ?
    jz halt         #if previous instruction sets zero flag jump to halt
    int $0x10       #run bios interrupt 0x10 (ah is set to 0x0e so a character is displayed)
    jmp loophere


halt:
    cli
    hlt


hello:  .ascii "Hello world!\0"


filloop:    
    .fill (510-(.-_main)),1,0   #I hope this works. Fill bootloader with 0's until byte 510 …
Run Code Online (Sandbox Code Playgroud)

x86 assembly real-mode gnu-assembler bootloader

4
推荐指数
1
解决办法
201
查看次数

标签 统计

assembly ×1

bootloader ×1

gnu-assembler ×1

real-mode ×1

x86 ×1