问题
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