Question

I write a simple program in assembly language in Linux (using nasm), and for educational purposes, I want to use BIOS interrupt instead linux system calls, is this possible ?

Was it helpful?

Solution

The short answer is, no it's not possible.

The longer answer is that Linux has support for virtual8086 mode (the int vm86(unsigned long fn, struct vm86plus_struct *v86) call) which is capable of executing real mode code (including BIOS functions, if setup properly). However; the BIOS expects lots of different pieces of hardware to be in specific/default states, and Linux (like all good OSs) takes control of the hardware and puts it all in various state/s that the BIOS can't possibly expect. Because of this it might be possible to call the BIOS functions, but you can expect them to crash, cause unknown behaviour and/or ruin the proper functioning of Linux's native device drivers.

Also note that the BIOS functions are "extremely inferior" to Linux's native device drivers anyway (or in other words, if it actually did work, you still shouldn't do it); and a lot of systems use UEFI now (the BIOS functions simply do not exist in that case).

OTHER TIPS

You could assemble for a DOS environment and use DOSBox to run it from Linux. Or, you could write it for no OS (bootloader) and run inside of VirtualBox.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top