home *** CD-ROM | disk | FTP | other *** search
/ Hall of Fame / HallofFameCDROM.cdr / proglc / tnylib.lzh / PRINTF.ASM < prev    next >
Encoding:
Assembly Source File  |  1986-11-20  |  565 b   |  48 lines

  1. include compiler.inc
  2.  
  3.     ttl    PRINTF, 1.05, 10-20-86 jwk
  4.  
  5.  
  6. ;formatted print to stdout
  7.  
  8.     dseg
  9.     extrn    _ftb:byte
  10.     cseg
  11.  
  12.     xtfs    <_fmt, putc>
  13.  
  14.     procdef    printf, <<arglst, word>>
  15.  
  16.     pushreg
  17.     pushds
  18.     mov    ax, offset pc        ;pointer to function
  19.     lea    dx, arglst    ;pointer to first arg
  20.     callit    _fmt, <<dx, preg, ss>, <ax, preg, cs>>
  21.     pret
  22.  
  23.     pend    printf
  24.  
  25.     statdef    pc, <<chr, byte>>
  26.  
  27.     pushreg
  28.     lea    si, _ftb[5]        ;stdout stream pointer
  29.     mov    al, chr
  30.     xor    ah, ah
  31.     callit    putc <<si, preg, ds>, <ax, reg>>
  32.     pret
  33.  
  34.     iend    pc
  35.  
  36.     finish
  37.  
  38.     end
  39. 
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.