Good afternoon, everyone.
I have decided to start doing tons of research and work in regards to a operating system. I know, major undertaking, but I am familiar with C/C++ and wanted to learn ASM finally.
My question is quite simple: How in the world do I print to the screen without the BIOS or syscall?!?!?! I've been to like a million different websites searching specifically for 64-bit ASM and 64-bit MBR source code and everything I have found and tried simply doesn't work.
Now, I know y'all are going to need to see my code, but I'm not entirely comfortable putting a whole lot of it up right now. So, I'm going to do my best to explain how I got to the snippet in question and what is meant to happen after the snippet...
So, I set ORG 0x7c00 and tell NASM I need this part of my MBR to run in 16-bit mode. Then I ensure that I am loading at 0x7c00 instead of 0x7c00:0x0000. Then I clear out all the registers in 16-bit mode.
Here is the snippet that I am having trouble with:
BITS 64 ; We are now switching the processor over to long mode. YAY! Progress. Personal joke.
mov rax, 1
mov rdi, 1
mov rsi, msg
mov rdx, msglen
msg: db 'Blah blah blah.',10
msglen: equ $ - msg
Now, after that is just the standard first 512b of padding and the boot signature at the end of the sector.
I have tried writing the 64-bit snippet with BIOS calls and got nowhere. I tried writing it with syscall and obviously that got me nowhere. I tried dropping BIOS interrupts and syscalls from this snippet and snill no dice. I assemble my source code for my mbr and then I write it to the first 512b of a floppy disk image and boot it into Oracle VirtualBox. I have tried a 16-bit mbr and was able to print through BIOS calls. So please, if anyone knows how to fix my issue and is willing to help me, it would be greatly appreciated.