小编Tha*_*red的帖子

为什么无法从 .data 节加载我的 HELLO_WORLD 字符串?

我正在制作引导加载程序,作为学习汇编的一种方式。我已经研究过使用部分来组织和优化我的代码,但是当我调用 printf 函数时,一件事不起作用。当我在 .data 部分中有 HELLO_WORLD 字符串时,它根本不想加载该字符串

; Set Code to run at 0x7c00
org 0x7c00
; Put into real mode
bits 16 

; Variables without values
section .bss

; Our constant values
section .data
    HELLO_WORLD: db 'Hello World!', 0

; Where our code runs
section .text
    _start:
        mov si, HELLO_WORLD ; Moves address for string into si register
        call printf ; Calls printf function
        jmp $ ; Jump forever
        
    printf:
        lodsb ; Load the next character
        cmp al, 0 …
Run Code Online (Sandbox Code Playgroud)

assembly nasm bootloader x86-16

6
推荐指数
1
解决办法
167
查看次数

标签 统计

assembly ×1

bootloader ×1

nasm ×1

x86-16 ×1