Watt-32 tcp/ip  2.2 dev-rel.10
qmsg.c
Go to the documentation of this file.
1 
7 #include <stdio.h>
8 
9 #include "copyrigh.h"
10 #include "wattcp.h"
11 #include "misc.h"
12 #include "powerpak.h"
13 #include "x32vm.h"
14 
15 #if defined(__MSDOS__)
16 /*
17  * Disable stack-checking here because interrupt handlers might not
18  * setup a legal stack.
19  */
20 #include "nochkstk.h"
21 
22 #define SCR_WIDTH 80
23 #define SCR_HEIGHT 50
24 #define SCR_SEGMENT 0xB800
25 #define SCR_START (2*2*SCR_WIDTH) /* start at line 3 */
26 
27 BYTE dbg_colour = 14 + (16*1); /* yellow on blue */
28 WORD dbg_scrpos = SCR_START;
29 WORD dbg_scrstart = SCR_START;
30 
31 static int curr_line = (SCR_START/(2*SCR_WIDTH));
32 
33 void dputch (char x)
34 {
35  if (x == '\r')
36  {
37  dbg_scrpos = 2 * SCR_WIDTH * curr_line;
38  }
39  else if (x == '\n')
40  {
41  dbg_scrpos += 2 * SCR_WIDTH;
42  curr_line++;
43  }
44  else
45  {
46  POKEW (SCR_SEGMENT, dbg_scrpos, x | (dbg_colour << 8));
47  dbg_scrpos += 2;
48  }
49  if (dbg_scrpos > 2*SCR_HEIGHT*SCR_WIDTH)
50  dbg_scrpos = dbg_scrstart;
51  if (curr_line >= SCR_HEIGHT)
52  curr_line = (SCR_START/(2*SCR_WIDTH));
53 }
54 
55 void dmsg (const char *s)
56 {
57  while (s && *s)
58  dputch (*s++);
59 }
60 
61 void dhex1int (int x)
62 {
63  x &= 0x0F;
64  if (x > 9)
65  x = 'A' + x - 10;
66  else x += '0';
67  dputch ((char)x);
68 }
69 
70 void dhex2int (int x)
71 {
72  x &= 0xFF;
73  dhex1int (x >> 4);
74  dhex1int (x);
75 }
76 
77 void dhex4int (int x)
78 {
79  x &= 0xFFFF;
80  dhex2int (x >> 8);
81  dhex2int (x & 0xFF);
82 }
83 
84 void dhex8int (DWORD x)
85 {
86  dhex4int ((int)(x >> 16));
87  dhex4int ((int)(x & 0xFFFF));
88  dputch (' ');
89 }
90 #endif /* __MSDOS__ */
91 
Core definitions.