Implementing global and extern instructions in assembly seem not to work
I'm currently creating a bootloader in assembly, but calling or jumping into a label from another file brought no errors, but having wrong output
Making use of %include <path/to/directory>
works fine, but I also need to make use of the call instruction too
Here's what I tried:
I had to reduce the code to minimal
#start.asm
[bits 16]
global _start
extern printc
_start:
mov ah, 0x0e
mov al, "H"
call printc
jmp $
times 510 - ($-$$) db 0
dw 0xaa55
#print.asm:
[bits 16]
global printc
printc:
int 0x10
ret
I compile it using:
nasm -f elf64 start.asm -o start.o nasm -f elf64 print.asm -o print.o
ld -s -Ttext=0x7c00 start.o print.o -o printer.elf
objcopy -O binary printer.elf printer.bin
and I used the qemu emulator qemu-system-x86_64 -drive format=raw,file=printer.bin
And the output is:
Booting from Hard Disk...
_
what am I not getting right?