2 * Copyright (C) 1996-1998 Szeredi Miklos
3 * Email: mszeredi@inf.bme.hu
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. See the file COPYING.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
33 volatile int screen_visible
= 1;
34 volatile int accept_keys
= 1;
37 byte
*update_screen_line(byte
*scrp
, int coli
, int scri
, int border
,
41 #if LCD_WIDTH == 320 && ( LCD_HEIGHT == 240 || LCD_HEIGHT == 200 )
51 scrptr
= (qbyte
*) scrp
;
52 if(scri
>= 0) { /* normal line */
53 #if LCD_WIDTH == 320 && ( LCD_HEIGHT == 240 || LCD_HEIGHT == 200 )
54 if(SPNM(border_update
)) {
55 brd_color
= SPNM(colors
)[border
];
56 brd_color
|= brd_color
<< 8;
57 brd_color
|= brd_color
<< 16;
58 for(i
= 8; i
; i
--) *scrptr
++ = brd_color
;
60 for(i
= 8; i
; i
--) *scrptr
++ = brd_color
;
67 tmptr
= SPNM(scr_mark
) + 0x2C0 + (coli
>> 3);
74 mptr
= SPNM(scr_mark
) + scri
;
82 SPNM(imag_mark
)[coli
] |= mark
;
83 SPNM(imag_horiz
) |= mark
;
85 SPNM(imag_vert
) |= BIT_N(coli
);
87 spmp
= PRNM(proc
).mem
+ (scri
<< 5);
88 spcp
= PRNM(proc
).mem
+ 0x5800 + (coli
<< 5);
90 if(!SPNM(flash_state
)) scr_tab
= SPNM(scr_f0_table
);
91 else scr_tab
= SPNM(scr_f1_table
);
93 register dbyte spcx
, spmx
;
94 spcx
= (*spcp
++) << 6;
96 *scrptr
++ = scr_tab
[spcx
|((spmx
& 0xf0) >> 4)];
97 *scrptr
++ = scr_tab
[spcx
|((spmx
& 0x0f))];
103 else if(scri
== -1) { /* only border */
104 #if LCD_WIDTH == 320 && ( LCD_HEIGHT == 240 || LCD_HEIGHT == 200 )
105 if(SPNM(border_update
)) {
106 brd_color
= SPNM(colors
)[border
];
107 brd_color
|= brd_color
<< 8;
108 brd_color
|= brd_color
<< 16;
109 for(i
= 0x50; i
; i
--) *scrptr
++ = brd_color
;
118 return (byte
*) scrptr
;
121 void spscr_init_mask_color(void)
128 byte
*tab_f0
, *tab_f1
;
130 sp_scr_f0_table
= (qbyte
*) (PRNM(proc
).mem
+ 0x10000);
131 sp_scr_f1_table
= (qbyte
*) (PRNM(proc
).mem
+ 0x20000);
133 sp_colors
[8] = sp_colors
[0];
135 for(clb
= 0; clb
< 256; clb
++)
136 for(hb
= 0; hb
< 16; hb
++) {
138 bc
= (clb
& 0x38) >> 3;
147 ix
= (clb
<< 8) + (hb
<< TABOFFS
);
148 tab_f0
= ((byte
*) sp_scr_f0_table
) + ix
+ 3;
149 tab_f1
= ((byte
*) sp_scr_f1_table
) + ix
+ 3;
151 for(j
= 4; j
; bwb
>>= 1, j
--) {
152 *tab_f0
-- = (byte
) sp_colors
[(bwb
& 0x01) ? fc
: bc
];
153 *tab_f1
-- = (byte
) sp_colors
[(clb
& 0x80) ?
154 ((bwb
& 0x01) ? bc
: fc
) :
155 ((bwb
& 0x01) ? fc
: bc
)];
160 void flash_change(void)
165 register unsigned int val
;
167 mcp
= sp_scr_mark
+ 0x2C0;
168 scp
= z80_proc
.mem
+ 0x5800;
170 for(i
= 24; i
; mcp
++, i
--) {
172 for(j
= 32; j
; scp
++, j
--) {
174 if(*scp
& 0x80) val
|= (1 << 31);
180 void spscr_init_line_pointers(int lines
)
187 bs
= (lines
- 192) / 2;
189 for(i
= 0; i
< PORT_TIME_NUM
; i
++) {
193 if(i
< ODDHF
) scline
= i
;
194 else scline
= i
- ODDHF
;
196 if(scline
>= 64-bs
&& scline
< 256+bs
) {
197 if(scline
>= 64 && scline
< 256) {
201 (y
& 0xC0) + ((y
& 0x07) << 3) + ((y
& 0x38) >> 3);
203 else sp_scri
[i
] = -1;