1

I still coudnt find any hint and hope somebody can usher me to the right pad:

If I want to programm in the pure plattform-indipendent x-86 assembler code without any NASM macros or functions with (), but with push, call and pull. How I can I find the right functions? The translator into opcode does find them. However do their places change in the different versions? Since there are no different versions of the Compiler into opcode, I suppose they do not. I hardly can find any adresses on the internet What I actually search is something like the dos interrupts for windows 10 or 11

  • 1
    *(or dos-interrupts for mordern windows-systems)* - nope, those things are incompatible, unless you're running inside an emulated 16-bit virtual machine (e.g. via NTVDM on a 32-bit Windows version that supports that, or DOSBox). Also, x86 asm is inherently not platform-independent. A modern OS stops user-space from accessing hardware directly, and you different video and USB hardware (for keyboard access) would need different drivers. – Peter Cordes Mar 30 '22 at 02:46
  • If you mean raw Windows kernel system calls, those exist but the ABI is undocumented and not stable between Windows versions; only the DLL API is stable. See [System Calls in windows & Native API?](https://stackoverflow.com/q/2489889) – Peter Cordes Mar 30 '22 at 02:47
  • [How to write hello world in assembler under Windows?](https://stackoverflow.com/q/1023593) shows that you can write a pretty minimal Hello World with NASM and not link any extra libraries, just the DLLs that Windows always maps into your address space whether you want them or not. – Peter Cordes Mar 30 '22 at 02:49

1 Answers1

0

I also struggled finding sources on what to do. Platform independent coding basically means you are writing your own operating system. This is because it requires you to write a boot loader that takes your program, and moves it into the memory. It also requires you to make your own drivers and libraries: VGA driver, stdout (print functions), stdin, etc.

If you like, you can check out my repo here. I already hacked together my own boot-loader, linker script, etc. that handles the boringly complicated things! I also have a library (located in BODY/data.s) that features a ton of functions that I wrote myself. You can use these to help guide you in writing your own drivers if you'd like!

In order to use this development platform however, you need to install:

  • GNU binutils
  • GRUB (already included on most linux)
  • XORRISO
  • QEMU

This is all meant to run in linux. If you are using macos or windows, I recommend using either WSL or virtual box to install linux on your system! The code might also be slightly different that what you are used to, as it's called GAS assembly, which alters from the intel syntax.

Please reply if you have any issues with this, or need a better tutorial on how to set this up.

Finally, I recommend checking out osdev.org. There's great info on ports (how you communicate with the kb, mouse, etc.) and how the VGA ram works.