0

So I have a bootloader (boot.asm) and a kernel (kernel.cpp)

I have "extern kernel_main" in the assembly code When I run nasm.exe -f bin boot.asm -o boot.obj It will say "binary output format does not support external refrences" But when I run nasm.exe -f win64 boot.asm -o boot.obj it will work but after running the linker ~\tdm-gcc64\C++.exe -T linker.ld -o Boot.img -ffreestanding -nostdlib boot.obj kernel.obj -lgcc it will have junk like:"This program cannot be run in DOS mode" I have searched all over the internet and cannot find out how to export from nasm so it will play nice with gcc. Any help will be appreciated. I'm using 64 bit windows 10 home with nasm, gcc, and qemu Edit: I also need to know how to set the origin to 0x7c00 as org 0x7c00 doesn't work when compiling as an object

  • See also https://stackoverflow.com/questions/2120297/develop-a-bootloader-in-assembly – vitsoft May 08 '20 at 11:14
  • Thank you for the response. I have the bootloader set up where it can load from disk a slightly more complicated bootloader that goes into long mode but I can't load the kernel. I have programmed a simple kernel in c++ so I can't just include it. The problem is I can't export the nasm assembly code to an object without it messing with it. – Mitchel Coles May 08 '20 at 15:54
  • I fixed the adding extra windows junk by using the command objcopy -O binary .text boot.out boot.bin but now the kernel section of code has a problem. The initialize terminal works and clears the screen but then the writestring function doesn't seem to do anything. – Mitchel Coles May 19 '20 at 22:40

0 Answers0