label inconsitently redefined NASM

别来无恙 提交于 2021-02-10 17:46:35

问题


i have been following a YouTube tutorial on how to make an operating system, as well as experimenting with writing assembly code my self. I use NASM to turn my assembly files into executable binaries, and use qemu to run them.

-=-=-=-=-=

boot.asm

[org 0x7c00]

mov [BOOT_DISK], dl

mov bp, 0x7c00
mov sp, bp

mov bx, tst
call pst
call readisk

%include 'print.asm'
%include 'diskread.asm'

jmp $
times 510-($-$$) db 0
db 0x55, 0xaa

-=-=-=-=-=

diskread.asm

PROGRAM_SPAVE equ 0x7e00

readisk:
    mov bx, PROGRAM_SPACE
    mov al, 4
    mov dl, [BOOT_DISK]
    mov ch, 0x00
    mov dh, 0x00
    mov cl, 0x02

    int 0x13
    
    jc diskreadfail

    ret

BOOT_DISK:
    db 0

diskreaderr:
    db 'Failed to read the disk!',0

diskreadfail:
    mov dx, diskreaderr
    %include 'print.asm'
    call printstring
    
    jmp $

-=-=-=-=-=

print.asm

printstring:    
    mov ah, 0x0e
    .looper:
    cmp [bx], byte 0
    je .exit
        mov al, [bx]
        int 0x10
        inc bx
        jmp .looper
    .exit:
    ret
teststring:
    db 'Hello, World!',0

I get a few errors while trying to convert. I am not sure how i 'define the same label more than once to different values.'

source: fossies.org/linux/nasm/asm/labels.c line 523

print.asm:1: error: label `printstring' inconsistently redefined
print.asm:1: note: label `printstring' originally defined here
print.asm:3: error: label `printstring.looper' inconsistently redefined
print.asm:3: note: label `printstring.looper' originally defined here
print.asm:10: error: label `printstring.exite' inconsistently redefined
print.asm:10: note: label `printstring.exite' originally defined here
print.asm:12: error: label `teststring' inconsistently redefined
print.asm:12: note: label `teststring' originally defined here

来源:https://stackoverflow.com/questions/64860117/label-inconsitently-redefined-nasm

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!