| 1 |
|
| 2 |
|
| 3 |
#include "pdcdos.h" |
| 4 |
|
| 5 |
RCSID("$Id: pdcdisp.c,v 1.65 2008/07/13 16:08:17 wmcbrine Exp $") |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
#ifdef CHTYPE_LONG |
| 11 |
|
| 12 |
# define A(x) ((chtype)x | A_ALTCHARSET) |
| 13 |
|
| 14 |
chtype acs_map[128] = |
| 15 |
{ |
| 16 |
A(0), A(1), A(2), A(3), A(4), A(5), A(6), A(7), A(8), A(9), A(10), |
| 17 |
A(11), A(12), A(13), A(14), A(15), A(16), A(17), A(18), A(19), |
| 18 |
A(20), A(21), A(22), A(23), A(24), A(25), A(26), A(27), A(28), |
| 19 |
A(29), A(30), A(31), ' ', '!', '"', '#', '$', '%', '&', '\'', '(', |
| 20 |
')', '*', |
| 21 |
|
| 22 |
A(0x1a), A(0x1b), A(0x18), A(0x19), |
| 23 |
|
| 24 |
'/', |
| 25 |
|
| 26 |
0xdb, |
| 27 |
|
| 28 |
'1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', |
| 29 |
'>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', |
| 30 |
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', |
| 31 |
'X', 'Y', 'Z', '[', '\\', ']', '^', '_', |
| 32 |
|
| 33 |
A(0x04), 0xb1, |
| 34 |
|
| 35 |
'b', 'c', 'd', 'e', |
| 36 |
|
| 37 |
0xf8, 0xf1, 0xb0, A(0x0f), 0xd9, 0xbf, 0xda, 0xc0, 0xc5, 0x2d, 0x2d, |
| 38 |
0xc4, 0x2d, 0x5f, 0xc3, 0xb4, 0xc1, 0xc2, 0xb3, 0xf3, 0xf2, 0xe3, |
| 39 |
0xd8, 0x9c, 0xf9, |
| 40 |
|
| 41 |
A(127) |
| 42 |
}; |
| 43 |
|
| 44 |
# undef A |
| 45 |
|
| 46 |
#endif |
| 47 |
|
| 48 |
#ifdef __PACIFIC__ |
| 49 |
void movedata(unsigned sseg, unsigned soff, unsigned dseg, |
| 50 |
unsigned doff, unsigned n) |
| 51 |
{ |
| 52 |
far char *src = MK_FP(sseg, soff); |
| 53 |
far char *dst = MK_FP(dseg, doff); |
| 54 |
|
| 55 |
while (n--) |
| 56 |
*dst++ = *src++; |
| 57 |
} |
| 58 |
#endif |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
void PDC_gotoyx(int row, int col) |
| 63 |
{ |
| 64 |
PDCREGS regs; |
| 65 |
|
| 66 |
PDC_LOG(("PDC_gotoyx() - called: row %d col %d\n", row, col)); |
| 67 |
|
| 68 |
regs.h.ah = 0x02; |
| 69 |
regs.h.bh = 0; |
| 70 |
regs.h.dh = (unsigned char) row; |
| 71 |
regs.h.dl = (unsigned char) col; |
| 72 |
PDCINT(0x10, regs); |
| 73 |
} |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
void PDC_transform_line(int lineno, int x, int len, const chtype *srcp) |
| 79 |
{ |
| 80 |
int j; |
| 81 |
|
| 82 |
PDC_LOG(("PDC_transform_line() - called: line %d\n", lineno)); |
| 83 |
|
| 84 |
if (pdc_direct_video) |
| 85 |
{ |
| 86 |
#if SMALL || MEDIUM |
| 87 |
# ifndef __PACIFIC__ |
| 88 |
struct SREGS segregs; |
| 89 |
# endif |
| 90 |
int ds; |
| 91 |
#endif |
| 92 |
|
| 93 |
|
| 94 |
struct {unsigned char text, attr;} temp_line[256]; |
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
for (j = 0; j < len; j++) |
| 100 |
{ |
| 101 |
chtype ch = srcp[j]; |
| 102 |
|
| 103 |
temp_line[j].attr = pdc_atrtab[ch >> PDC_ATTR_SHIFT]; |
| 104 |
#ifdef CHTYPE_LONG |
| 105 |
if (ch & A_ALTCHARSET && !(ch & 0xff80)) |
| 106 |
ch = acs_map[ch & 0x7f]; |
| 107 |
#endif |
| 108 |
temp_line[j].text = ch & 0xff; |
| 109 |
} |
| 110 |
|
| 111 |
#ifdef __DJGPP__ |
| 112 |
dosmemput(temp_line, len * 2, |
| 113 |
(unsigned long)_FAR_POINTER(pdc_video_seg, |
| 114 |
pdc_video_ofs + (lineno * curscr->_maxx + x) * 2)); |
| 115 |
#else |
| 116 |
# if SMALL || MEDIUM |
| 117 |
# ifdef __PACIFIC__ |
| 118 |
ds = FP_SEG((void far *) temp_line); |
| 119 |
# else |
| 120 |
segread(&segregs); |
| 121 |
ds = segregs.ds; |
| 122 |
# endif |
| 123 |
movedata(ds, (int)temp_line, pdc_video_seg, |
| 124 |
pdc_video_ofs + (lineno * curscr->_maxx + x) * 2, len * 2); |
| 125 |
# else |
| 126 |
memcpy((void *)_FAR_POINTER(pdc_video_seg, |
| 127 |
pdc_video_ofs + (lineno * curscr->_maxx + x) * 2), |
| 128 |
temp_line, len * 2); |
| 129 |
# endif |
| 130 |
#endif |
| 131 |
|
| 132 |
} |
| 133 |
else |
| 134 |
for (j = 0; j < len;) |
| 135 |
{ |
| 136 |
PDCREGS regs; |
| 137 |
unsigned short count = 1; |
| 138 |
chtype ch = srcp[j]; |
| 139 |
|
| 140 |
while ((j + count < len) && (ch == srcp[j + count])) |
| 141 |
count++; |
| 142 |
|
| 143 |
PDC_gotoyx(lineno, j + x); |
| 144 |
|
| 145 |
regs.h.ah = 0x09; |
| 146 |
regs.W.bx = pdc_atrtab[ch >> PDC_ATTR_SHIFT]; |
| 147 |
regs.W.cx = count; |
| 148 |
#ifdef CHTYPE_LONG |
| 149 |
if (ch & A_ALTCHARSET && !(ch & 0xff80)) |
| 150 |
ch = acs_map[ch & 0x7f]; |
| 151 |
#endif |
| 152 |
regs.h.al = (unsigned char) (ch & 0xff); |
| 153 |
|
| 154 |
PDCINT(0x10, regs); |
| 155 |
|
| 156 |
j += count; |
| 157 |
} |
| 158 |
} |