3 void putOsaskChar(int c, struct Regs *r)
5 if (0x10 <= c && c <= 0x1f)
6 c = "0123456789ABCDEF"[c & 0x0f];
7 putchar(r->lastConsoleChar = c);
11 void checkString(struct Regs *r, int rxx, int pxx)
14 if (r->preg[pxx].typ != 0x03) c = 1;
15 if (r->preg[pxx].p < r->preg[pxx].p0) c = 1;
16 if (r->ireg[rxx] < 0) c = 1;
17 if (r->preg[pxx].p + r->ireg[rxx] > r->preg[pxx].p1) c = 1;
23 int loadColor(struct Regs *r, int rxx)
25 int c = r->ireg[rxx], m = r->ireg[0x31] & 0x0c, rr, gg, bb;
29 c = iColor1[c & 0x07];
32 // 00, 24, 48, 6d, 91, b6, da, ff
33 if (c < 0 || c >= (1 << 9))
41 c = rr << 16 | gg << 8 | bb;
44 // 00, 08, 10, 18, 20, 29, 31, 39,
45 // 41, 4a, 52, 5a, 62, 6a, 73, 7b,
46 // 83, 8b, 94, 9c, a4, ac, b4, bd,
47 // c5, cd, d5, de, e6, ee, f6, ff
48 if (c < 0 || c >= (1 << 15))
50 rr = (c >> 10) & 0x1f;
56 c = rr << 16 | gg << 8 | bb;
61 void checkRect(struct Regs *r, int rxx)
65 if (r->ireg[rxx + 0] <= 0 || r->ireg[rxx + 0] > v_xsiz) c = 1;
66 if (r->ireg[rxx + 1] <= 0 || r->ireg[rxx + 1] > v_ysiz) c = 1;
67 if (r->ireg[rxx + 2] < 0 || r->ireg[rxx + 2] >= v_xsiz) c = 1;
68 if (r->ireg[rxx + 3] < 0 || r->ireg[rxx + 3] >= v_ysiz) c = 1;
69 i = r->ireg[rxx + 2] + r->ireg[rxx + 0]; if (i <= 0 || i > v_xsiz) c = 1;
70 i = r->ireg[rxx + 1] + r->ireg[rxx + 3]; if (i <= 0 || i > v_ysiz) c = 1;