tags:

views:

237

answers:

2
+2  Q: 

Ada and assembly

I'm looking at making a hardware debug tool that runs on the bare CPU (x86), 32-bit protected mode and no OS. Due to time constraints, I won't be writing the tool all in x86 assembly. I like the Ada language (but am inexperienced with it) and thought it might be interesting to use Ada rather than C for this project.

With C one can use inline assembly or call subprograms written in assembly to access the BIOS for basic things like keyboard I/O or displaying text on the screen. Does Ada have a similar capability? And if so, does anyone know of any resources or tutorials for calling assembly methods and linking with them?

+2  A: 

You can use inline assembly code in Ada. You need to use the System.Machine_Code package which provides the (overloaded) Asm function.

Michael Carman
Thanks! That should do the trick!
Dr. Watson
+1  A: 

The GNAT Reference manual has a section on Machine Code Insertions, and while it's GNAT-specific, one should be able to get a general sense of how it works even if you're using a different compiler.

Marc C
Thanks, I'll be sticking to GNAT as I want to use free tools. It is a hobby project after all.
Dr. Watson