source: abuse/branches/pd/macabuse/imlib/port/dos4gw/monoprnt.c @ 636

Last change on this file since 636 was 49, checked in by Sam Hocevar, 15 years ago
  • Imported original public domain release, for future reference.
  • Property svn:keywords set to Id
File size: 721 bytes
Line 
1#include <stdio.h>
2#include <mem.h>
3#include <dos.h>
4#include <stdarg.h>
5
6#define v_mem() ((unsigned char *)0xb0000)
7
8int mcx=0,mcy=0;
9void mnclear()
10{ memset(v_mem(),0,160*25); }
11
12
13void mnprintf(const char *format, ...)
14{
15  char st[200],a,*sp;
16  int y;
17  va_list ap;
18  va_start(ap, format);
19  vsprintf(st,format,ap);
20  va_end(ap);
21  sp=st;
22  while (*sp)
23  { a=0;
24    if (*sp=='\n')
25      a=1;
26    else { if (mcx==79)
27             a=1;
28           *(v_mem()+mcy*160+mcx*2)=*sp;
29           *(v_mem()+mcy*160+mcx*2+1)=27;
30           mcx++; }
31    if (a)
32    {
33      mcx=0;
34      mcy++;
35      if (mcy==25)
36      {
37        for (y=0;y<24;y++)
38          memcpy(v_mem()+(y)*160,v_mem()+(y+1)*160,160);
39        memset(v_mem()+24*160,0,160);
40        mcy=24;
41      }
42    }
43    sp++;
44  }
45}
Note: See TracBrowser for help on using the repository browser.