Rev 1564 | Rev 1577 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1564 | Rev 1565 | ||
|---|---|---|---|
| Line 153... | Line 153... | ||
| 153 | 153 | ||
| 154 | static void scroll(int rows) |
154 | static void scroll(int rows) |
| 155 | { |
155 | { |
| 156 | int i; |
156 | int i; |
| 157 | if (rows > 0) { |
157 | if (rows > 0) { |
| 158 | memcpy(scr_addr,((char *)scr_addr) + rows * scr_width * 2, scr_width * scr_height * 2 - rows * scr_width * 2); |
158 | memcpy (scr_addr,((char *)scr_addr) + rows * scr_width * 2, scr_width * scr_height * 2 - rows * scr_width * 2); |
| 159 | for(i = 0; i < rows * scr_width ; i ++) |
159 | for (i = 0; i < rows * scr_width ; i ++) |
| 160 | (((short *)scr_addr) + scr_width * scr_height - rows * scr_width) [i] = ((style << 8) + ' '); |
160 | (((short *)scr_addr) + scr_width * scr_height - rows * scr_width) [i] = ((style << 8) + ' '); |
| 161 | } else if (rows < 0) { |
161 | } else if (rows < 0) { |
| 162 | 162 | ||
| 163 | memcpy(((char *)scr_addr) - rows * scr_width * 2 ,scr_addr ,scr_width * scr_height * 2 + rows * scr_width * 2); |
163 | memcpy (((char *)scr_addr) - rows * scr_width * 2 ,scr_addr ,scr_width * scr_height * 2 + rows * scr_width * 2); |
| 164 | for( i = 0; i < - rows * scr_width ; i++) |
164 | for (i = 0; i < - rows * scr_width ; i++) |
| 165 | ((short *)scr_addr) [i] = ((style << 8 ) + ' '); |
165 | ((short *)scr_addr) [i] = ((style << 8 ) + ' '); |
| 166 | } |
166 | } |
| 167 | } |
167 | } |
| 168 | 168 | ||
| 169 | static void printchar(char c, unsigned int row, unsigned int col) |
169 | static void printchar(char c, unsigned int row, unsigned int col) |
| Line 189... | Line 189... | ||
| 189 | 189 | ||
| 190 | static int save_screen(void) |
190 | static int save_screen(void) |
| 191 | { |
191 | { |
| 192 | int i; |
192 | int i; |
| 193 | short *mem; |
193 | short *mem; |
| 194 | for( i=0 ;( i < MAX_SAVED_SCREENS ) && (saved_screens[i].data); i++); |
194 | for (i=0 ;( i < MAX_SAVED_SCREENS ) && (saved_screens[i].data); i++); |
| 195 | if( i == MAX_SAVED_SCREENS) |
195 | if (i == MAX_SAVED_SCREENS) |
| 196 | return EINVAL; |
196 | return EINVAL; |
| 197 | if(!(saved_screens[i].data=malloc( 2 * scr_width*scr_height ))) |
197 | if (!(saved_screens[i].data=malloc( 2 * scr_width*scr_height ))) |
| 198 | return ENOMEM; |
198 | return ENOMEM; |
| 199 | memcpy(saved_screens[i].data,scr_addr, 2 * scr_width * scr_height ) |
199 | memcpy (saved_screens[i].data ,scr_addr ,2 * scr_width * scr_height) |
| 200 | ; |
200 | ; |
| 201 | return i; |
201 | return i; |
| 202 | } |
202 | } |
| 203 | 203 | ||
| 204 | static int print_screen(int i) |
204 | static int print_screen(int i) |
| 205 | { |
205 | { |
| 206 | if(saved_screens[i].data) |
206 | if (saved_screens[i].data) |
| 207 | memcpy(scr_addr,saved_screens[i].data,2*scr_width*scr_height); |
207 | memcpy (scr_addr,saved_screens[i].data, 2 * scr_width * scr_height); |
| 208 | else return EINVAL; |
208 | else return EINVAL; |
| 209 | return i; |
209 | return i; |
| 210 | } |
210 | } |
| 211 | 211 | ||
| 212 | 212 | ||