Changeset 0bf84cc in mainline
- Timestamp:
- 2006-06-02T22:58:02Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 27386e6a
- Parents:
- 59ed572
- Location:
- fb
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fb/ega.c
r59ed572 r0bf84cc 41 41 42 42 #include "ega.h" 43 #include "../console/screenbuffer.h" 44 #include "main.h" 43 45 44 46 /* Allow only 1 connection */ … … 49 51 static char *scr_addr; 50 52 53 static unsigned int style = 0x0f; 54 51 55 static void clrscr(void) 52 56 { 53 57 int i; 54 58 55 for (i=0; i < scr_width*scr_height; i++) 59 for (i=0; i < scr_width*scr_height; i++) { 56 60 scr_addr[i*2] = ' '; 61 scr_addr[i*2+1] = style; 62 } 57 63 } 58 64 … … 60 66 { 61 67 scr_addr[(row*scr_width + col)*2] = c; 68 scr_addr[(row*scr_width + col)*2+1] = style; 69 } 70 71 static void draw_text_data(keyfield_t *data) 72 { 73 int i; 74 75 for (i=0; i < scr_width*scr_height; i++) { 76 scr_addr[i*2] = data[i].character; 77 if (data[i].style.fg_color > data[i].style.bg_color) 78 scr_addr[i*2+1] = 0x0f; 79 else 80 scr_addr[i*2+1] = 0xf0; 81 } 62 82 } 63 83 … … 69 89 char c; 70 90 unsigned int row, col; 91 int bgcolor,fgcolor; 92 keyfield_t *interbuf = NULL; 93 size_t intersize = 0; 71 94 72 95 if (client_connected) { … … 84 107 ipc_answer_fast(callid,0,0,0); 85 108 return; /* Exit thread */ 109 case IPC_M_AS_AREA_SEND: 110 /* We accept one area for data interchange */ 111 intersize = IPC_GET_ARG2(call); 112 if (intersize >= scr_width*scr_height*sizeof(*interbuf)) { 113 receive_comm_area(callid,&call,(void **)&interbuf, scr_width*scr_height*sizeof(*interbuf)); 114 continue; 115 } 116 retval = EINVAL; 117 break; 118 case FB_DRAW_TEXT_DATA: 119 if (!interbuf) { 120 retval = EINVAL; 121 break; 122 } 123 draw_text_data(interbuf); 124 retval = 0; 125 break; 86 126 case FB_GET_CSIZE: 87 127 ipc_answer_fast(callid, 0, scr_height, scr_width); … … 95 135 row = IPC_GET_ARG2(call); 96 136 col = IPC_GET_ARG3(call); 97 if ( row >= scr_width || col>= scr_height) {137 if (col >= scr_width || row >= scr_height) { 98 138 retval = EINVAL; 99 139 break; … … 102 142 retval = 0; 103 143 break; 144 case FB_SET_STYLE: 145 fgcolor = IPC_GET_ARG1(call); 146 bgcolor = IPC_GET_ARG2(call); 147 if (fgcolor > bgcolor) 148 style = 0x0f; 149 else 150 style = 0xf0; 104 151 default: 105 152 retval = ENOENT; -
fb/sysio.c
r59ed572 r0bf84cc 69 69 } 70 70 71 static void set_style(int mode) 72 { 73 char control[20]; 74 75 snprintf(control, 20, "\033[%df", mode); 76 sysputs(control); 77 } 78 71 79 /** ANSI terminal emulation main thread */ 72 80 static void sysio_client_connection(ipc_callid_t iid, ipc_call_t *icall) … … 79 87 int lastrow=0; 80 88 int newcol,newrow; 89 int fgcolor,bgcolor; 81 90 82 91 if (client_connected) { … … 116 125 retval = 0; 117 126 break; 127 case FB_SET_STYLE: 128 fgcolor = IPC_GET_ARG1(call); 129 bgcolor = IPC_GET_ARG2(call); 130 if (fgcolor > bgcolor) 131 set_style(0); 132 else 133 set_style(7); 134 retval = 0; 135 break; 118 136 default: 119 137 retval = ENOENT;
Note:
See TracChangeset
for help on using the changeset viewer.