Я начинаю в системном программировании, но прихожу в неприятную ситуацию.Я не знаю, как запустить процедуру cpp в asm-файле с использованием компиляторов nasm и g ++.
это мой код в asm с именем kernel.asm:
[BITS 32]
EXTERN scrollup, print
global _start
_start :
mov ax , msggdt
push ax
call print
pop ax
mov ax , msggdt32
push ax
call print
pop ax
mov ax , 3
push ax
call scrollup
pop ax
end:
jmp end
msggdt : db "Load gdt",13 , 10,0
msggdt32 : db "Load protected mode",13,10,0
имой файл cpp содержит функции print, scrollup
Я указываю свои версии компиляторов: NASM версии 2.14 и gcc версии 8.2.0 (Debian 8.2.0-21)
g++ -c screen.cpp
screen.cpp: In function ‘void _putcar_(uchar)’:
screen.cpp:63:59: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
video = (unsigned char*) (RAMSCREEN + 2 * kX + 160 * kY ) ;
nasm -f elf64 -o kernel.o kernel.asm
Теперь,Послушай, я пробовал вызов LD 4 раза, не только для изменения порядка объектов, но и для изменения вывода, но там вообще ничего нет
ld --oformat binary -Ttext 1000 screen.o kernel.o -o screen
ld: kernel.o: in function `_start':
kernel.asm:(.text+0x7): undefined reference to `print'
ld: kernel.asm:(.text+0x14): undefined reference to `print'
ld: kernel.asm:(.text+0x21): undefined reference to `scrollup'
ld --oformat binary -Ttext 1000 screen.o kernel.o -o kernel
ld: kernel.o: in function `_start':
kernel.asm:(.text+0x7): undefined reference to `print'
ld: kernel.asm:(.text+0x14): undefined reference to `print'
ld: kernel.asm:(.text+0x21): undefined reference to `scrollup'
ld --oformat binary -Ttext 1000 kernel.o screen.o -o kernel
ld: kernel.o: in function `_start':
kernel.asm:(.text+0x7): undefined reference to `print'
ld: kernel.asm:(.text+0x14): undefined reference to `print'
ld: kernel.asm:(.text+0x21): undefined reference to `scrollup'
ld --oformat binary -Ttext 1000 kernel.o screen.o -o screen
ld: kernel.o: in function `_start':
kernel.asm:(.text+0x7): undefined reference to `print'
ld: kernel.asm:(.text+0x14): undefined reference to `print'
ld: kernel.asm:(.text+0x21): undefined reference to `scrollup'
Пожалуйста, мне нужна помощь.Если я сделал несколько ошибок, извините, дайте мне знать.
Спасибо