www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/07/24/17:17:07

From: Dan Nelson <dnelson AT xnet DOT com>
Subject: Re: why no "normal" names for int(xyz) functions
To: klassa AT aur DOT alcatel DOT com (John M. Klassa)
Date: Mon, 24 Jul 1995 15:38:07 -0500 (CDT)
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu

in the last episode, John M. Klassa said:
> 
> Anyway, what struck me right away was the number of references to things
> like:
>         r.x.ax = 0x0013;
>         int86(0x10, &r, &r);
>
> in sample code.  It seems like using the BIOS (or whatever this
> particular example happens to reflect) involves knowing specific
> function *numbers*...  In the Atari ST world, BIOS routines are done
> more or less the same way, but compilers always included bindings so
> that "normal" names could be used in place of "bios_function(12)"
> (e.g.).  That is, you'd say "SetPalette(a,b,c)" rather than
> "int(0x22,a,b,c)" (you get the idea).

Yes, that would be the sane way of doing it.  But DOS is not sane.  I'm
originally from the Amiga world, and AmigaDos's function calls are like your
Atari ST calls.  The reason is that AmigaDos was written in C, so function
calls to OS routines are easily callable from C.

DOS, on the other hand, is written in Assembly.  So, you pass arguments in
registers, instead of on the stack.  You would need to write a stub function
for every DOS function.  In addition, many (most?) of the DOS INT calls are
un- or poorly-documented, or overloaded.  Have you taken a look at Ralf
Brown's Interrupt list?  It's got over 7,000 entries!!!

Note that for some commonly-used interrupts, there are equivalent functions
(e.g. the _bios_* functions, kbhit, gotoxy(), wherex(), wherey(), etc.) But
most of them are so low-level that you really don't want to be calling them
from C anyway.

-Dan Nelson                             Real programmers don't comment their
                    /\ /\/\ | (_, /\    code.  It was hard to write; it should
dnelson AT xnet DOT com                        be hard to understand.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019