/*
   CyberRax Programming (C) 2003
   TITLE:   DOSWRITE.H--
   DESCRIPTION:   Additional print functions using DOS
   LAST MODIFIED:   05 Mar 2003
   PROCEDURES DEFINED IN THIS FILE:
       void DOSWRITESTRING(string)
       void DWRITEWORD(word_value)
       void DWRITEHEX(word_value)
   STRUCTURES DEFINIED IN THIS FILE:
       <none>

   DEFINITIONS AFFECTING THIS CODE:
      KeepInsert1 - don't undefine Insert1
      Insert1     - insert __dwriteword() in DWRITEWORD() instead of calling

   NOTE:   this header file uses features of SPHINX/Sheker C-- and needs
	   quite some modifications to work under original SPHINX C-- 0.203
*/

? ifndef _DOSWRITE_
? define _DOSWRITE_	TRUE


? ifndef _NUMBERS_
  ? include "NUMBERS.H--"
? endif

? ifndef _DWRITE_
  ? include "DWRITE.H--"
? endif


? warning		TRUE



inline void DWRITEHEX (BX)
/* Writes HEX number on screen using DOS interrupt
   Input: BX = word to print
   Size: 83 bytes
*/
{
AH = TWO;
DX = BX;
$SHR DX,TWELVE
IF (DL >= TEN)
   DL += 'A' - TEN - '0';
DL += '0';
$INT 0x21
DX = BX;
$SHR DX,8
DL &= 0x0F;
IF (DL >= TEN)
   DL += 'A' - TEN - '0';
DL += '0';
$INT 0x21
DX = BX;
$SHR DX,FOUR
DL &= 0x0F;
IF (DL >= TEN)
   DL += 'A' - TEN - '0';
DL += '0';
$INT 0x21
DL = BL;
DL &= 0x0F;
IF (DL >= TEN)
   DL += 'A' - TEN - '0';
DL += '0';
$INT 0x21
}
/* Returns: BX = the number
	    AX, DX destroyed
*/



inline void DOSWRITESTRING ((E)DX)
/* Prints the string to the screen using DOS interrupt. A replacement for
     standard DOSWRITESTR() in DOS.H--, which is 2 bytes larger.
   Input: DS:DX = '$'-terminated string to print
   Size: 4 bytes
*/
{
? DOSrequired 0x0100
	AH = 9;
	$INT 0x21
}
/* Returns: nothing
*/



inline void DWRITEWORD (AX)
/* Writes number on screen using DOS interrupt
   Input: AX = word to print
   Uses: __dwriteword() from DWRITE.H--
         0 - 2 bytes of stack
	 'Insert1' definied to insert __dwriteword() instead of calling
   Size: 76 bytes
*/
{
? ifdef Insert1
  @
? endif
__dwriteword();
@UNDEFINEINSERT1();
}
/* Returns: nothing
*/


? endif


/* end of DOSWRITE.H-- */
