How do you run assembly code without an OS intervention?
The kind of programming you're talking about is called baremetal programming, since there's no OS providing resources, builtin functions, etc. for your code to use. There's a fair bit of setup you need to do before you can get even simple code running.
I'll note that I don't have much experience in this area, but you will have to define interrupt handlers + an interrupt descriptor table and implement functions for each syscall yourself. For the syscalls, you would write code that directly interfaces with hardware. (Example below)
Here are some useful links:
https://wiki.osdev.org/Interrupts
https://wiki.osdev.org/Interrupts_tutorial
https://filippo.io/linux-syscall-table/
Most of the tutorials on the OSDev Wiki require using both assembly and C. You will also need to create a simple kernel to get your code running, if you decide to go this route. Here's the tutorial for that: https://wiki.osdev.org/Bare_Bones
-----------
(Example)
Back when I was learning this kind of thing, I remember writing an implementation of puts() for my basic kernel's C library. All it did was print a string to the screen while in VGA text mode. To do this, you write characters directly into memory at address 0xB8000 which is the VGA text buffer. This is the lowest level of code needed to write characters to the screen, but after this you have a nice C function to use wherever you'd like.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now