| plan 9 kernel history: overview | file list | diff list |
1990/0329/gnot/screen.c (diff list | history)
| 1990/0321/sys/src/9/gnot/screen.c:16,21 – 1990/0329/sys/src/9/gnot/screen.c:16,23 (short | long | prev | next) | ||
| 1990/03091 | int bwid; }out; | |
| 1990/0329 | void duartinit(void); | |
| 1990/03091 | Bitmap screen = { | |
| 1990/0320 | (ulong*)((4*1024*1024-256*1024)|KZERO), /* BUG */ | |
| 1990/0321/sys/src/9/gnot/screen.c:29,35 – 1990/0329/sys/src/9/gnot/screen.c:31,38 | ||
| 1990/03091 | void screeninit(void) { | |
| 1990/0329 | duartinit(); bitblt(&screen, Pt(0, 0), &screen, screen.r, 0); | |
| 1990/03091 | out.pos.x = MINX; out.pos.y = 0; out.bwid = defont0.info[' '].width; | |
| 1990/0321/sys/src/9/gnot/screen.c:44,57 – 1990/0329/sys/src/9/gnot/screen.c:47,60 | ||
| 1990/03091 | if(c == '\n'){ out.pos.x = MINX; out.pos.y += defont0.height; | |
| 1990/0329 | if(out.pos.y > screen.r.max.y-defont0.height) out.pos.y = screen.r.min.y; | |
| 1990/03091 | bitblt(&screen, Pt(0, out.pos.y), &screen, | |
| 1990/0329 | Rect(0, out.pos.y, screen.r.max.x, out.pos.y+2*defont0.height), 0); | |
| 1990/03091 | }else if(c == '\t'){ nx = out.pos.x + (8-(out.pos.x/out.bwid&7))*out.bwid; out.pos.x = nx; | |
| 1990/0329 | if(out.pos.x >= screen.r.max.x) | |
| 1990/03091 | screenputc('\n'); }else if(c == '\b'){ if(out.pos.x >= out.bwid+MINX){ | |
| 1990/0321/sys/src/9/gnot/screen.c:60,66 – 1990/0329/sys/src/9/gnot/screen.c:63,69 | ||
| 1990/03091 | out.pos.x -= out.bwid; } }else{ | |
| 1990/0329 | if(out.pos.x >= screen.r.max.x-out.bwid) | |
| 1990/03091 | screenputc('\n'); buf[0] = c&0x7F; buf[1] = 0; | |
| 1990/0321/sys/src/9/gnot/screen.c:77,89 – 1990/0329/sys/src/9/gnot/screen.c:80,97 | ||
| 1990/03091 | uchar cmnd; /* Command Register */ uchar data; /* RX Holding / TX Holding Register */ uchar ipc_acr; /* Input Port Change/Aux. Control Register */ | |
| 1990/0329 | #define ivr ivr /* Interrupt Vector Register */ | |
| 1990/03091 | uchar is_imr; /* Interrupt Status/Interrupt Mask Register */ | |
| 1990/0329 | #define ip_opcr is_imr /* Input Port/Output Port Configuration Register */ | |
| 1990/03091 | uchar ctur; /* Counter/Timer Upper Register */ | |
| 1990/0329 | #define scc_sopbc ctur /* Start Counter Command/Set Output Port Bits Command */ | |
| 1990/03091 | uchar ctlr; /* Counter/Timer Lower Register */ | |
| 1990/0329 | #define scc_ropbc ctlr /* Stop Counter Command/Reset Output Port Bits Command */ | |
| 1990/03091 | }; enum{ CHAR_ERR =0x00, /* MR1x - Mode Register 1 */ | |
| 1990/0329 | PAR_ENB =0x00, | |
| 1990/03091 | EVEN_PAR =0x00, ODD_PAR =0x04, NO_PAR =0x10, | |
| 1990/0321/sys/src/9/gnot/screen.c:113,118 – 1990/0329/sys/src/9/gnot/screen.c:121,129 | ||
| 1990/03091 | PAR_ERR =0x20, FRM_ERR =0x40, RCVD_BRK =0x80, | |
| 1990/0329 | BD9600 =0xBB, BD4800 =0x99, BD2400 =0x88, | |
| 1990/03091 | IM_IPC =0x80, /* IMRx/ISRx - Interrupt Mask/Interrupt Status */ IM_DBB =0x40, IM_RRDYB =0x20, | |
| 1990/0321/sys/src/9/gnot/screen.c:143,148 – 1990/0329/sys/src/9/gnot/screen.c:154,207 | ||
| 1990/03091 | }; void | |
| 1990/0329 | duartinit(void) { Duart *duart; duart = DUARTREG; /* * Keyboard */ duart[0].cmnd = RESET_RCV|DIS_TX|DIS_RX; duart[0].cmnd = RESET_TRANS; duart[0].cmnd = RESET_ERR; duart[0].cmnd = RESET_MR; duart[0].mr1_2 = CHAR_ERR|PAR_ENB|EVEN_PAR|CBITS8; duart[0].mr1_2 = NORM_OP|ONESTOPB; duart[0].sr_csr = BD4800; /* * Pen */ duart[1].cmnd = RESET_RCV|DIS_TX|DIS_RX; duart[1].cmnd = RESET_TRANS; duart[1].cmnd = RESET_ERR; duart[1].cmnd = RESET_MR; duart[1].mr1_2 = CHAR_ERR|NO_PAR|CBITS8; duart[1].mr1_2 = NORM_OP|ONESTOPB; duart[1].sr_csr = BD2400; /* * Output port */ duart[0].ipc_acr = 0xBF; /* allow change of state interrupt */ duart[1].ip_opcr = 0x00; duart[1].scc_ropbc = 0xFF; /* make sure the port is reset first */ duart[1].scc_sopbc = 0x04; /* dtr = 1, pp = 01 */ duart[0].is_imr = IM_IPC|IM_RRDYB|IM_XRDYB|IM_RRDYA; duart[0].cmnd = ENB_TX|ENB_RX; /* enable TX and RX last */ duart[1].cmnd = ENB_TX|ENB_RX; /* * Initialize keyboard */ while (!(duart[0].sr_csr & (XMT_EMT|XMT_RDY))) ; duart[0].data = 0x02; } void | |
| 1990/03091 | duartintr(void) { int cause, status, c; | |
| 1990/0321/sys/src/9/gnot/screen.c:176,180 – 1990/0329/sys/src/9/gnot/screen.c:235,248 | ||
| 1990/03091 | */ if(cause & IM_RRDYB) /* pen input */ c = duart[1].data; | |
| 1990/0329 | /* * Is it 4? */ if(cause & IM_XRDYB) duart[1].cmnd = DIS_TX; /* * Is it 3? */ if(cause & IM_IPC) mousebuttons((~duart[0].ipc_acr) & 7); | |
| 1990/03091 | } | |