This example shows two things. One is the use of assembler in the C source. Two, is the use of the Call 5 interface to print a string on the console.

/** small-c HELLO.C demo, inline asm, Call5 interface. **/

hello()
{
	ot("Hello!$"); /** [1] **/
	keyp();       /** await keypress **/
}

ot()
{  /** Call 5 Fn print string. DS:DX`str, cl`9    **/
   /**  [1] Strings terminated with '$' !!        **/
   /** DI reg is unknown to small-c, so it should **/
   /** be safe to use as a scratch register.      **/
#asm
  pop  di     ;; stack -> 0[ret]2[ptr2str]
  pop  dx
  push dx     ;; caller cleans the stack.
  push di
  mov  cl, 9
  call 5      ;; cmd.exe or pcdos
#endasm
}

keyp()
{
#asm
  mov  ah, 0
  int  16h    ;; pause for keypress for user to see output.
#endasm
}

/** eof **/

11:50 AM 11/8/2009