trunk/src/emu/video/i8275.c
r19910 | r19911 | |
59 | 59 | |
60 | 60 | struct i8275_t |
61 | 61 | { |
62 | | devcb_resolved_write_line out_drq_func; |
63 | | devcb_resolved_write_line out_irq_func; |
64 | | |
65 | | screen_device *screen; |
66 | | |
67 | | const i8275_interface *intf; |
68 | | |
69 | | UINT8 status_reg; /* value of status reggister */ |
70 | | UINT8 num_of_params; /* expected number of parameters */ |
71 | | UINT8 current_command; /* command currently executing */ |
72 | | UINT8 param_type; /* parameter type */ |
73 | | |
74 | | UINT8 cursor_col; /* current cursor column */ |
75 | | UINT8 cursor_row; /* current cursor row */ |
76 | | |
77 | | UINT8 light_pen_col; /* current light pen column */ |
78 | | UINT8 light_pen_row; /* current light pen row */ |
79 | | |
80 | | /* reset command parameter values*/ |
81 | | /* parameter 0 */ |
82 | | UINT8 rows_type; |
83 | | UINT8 chars_per_row; |
84 | | /* parameter 1 */ |
85 | | UINT8 vert_retrace_rows; |
86 | | UINT8 rows_per_frame; |
87 | | /* parameter 2 */ |
88 | | UINT8 undeline_line_num; |
89 | | UINT8 lines_per_row; |
90 | | /* parameter 3 */ |
91 | | UINT8 line_counter_mode; |
92 | | UINT8 field_attribute_mode; |
93 | | UINT8 cursor_format; |
94 | | UINT8 hor_retrace_count; |
95 | | |
96 | | /* values for start display command */ |
97 | | UINT8 burst_space_code; |
98 | | UINT8 burst_count_code; |
99 | | |
100 | | /* buffers */ |
101 | | UINT8 row_buffer_1[80]; |
102 | | UINT8 row_buffer_2[80]; |
103 | | UINT8 row_pos; |
104 | | UINT8 buffer_used; |
105 | | |
106 | | UINT8 fifo_buffer_1[16]; |
107 | | UINT8 fifo_buffer_2[16]; |
108 | | UINT8 fifo_write; |
109 | | |
110 | | int ypos; |
111 | | int current_row; |
112 | | |
113 | | UINT8 cursor_blink_cnt; |
114 | | UINT8 char_blink_cnt; |
115 | | |
116 | | UINT8 next_in_fifo; |
117 | | |
118 | | UINT8 lineattr; |
119 | | UINT8 rvv; |
120 | | UINT8 gpa; |
121 | | UINT8 hlgt; |
122 | | UINT8 underline; |
123 | | UINT8 blink; |
124 | | |
125 | | UINT8 last_data; |
126 | 62 | }; |
127 | 63 | |
128 | | INLINE i8275_t *get_safe_token(device_t *device) |
129 | | { |
130 | | assert(device != NULL); |
131 | | assert(device->type() == I8275); |
132 | | |
133 | | return (i8275_t *)downcast<i8275_device *>(device)->token(); |
134 | | } |
135 | | |
136 | | |
137 | 64 | /* Register Access */ |
138 | | static UINT8 i8275_get_parameter_light_pen(device_t *device, offs_t offset) |
| 65 | UINT8 i8275_device::get_parameter_light_pen(offs_t offset) |
139 | 66 | { |
140 | | i8275_t *i8275 = get_safe_token(device); |
141 | 67 | UINT8 val = 0; |
142 | 68 | |
143 | 69 | switch(offset) { |
144 | 70 | case 0 : |
145 | | val = i8275->light_pen_col; |
| 71 | val = m_light_pen_col; |
146 | 72 | break; |
147 | 73 | case 1 : |
148 | | val = i8275->light_pen_row; |
| 74 | val = m_light_pen_row; |
149 | 75 | break; |
150 | 76 | } |
151 | 77 | return val; |
152 | 78 | } |
153 | 79 | |
154 | | READ8_DEVICE_HANDLER( i8275_r ) |
| 80 | READ8_MEMBER( i8275_device::read ) |
155 | 81 | { |
156 | 82 | UINT8 val; |
157 | | i8275_t *i8275 = get_safe_token(device); |
158 | 83 | |
159 | 84 | if (offset & 0x01) |
160 | 85 | { |
161 | 86 | /* Status register */ |
162 | | val = i8275->status_reg; |
| 87 | val = m_status_reg; |
163 | 88 | /* status reset after read */ |
164 | | i8275->status_reg &= ~I8275_STATUS_FIFO_OVERRUN; |
165 | | i8275->status_reg &= ~I8275_STATUS_DMA_UNDERRUN; |
166 | | i8275->status_reg &= ~I8275_STATUS_IMPROPER_COMMAND; |
167 | | i8275->status_reg &= ~I8275_STATUS_LIGHT_PEN; |
168 | | i8275->status_reg &= ~I8275_STATUS_INTERRUPT_REQUEST; |
| 89 | m_status_reg &= ~I8275_STATUS_FIFO_OVERRUN; |
| 90 | m_status_reg &= ~I8275_STATUS_DMA_UNDERRUN; |
| 91 | m_status_reg &= ~I8275_STATUS_IMPROPER_COMMAND; |
| 92 | m_status_reg &= ~I8275_STATUS_LIGHT_PEN; |
| 93 | m_status_reg &= ~I8275_STATUS_INTERRUPT_REQUEST; |
169 | 94 | } |
170 | 95 | else |
171 | 96 | { |
172 | 97 | /* Parameter register */ |
173 | 98 | val = 0x00; |
174 | | if (i8275->param_type==I8275_PARAM_READ) { |
175 | | if (i8275->num_of_params > 0) { |
176 | | val = i8275_get_parameter_light_pen(device, 2 - i8275->num_of_params); |
177 | | i8275->num_of_params--; |
| 99 | if (m_param_type==I8275_PARAM_READ) { |
| 100 | if (m_num_of_params > 0) { |
| 101 | val = get_parameter_light_pen(2 - m_num_of_params); |
| 102 | m_num_of_params--; |
178 | 103 | } else { |
179 | | i8275->status_reg |= I8275_STATUS_IMPROPER_COMMAND; |
| 104 | m_status_reg |= I8275_STATUS_IMPROPER_COMMAND; |
180 | 105 | } |
181 | 106 | } else { |
182 | 107 | LOG(("i8275 : ERROR reading parameter\n")); |
183 | | i8275->status_reg |= I8275_STATUS_IMPROPER_COMMAND; |
| 108 | m_status_reg |= I8275_STATUS_IMPROPER_COMMAND; |
184 | 109 | } |
185 | 110 | } |
186 | 111 | return val; |
187 | 112 | } |
188 | 113 | |
189 | | static void i8275_recompute_parameters(device_t *device) |
| 114 | void i8275_device::recompute_parameters() |
190 | 115 | { |
191 | | i8275_t *i8275 = get_safe_token(device); |
192 | 116 | int horiz_pix_total = 0; |
193 | 117 | int vert_pix_total = 0; |
194 | 118 | rectangle visarea; |
195 | 119 | |
196 | | horiz_pix_total = (i8275->chars_per_row + 1) * i8275->intf->width; |
197 | | vert_pix_total = (i8275->lines_per_row + 1) * (i8275->rows_per_frame + 1); |
198 | | if (i8275->rows_type==1) { |
| 120 | horiz_pix_total = (m_chars_per_row + 1) * m_width; |
| 121 | vert_pix_total = (m_lines_per_row + 1) * (m_rows_per_frame + 1); |
| 122 | if (m_rows_type==1) { |
199 | 123 | vert_pix_total *= 2; // Use of spaced rows |
200 | 124 | } |
201 | 125 | |
202 | 126 | visarea.set(0, horiz_pix_total - 1, 0, vert_pix_total - 1); |
203 | 127 | |
204 | | i8275->screen->configure(horiz_pix_total, vert_pix_total, visarea, |
205 | | i8275->screen->frame_period().attoseconds); |
| 128 | m_screen->configure(horiz_pix_total, vert_pix_total, visarea, |
| 129 | m_screen->frame_period().attoseconds); |
206 | 130 | } |
207 | 131 | |
208 | | static void i8275_set_parameter_reset(device_t *device, offs_t offset, UINT8 data) |
| 132 | void i8275_device::set_parameter_reset(offs_t offset, UINT8 data) |
209 | 133 | { |
210 | | i8275_t *i8275 = get_safe_token(device); |
211 | 134 | switch(offset) { |
212 | 135 | case 0 : |
213 | | i8275->rows_type = (data >> 7) & 1; |
214 | | i8275->chars_per_row = data & 0x7f; |
| 136 | m_rows_type = (data >> 7) & 1; |
| 137 | m_chars_per_row = data & 0x7f; |
215 | 138 | break; |
216 | 139 | case 1 : |
217 | | i8275->vert_retrace_rows = (data >> 6) & 3; |
218 | | i8275->rows_per_frame = data & 0x3f; |
| 140 | m_vert_retrace_rows = (data >> 6) & 3; |
| 141 | m_rows_per_frame = data & 0x3f; |
219 | 142 | break; |
220 | 143 | case 2 : |
221 | | i8275->undeline_line_num = (data >> 4) & 0x0f; |
222 | | i8275->lines_per_row = data & 0x0f; |
| 144 | m_undeline_line_num = (data >> 4) & 0x0f; |
| 145 | m_lines_per_row = data & 0x0f; |
223 | 146 | break; |
224 | 147 | case 3 : |
225 | | i8275->line_counter_mode = (data >> 7) & 1; |
226 | | i8275->field_attribute_mode = (data >> 6) & 1; |
227 | | i8275->cursor_format = (data >> 4) & 3; |
228 | | i8275->hor_retrace_count = data & 0x0f; |
| 148 | m_line_counter_mode = (data >> 7) & 1; |
| 149 | m_field_attribute_mode = (data >> 6) & 1; |
| 150 | m_cursor_format = (data >> 4) & 3; |
| 151 | m_hor_retrace_count = data & 0x0f; |
229 | 152 | break; |
230 | 153 | } |
231 | 154 | } |
232 | 155 | |
233 | | static void i8275_set_parameter_cursor(device_t *device, offs_t offset, UINT8 data) |
| 156 | void i8275_device::set_parameter_cursor(offs_t offset, UINT8 data) |
234 | 157 | { |
235 | | i8275_t *i8275 = get_safe_token(device); |
236 | 158 | switch(offset) { |
237 | 159 | case 0 : |
238 | | i8275->cursor_col = data; |
| 160 | m_cursor_col = data; |
239 | 161 | break; |
240 | 162 | case 1 : |
241 | | i8275->cursor_row = data; |
| 163 | m_cursor_row = data; |
242 | 164 | break; |
243 | 165 | } |
244 | 166 | } |
245 | 167 | |
246 | 168 | |
247 | | WRITE8_DEVICE_HANDLER( i8275_w ) |
| 169 | WRITE8_MEMBER( i8275_device::write ) |
248 | 170 | { |
249 | | i8275_t *i8275 = get_safe_token(device); |
250 | | |
251 | 171 | if (offset & 0x01) |
252 | 172 | { |
253 | 173 | /* Command register */ |
254 | | if (i8275->num_of_params != 0) { |
255 | | i8275->status_reg |= I8275_STATUS_IMPROPER_COMMAND; |
| 174 | if (m_num_of_params != 0) { |
| 175 | m_status_reg |= I8275_STATUS_IMPROPER_COMMAND; |
256 | 176 | return; |
257 | 177 | } |
258 | | i8275->current_command = (data >> 5) & 7; |
259 | | i8275->num_of_params = I8275_PARAM_NONE; |
260 | | i8275->param_type = I8275_PARAM_NONE; |
261 | | switch(i8275->current_command) { |
| 178 | m_current_command = (data >> 5) & 7; |
| 179 | m_num_of_params = I8275_PARAM_NONE; |
| 180 | m_param_type = I8275_PARAM_NONE; |
| 181 | switch(m_current_command) { |
262 | 182 | case I8275_COMMAND_RESET : |
263 | | i8275->num_of_params = I8275_PARAM_RESET; |
264 | | i8275->param_type = I8275_PARAM_WRITE; |
| 183 | m_num_of_params = I8275_PARAM_RESET; |
| 184 | m_param_type = I8275_PARAM_WRITE; |
265 | 185 | /* set status register */ |
266 | | i8275->status_reg &= ~I8275_STATUS_INTERRUPT_ENABLE; |
267 | | i8275->status_reg &= ~I8275_STATUS_VIDEO_ENABLE; |
| 186 | m_status_reg &= ~I8275_STATUS_INTERRUPT_ENABLE; |
| 187 | m_status_reg &= ~I8275_STATUS_VIDEO_ENABLE; |
268 | 188 | break; |
269 | 189 | case I8275_COMMAND_START_DISPLAY: |
270 | | i8275->burst_space_code = (data >> 2) & 7; |
271 | | i8275->burst_count_code = data & 3; |
| 190 | m_burst_space_code = (data >> 2) & 7; |
| 191 | m_burst_count_code = data & 3; |
272 | 192 | /* set status register */ |
273 | | i8275->status_reg |= I8275_STATUS_VIDEO_ENABLE; |
274 | | i8275->status_reg |= I8275_STATUS_INTERRUPT_ENABLE; |
275 | | i8275_recompute_parameters(device); |
| 193 | m_status_reg |= I8275_STATUS_VIDEO_ENABLE; |
| 194 | m_status_reg |= I8275_STATUS_INTERRUPT_ENABLE; |
| 195 | recompute_parameters(); |
276 | 196 | break; |
277 | 197 | case I8275_COMMAND_STOP_DISPLAY : |
278 | 198 | /* set status register */ |
279 | | i8275->status_reg &= ~I8275_STATUS_VIDEO_ENABLE; |
| 199 | m_status_reg &= ~I8275_STATUS_VIDEO_ENABLE; |
280 | 200 | break; |
281 | 201 | case I8275_COMMAND_READ_LIGHT_PEN: |
282 | | i8275->num_of_params = I8275_PARAM_READ_LIGHT_PEN; |
283 | | i8275->param_type = I8275_PARAM_READ; |
| 202 | m_num_of_params = I8275_PARAM_READ_LIGHT_PEN; |
| 203 | m_param_type = I8275_PARAM_READ; |
284 | 204 | break; |
285 | 205 | case I8275_COMMAND_LOAD_CURSOR : |
286 | | i8275->num_of_params = I8275_PARAM_LOAD_CURSOR; |
287 | | i8275->param_type = I8275_PARAM_WRITE; |
| 206 | m_num_of_params = I8275_PARAM_LOAD_CURSOR; |
| 207 | m_param_type = I8275_PARAM_WRITE; |
288 | 208 | break; |
289 | 209 | case I8275_COMMAND_ENABLE_INTERRUPT : |
290 | 210 | /* set status register */ |
291 | | i8275->status_reg |= I8275_STATUS_INTERRUPT_ENABLE; |
| 211 | m_status_reg |= I8275_STATUS_INTERRUPT_ENABLE; |
292 | 212 | break; |
293 | 213 | case I8275_COMMAND_DISABLE_INTERRUPT: |
294 | 214 | /* set status register */ |
295 | | i8275->status_reg &= ~I8275_STATUS_INTERRUPT_ENABLE; |
| 215 | m_status_reg &= ~I8275_STATUS_INTERRUPT_ENABLE; |
296 | 216 | break; |
297 | 217 | case I8275_COMMAND_PRESET_COUNTERS : |
298 | 218 | break; |
r19910 | r19911 | |
301 | 221 | else |
302 | 222 | { |
303 | 223 | /* Parameter register */ |
304 | | if (i8275->param_type==I8275_PARAM_WRITE) { |
305 | | if (i8275->num_of_params > 0) { |
306 | | if (i8275->current_command == I8275_COMMAND_RESET) { |
307 | | i8275_set_parameter_reset(device, 4 - i8275->num_of_params ,data); |
| 224 | if (m_param_type==I8275_PARAM_WRITE) { |
| 225 | if (m_num_of_params > 0) { |
| 226 | if (m_current_command == I8275_COMMAND_RESET) { |
| 227 | set_parameter_reset(4 - m_num_of_params ,data); |
308 | 228 | } else { |
309 | | i8275_set_parameter_cursor(device, 2 - i8275->num_of_params, data); |
| 229 | set_parameter_cursor(2 - m_num_of_params, data); |
310 | 230 | } |
311 | | i8275->num_of_params--; |
| 231 | m_num_of_params--; |
312 | 232 | } else { |
313 | | i8275->status_reg |= I8275_STATUS_IMPROPER_COMMAND; |
| 233 | m_status_reg |= I8275_STATUS_IMPROPER_COMMAND; |
314 | 234 | } |
315 | 235 | } else { |
316 | 236 | LOG(("i8275 : ERROR writing parameter\n")); |
317 | | i8275->status_reg |= I8275_STATUS_IMPROPER_COMMAND; |
| 237 | m_status_reg |= I8275_STATUS_IMPROPER_COMMAND; |
318 | 238 | } |
319 | 239 | } |
320 | 240 | } |
321 | 241 | |
322 | 242 | |
323 | | static void i8275_draw_char_line(device_t *device) |
| 243 | void i8275_device::draw_char_line() |
324 | 244 | { |
325 | | i8275_t *i8275 = get_safe_token(device); |
326 | 245 | int xpos = 0; |
327 | 246 | int line = 0; |
328 | 247 | UINT8 lc = 0; |
r19910 | r19911 | |
330 | 249 | UINT8 lten = 0; |
331 | 250 | UINT8 fifo_read = 0; |
332 | 251 | |
333 | | for(line=0;line<=i8275->lines_per_row;line++) { |
| 252 | for(line=0;line<=m_lines_per_row;line++) { |
334 | 253 | // If line counter is 1 then select right values |
335 | | lc = (i8275->line_counter_mode==1) ? (line - 1) % i8275->lines_per_row : line; |
| 254 | lc = (m_line_counter_mode==1) ? (line - 1) % m_lines_per_row : line; |
336 | 255 | fifo_read = 0; |
337 | | for(xpos=0;xpos<=i8275->chars_per_row;xpos++) { |
338 | | UINT8 chr = (i8275->buffer_used==0) ? i8275->row_buffer_2[xpos] : i8275->row_buffer_1[xpos]; |
339 | | if (i8275->undeline_line_num & 0x08) { |
340 | | vsp = (line==0 || line==i8275->lines_per_row) ? 1 : 0; |
| 256 | for(xpos=0;xpos<=m_chars_per_row;xpos++) { |
| 257 | UINT8 chr = (m_buffer_used==0) ? m_row_buffer_2[xpos] : m_row_buffer_1[xpos]; |
| 258 | if (m_undeline_line_num & 0x08) { |
| 259 | vsp = (line==0 || line==m_lines_per_row) ? 1 : 0; |
341 | 260 | } |
342 | 261 | |
343 | 262 | if ((chr & 0x80)==0x80) { |
344 | 263 | if ((chr & 0xc0)==0xc0) { |
345 | 264 | // character attribute code |
346 | | i8275->lineattr = 0; |
| 265 | m_lineattr = 0; |
347 | 266 | } else { |
348 | 267 | // field attribute code |
349 | | i8275->hlgt = chr & 1; |
350 | | i8275->blink = (chr >> 1) & 1; |
351 | | i8275->gpa = (chr >> 2) & 3; |
352 | | i8275->rvv = (chr >> 4) & 1; |
353 | | i8275->underline = (chr >> 5) & 1; |
| 268 | m_hlgt = chr & 1; |
| 269 | m_blink = (chr >> 1) & 1; |
| 270 | m_gpa = (chr >> 2) & 3; |
| 271 | m_rvv = (chr >> 4) & 1; |
| 272 | m_underline = (chr >> 5) & 1; |
354 | 273 | } |
355 | 274 | |
356 | | if (i8275->field_attribute_mode==0) { |
357 | | chr = (i8275->buffer_used==0) ? i8275->fifo_buffer_2[fifo_read] : i8275->fifo_buffer_1[fifo_read]; |
| 275 | if (m_field_attribute_mode==0) { |
| 276 | chr = (m_buffer_used==0) ? m_fifo_buffer_2[fifo_read] : m_fifo_buffer_1[fifo_read]; |
358 | 277 | fifo_read = (fifo_read + 1 ) % 16; |
359 | 278 | } else { |
360 | 279 | vsp = 1; |
361 | 280 | } |
362 | 281 | } |
363 | | if (vsp==0 && i8275->blink) { |
364 | | vsp = (i8275->char_blink_cnt < 32) ? 1: 0; |
| 282 | if (vsp==0 && m_blink) { |
| 283 | vsp = (m_char_blink_cnt < 32) ? 1: 0; |
365 | 284 | } |
366 | | if ((i8275->current_row == i8275->cursor_row) && (xpos == i8275->cursor_col - i8275->intf->char_delay)) { |
| 285 | if ((m_current_row == m_cursor_row) && (xpos == m_cursor_col - m_char_delay)) { |
367 | 286 | int vis = 1; |
368 | | if ((i8275->cursor_format & 2)==0) { |
369 | | vis = (i8275->cursor_blink_cnt<16) ? 1 : 0; |
| 287 | if ((m_cursor_format & 2)==0) { |
| 288 | vis = (m_cursor_blink_cnt<16) ? 1 : 0; |
370 | 289 | } |
371 | | if ((i8275->cursor_format & 1)==1) { |
372 | | lten = (line == i8275->undeline_line_num) ? vis : 0; //underline |
| 290 | if ((m_cursor_format & 1)==1) { |
| 291 | lten = (line == m_undeline_line_num) ? vis : 0; //underline |
373 | 292 | } else { |
374 | 293 | lten = vis; // block cursor |
375 | 294 | } |
r19910 | r19911 | |
377 | 296 | lten = 0; |
378 | 297 | } |
379 | 298 | |
380 | | i8275->intf->display_pixels(device, |
381 | | xpos * i8275->intf->width, // x position on screen of starting point |
382 | | i8275->ypos, // y position on screen |
| 299 | m_display_pixels_func(this, m_bitmap, |
| 300 | xpos * m_width, // x position on screen of starting point |
| 301 | m_ypos, // y position on screen |
383 | 302 | lc, // current line of char |
384 | 303 | (chr & 0x7f), // char code to be displayed |
385 | | i8275->lineattr, // line attribute code |
386 | | lten | i8275->underline, // light enable signal |
387 | | i8275->rvv, // reverse video signal |
| 304 | m_lineattr, // line attribute code |
| 305 | lten | m_underline, // light enable signal |
| 306 | m_rvv, // reverse video signal |
388 | 307 | vsp, // video suppression |
389 | | i8275->gpa, // general purpose attribute code |
390 | | i8275->hlgt // highlight |
| 308 | m_gpa, // general purpose attribute code |
| 309 | m_hlgt // highlight |
391 | 310 | ); |
392 | 311 | vsp = 0; |
393 | 312 | } |
394 | | i8275->ypos++; |
| 313 | m_ypos++; |
395 | 314 | } |
396 | | i8275->current_row++; |
| 315 | m_current_row++; |
397 | 316 | } |
398 | 317 | |
399 | | WRITE8_DEVICE_HANDLER( i8275_dack_w ) |
| 318 | WRITE8_MEMBER( i8275_device::dack_w ) |
400 | 319 | { |
401 | | i8275_t *i8275 = get_safe_token(device); |
402 | | |
403 | | if (i8275->next_in_fifo == 1) |
| 320 | if (m_next_in_fifo == 1) |
404 | 321 | { |
405 | | i8275->next_in_fifo = 0; |
| 322 | m_next_in_fifo = 0; |
406 | 323 | |
407 | | if(i8275->buffer_used == 0) |
| 324 | if(m_buffer_used == 0) |
408 | 325 | { |
409 | | i8275->fifo_buffer_1[i8275->fifo_write] = data & 0x7f; |
| 326 | m_fifo_buffer_1[m_fifo_write] = data & 0x7f; |
410 | 327 | } |
411 | 328 | else |
412 | 329 | { |
413 | | i8275->fifo_buffer_2[i8275->fifo_write] = data & 0x7f; |
| 330 | m_fifo_buffer_2[m_fifo_write] = data & 0x7f; |
414 | 331 | } |
415 | | i8275->fifo_write = (i8275->fifo_write + 1) % 16; |
| 332 | m_fifo_write = (m_fifo_write + 1) % 16; |
416 | 333 | |
417 | | if (i8275->last_data == 0xf1) { |
418 | | i8275->row_pos = i8275->chars_per_row + 1; |
| 334 | if (m_last_data == 0xf1) { |
| 335 | m_row_pos = m_chars_per_row + 1; |
419 | 336 | } |
420 | 337 | } |
421 | 338 | else |
422 | 339 | { |
423 | | if(i8275->buffer_used == 0) |
| 340 | if(m_buffer_used == 0) |
424 | 341 | { |
425 | | i8275->row_buffer_1[i8275->row_pos++] = data; |
| 342 | m_row_buffer_1[m_row_pos++] = data; |
426 | 343 | } |
427 | 344 | else |
428 | 345 | { |
429 | | i8275->row_buffer_2[i8275->row_pos++] = data; |
| 346 | m_row_buffer_2[m_row_pos++] = data; |
430 | 347 | } |
431 | | if (i8275->field_attribute_mode==0) |
| 348 | if (m_field_attribute_mode==0) |
432 | 349 | { |
433 | 350 | if ((data & 0x80)==0x80) |
434 | 351 | { |
435 | | i8275->last_data = data; |
436 | | i8275->next_in_fifo = 1; |
| 352 | m_last_data = data; |
| 353 | m_next_in_fifo = 1; |
437 | 354 | } |
438 | 355 | } |
439 | 356 | } |
440 | 357 | |
441 | | if ((i8275->row_pos - 1)==i8275->chars_per_row ) |
| 358 | if ((m_row_pos - 1)==m_chars_per_row ) |
442 | 359 | { |
443 | | i8275->buffer_used = (i8275->buffer_used==0) ? 1 : 0; |
444 | | i8275->row_pos = 0; |
445 | | i8275->fifo_write = 0; |
446 | | i8275_draw_char_line(device); |
| 360 | m_buffer_used = (m_buffer_used==0) ? 1 : 0; |
| 361 | m_row_pos = 0; |
| 362 | m_fifo_write = 0; |
| 363 | draw_char_line(); |
447 | 364 | } |
448 | | if (i8275->current_row == (i8275->rows_per_frame + 1)) |
| 365 | if (m_current_row == (m_rows_per_frame + 1)) |
449 | 366 | { |
450 | | i8275->ypos = 0; |
451 | | i8275->current_row = 0; |
| 367 | m_ypos = 0; |
| 368 | m_current_row = 0; |
452 | 369 | |
453 | | i8275->out_drq_func(0); |
| 370 | m_out_drq_func(0); |
454 | 371 | } |
455 | 372 | } |
456 | 373 | |
457 | 374 | /* Screen Update */ |
458 | | void i8275_update(device_t *device, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 375 | UINT32 i8275_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
459 | 376 | { |
460 | | i8275_t *i8275 = get_safe_token(device); |
461 | | i8275->ypos = 0; |
462 | | i8275->lineattr = 0; |
463 | | i8275->rvv = 0; |
464 | | i8275->gpa = 0; |
465 | | i8275->hlgt = 0; |
466 | | i8275->underline = 0; |
467 | | i8275->blink = 0; |
468 | | i8275->row_pos = 0; |
469 | | i8275->fifo_write = 0; |
| 377 | m_ypos = 0; |
| 378 | m_lineattr = 0; |
| 379 | m_rvv = 0; |
| 380 | m_gpa = 0; |
| 381 | m_hlgt = 0; |
| 382 | m_underline = 0; |
| 383 | m_blink = 0; |
| 384 | m_row_pos = 0; |
| 385 | m_fifo_write = 0; |
470 | 386 | |
471 | | if ((i8275->status_reg & I8275_STATUS_VIDEO_ENABLE)==0) { |
472 | | bitmap.fill(get_black_pen(device->machine()), cliprect); |
| 387 | if ((m_status_reg & I8275_STATUS_VIDEO_ENABLE)==0) { |
| 388 | bitmap.fill(get_black_pen(machine()), cliprect); |
473 | 389 | } else { |
474 | 390 | // if value < 16 it is visible otherwise not |
475 | | i8275->cursor_blink_cnt++; |
476 | | if(i8275->cursor_blink_cnt==32) i8275->cursor_blink_cnt = 0; |
| 391 | m_cursor_blink_cnt++; |
| 392 | if(m_cursor_blink_cnt==32) m_cursor_blink_cnt = 0; |
477 | 393 | // if value < 32 it is visible otherwise not |
478 | | i8275->char_blink_cnt++; |
479 | | if(i8275->char_blink_cnt==64) i8275->char_blink_cnt = 0; |
| 394 | m_char_blink_cnt++; |
| 395 | if(m_char_blink_cnt==64) m_char_blink_cnt = 0; |
480 | 396 | |
481 | | i8275->out_drq_func(1); |
| 397 | m_out_drq_func(1); |
482 | 398 | } |
483 | | if (i8275->status_reg & I8275_STATUS_INTERRUPT_ENABLE) { |
484 | | i8275->status_reg |= I8275_STATUS_INTERRUPT_REQUEST; |
| 399 | if (m_status_reg & I8275_STATUS_INTERRUPT_ENABLE) { |
| 400 | m_status_reg |= I8275_STATUS_INTERRUPT_REQUEST; |
485 | 401 | } |
| 402 | |
| 403 | copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); |
| 404 | |
| 405 | return 0; |
486 | 406 | } |
487 | 407 | |
488 | 408 | /* Device Interface */ |
489 | 409 | |
490 | | static DEVICE_START( i8275 ) |
491 | | { |
492 | | i8275_t *i8275 = get_safe_token(device); |
493 | | |
494 | | /* validate arguments */ |
495 | | assert(device != NULL); |
496 | | assert(device->tag() != NULL); |
497 | | assert(device->static_config() != NULL); |
498 | | |
499 | | i8275->intf = (const i8275_interface*)device->static_config(); |
500 | | |
501 | | assert(i8275->intf->display_pixels != NULL); |
502 | | |
503 | | /* get the screen device */ |
504 | | i8275->screen = device->machine().device<screen_device>(i8275->intf->screen_tag); |
505 | | |
506 | | |
507 | | assert(i8275->screen != NULL); |
508 | | |
509 | | /* resolve callbacks */ |
510 | | i8275->out_drq_func.resolve(i8275->intf->out_drq_func, *device); |
511 | | i8275->out_irq_func.resolve(i8275->intf->out_irq_func, *device); |
512 | | |
513 | | /* register for state saving */ |
514 | | device->save_item(NAME(i8275->status_reg)); |
515 | | device->save_item(NAME(i8275->num_of_params)); |
516 | | device->save_item(NAME(i8275->current_command)); |
517 | | device->save_item(NAME(i8275->param_type)); |
518 | | |
519 | | device->save_item(NAME(i8275->cursor_col)); |
520 | | device->save_item(NAME(i8275->cursor_row)); |
521 | | |
522 | | device->save_item(NAME(i8275->light_pen_col)); |
523 | | device->save_item(NAME(i8275->light_pen_row)); |
524 | | |
525 | | device->save_item(NAME(i8275->rows_type)); |
526 | | device->save_item(NAME(i8275->chars_per_row)); |
527 | | device->save_item(NAME(i8275->vert_retrace_rows)); |
528 | | device->save_item(NAME(i8275->rows_per_frame)); |
529 | | device->save_item(NAME(i8275->undeline_line_num)); |
530 | | device->save_item(NAME(i8275->lines_per_row)); |
531 | | device->save_item(NAME(i8275->line_counter_mode)); |
532 | | device->save_item(NAME(i8275->field_attribute_mode)); |
533 | | device->save_item(NAME(i8275->cursor_format)); |
534 | | device->save_item(NAME(i8275->hor_retrace_count)); |
535 | | |
536 | | device->save_item(NAME(i8275->burst_space_code)); |
537 | | device->save_item(NAME(i8275->burst_count_code)); |
538 | | } |
539 | | |
540 | | static DEVICE_RESET( i8275 ) |
541 | | { |
542 | | i8275_t *i8275 = get_safe_token(device); |
543 | | |
544 | | i8275->status_reg = 0; |
545 | | i8275->num_of_params = 0; |
546 | | i8275->current_command = 0; |
547 | | i8275->param_type = 0; |
548 | | |
549 | | i8275->cursor_col = 0; |
550 | | i8275->cursor_row = 0; |
551 | | |
552 | | i8275->light_pen_col = 0; |
553 | | i8275->light_pen_row = 0; |
554 | | |
555 | | i8275->rows_type = 0; |
556 | | i8275->chars_per_row = 0; |
557 | | i8275->vert_retrace_rows = 0; |
558 | | i8275->rows_per_frame = 0; |
559 | | i8275->undeline_line_num = 0; |
560 | | i8275->lines_per_row = 0; |
561 | | i8275->line_counter_mode = 0; |
562 | | i8275->field_attribute_mode = 0; |
563 | | i8275->cursor_format = 0; |
564 | | i8275->hor_retrace_count = 0; |
565 | | |
566 | | i8275->burst_space_code = 0; |
567 | | i8275->burst_count_code = 0; |
568 | | |
569 | | i8275->row_pos = 0; |
570 | | i8275->buffer_used = 0; |
571 | | |
572 | | i8275->fifo_write = 0; |
573 | | |
574 | | i8275->ypos = 0; |
575 | | i8275->current_row = 0; |
576 | | |
577 | | i8275->cursor_blink_cnt = 0; |
578 | | i8275->char_blink_cnt = 0; |
579 | | i8275->next_in_fifo = 0; |
580 | | |
581 | | i8275->lineattr = 0; |
582 | | i8275->rvv = 0; |
583 | | i8275->gpa = 0; |
584 | | i8275->hlgt = 0; |
585 | | i8275->underline = 0; |
586 | | i8275->blink = 0; |
587 | | } |
588 | | |
589 | 410 | const device_type I8275 = &device_creator<i8275_device>; |
590 | 411 | |
591 | 412 | i8275_device::i8275_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
592 | 413 | : device_t(mconfig, I8275, "Intel 8275", tag, owner, clock) |
593 | 414 | { |
594 | | m_token = global_alloc_clear(i8275_t); |
595 | 415 | } |
596 | 416 | |
| 417 | |
597 | 418 | //------------------------------------------------- |
598 | 419 | // device_config_complete - perform any |
599 | 420 | // operations now that the configuration is |
r19910 | r19911 | |
602 | 423 | |
603 | 424 | void i8275_device::device_config_complete() |
604 | 425 | { |
| 426 | // inherit a copy of the static data |
| 427 | const i8275_interface *intf = reinterpret_cast<const i8275_interface *>(static_config()); |
| 428 | if (intf != NULL) |
| 429 | *static_cast<i8275_interface *>(this) = *intf; |
| 430 | |
| 431 | // or initialize to defaults if none provided |
| 432 | else |
| 433 | { |
| 434 | memset(&m_out_drq_cb, 0, sizeof(m_out_drq_cb)); |
| 435 | memset(&m_out_irq_cb, 0, sizeof(m_out_irq_cb)); |
| 436 | memset(&m_out_hrtc_cb, 0, sizeof(m_out_hrtc_cb)); |
| 437 | memset(&m_out_vrtc_cb, 0, sizeof(m_out_vrtc_cb)); |
| 438 | } |
605 | 439 | } |
606 | 440 | |
| 441 | |
607 | 442 | //------------------------------------------------- |
608 | 443 | // device_start - device-specific startup |
609 | 444 | //------------------------------------------------- |
610 | 445 | |
611 | 446 | void i8275_device::device_start() |
612 | 447 | { |
613 | | DEVICE_START_NAME( i8275 )(this); |
| 448 | /* get the screen device */ |
| 449 | m_screen = machine().device<screen_device>(m_screen_tag); |
| 450 | assert(m_screen != NULL); |
| 451 | m_screen->register_screen_bitmap(m_bitmap); |
| 452 | |
| 453 | /* resolve callbacks */ |
| 454 | m_out_drq_func.resolve(m_out_drq_cb, *this); |
| 455 | m_out_irq_func.resolve(m_out_irq_cb, *this); |
| 456 | m_out_hrtc_func.resolve(m_out_hrtc_cb, *this); |
| 457 | m_out_vrtc_func.resolve(m_out_vrtc_cb, *this); |
| 458 | |
| 459 | /* register for state saving */ |
| 460 | save_item(NAME(m_status_reg)); |
| 461 | save_item(NAME(m_num_of_params)); |
| 462 | save_item(NAME(m_current_command)); |
| 463 | save_item(NAME(m_param_type)); |
| 464 | |
| 465 | save_item(NAME(m_cursor_col)); |
| 466 | save_item(NAME(m_cursor_row)); |
| 467 | |
| 468 | save_item(NAME(m_light_pen_col)); |
| 469 | save_item(NAME(m_light_pen_row)); |
| 470 | |
| 471 | save_item(NAME(m_rows_type)); |
| 472 | save_item(NAME(m_chars_per_row)); |
| 473 | save_item(NAME(m_vert_retrace_rows)); |
| 474 | save_item(NAME(m_rows_per_frame)); |
| 475 | save_item(NAME(m_undeline_line_num)); |
| 476 | save_item(NAME(m_lines_per_row)); |
| 477 | save_item(NAME(m_line_counter_mode)); |
| 478 | save_item(NAME(m_field_attribute_mode)); |
| 479 | save_item(NAME(m_cursor_format)); |
| 480 | save_item(NAME(m_hor_retrace_count)); |
| 481 | |
| 482 | save_item(NAME(m_burst_space_code)); |
| 483 | save_item(NAME(m_burst_count_code)); |
614 | 484 | } |
615 | 485 | |
616 | 486 | //------------------------------------------------- |
r19910 | r19911 | |
619 | 489 | |
620 | 490 | void i8275_device::device_reset() |
621 | 491 | { |
622 | | DEVICE_RESET_NAME( i8275 )(this); |
623 | | } |
| 492 | m_status_reg = 0; |
| 493 | m_num_of_params = 0; |
| 494 | m_current_command = 0; |
| 495 | m_param_type = 0; |
624 | 496 | |
| 497 | m_cursor_col = 0; |
| 498 | m_cursor_row = 0; |
625 | 499 | |
| 500 | m_light_pen_col = 0; |
| 501 | m_light_pen_row = 0; |
| 502 | |
| 503 | m_rows_type = 0; |
| 504 | m_chars_per_row = 0; |
| 505 | m_vert_retrace_rows = 0; |
| 506 | m_rows_per_frame = 0; |
| 507 | m_undeline_line_num = 0; |
| 508 | m_lines_per_row = 0; |
| 509 | m_line_counter_mode = 0; |
| 510 | m_field_attribute_mode = 0; |
| 511 | m_cursor_format = 0; |
| 512 | m_hor_retrace_count = 0; |
| 513 | |
| 514 | m_burst_space_code = 0; |
| 515 | m_burst_count_code = 0; |
| 516 | |
| 517 | m_row_pos = 0; |
| 518 | m_buffer_used = 0; |
| 519 | |
| 520 | m_fifo_write = 0; |
| 521 | |
| 522 | m_ypos = 0; |
| 523 | m_current_row = 0; |
| 524 | |
| 525 | m_cursor_blink_cnt = 0; |
| 526 | m_char_blink_cnt = 0; |
| 527 | m_next_in_fifo = 0; |
| 528 | |
| 529 | m_lineattr = 0; |
| 530 | m_rvv = 0; |
| 531 | m_gpa = 0; |
| 532 | m_hlgt = 0; |
| 533 | m_underline = 0; |
| 534 | m_blink = 0; |
| 535 | } |
trunk/src/emu/video/i8275.h
r19910 | r19911 | |
12 | 12 | #ifndef __I8275_VIDEO__ |
13 | 13 | #define __I8275_VIDEO__ |
14 | 14 | |
15 | | #include "devcb.h" |
| 15 | #include "emu.h" |
16 | 16 | |
17 | | /*************************************************************************** |
18 | | MACROS |
19 | | ***************************************************************************/ |
20 | 17 | |
21 | | class i8275_device : public device_t |
| 18 | |
| 19 | //************************************************************************** |
| 20 | // INTERFACE CONFIGURATION MACROS |
| 21 | //************************************************************************** |
| 22 | |
| 23 | #define MCFG_I8275_ADD(_tag, _intrf) \ |
| 24 | MCFG_DEVICE_ADD(_tag, I8275, 0) \ |
| 25 | MCFG_DEVICE_CONFIG(_intrf) |
| 26 | |
| 27 | |
| 28 | #define I8275_INTERFACE(name) \ |
| 29 | const i8275_interface (name) = |
| 30 | |
| 31 | |
| 32 | |
| 33 | //************************************************************************** |
| 34 | // TYPE DEFINITIONS |
| 35 | //************************************************************************** |
| 36 | |
| 37 | class i8275_device; |
| 38 | |
| 39 | // ======================> i8275_display_pixels_func |
| 40 | |
| 41 | typedef void (*i8275_display_pixels_func)(i8275_device *device, bitmap_rgb32 &bitmap, int x, int y, UINT8 linecount, UINT8 charcode, UINT8 lineattr, UINT8 lten, UINT8 rvv, UINT8 vsp, UINT8 gpa, UINT8 hlgt); |
| 42 | #define I8275_DISPLAY_PIXELS(name) void name(i8275_device *device, bitmap_rgb32 &bitmap, int x, int y, UINT8 linecount, UINT8 charcode, UINT8 lineattr, UINT8 lten, UINT8 rvv, UINT8 vsp, UINT8 gpa, UINT8 hlgt) |
| 43 | |
| 44 | |
| 45 | // ======================> i8275_interface |
| 46 | |
| 47 | struct i8275_interface |
22 | 48 | { |
| 49 | const char *m_screen_tag; /* screen we are acting on */ |
| 50 | int m_width; /* char width in pixels */ |
| 51 | int m_char_delay; /* delay of display char */ |
| 52 | |
| 53 | devcb_write_line m_out_drq_cb; |
| 54 | devcb_write_line m_out_irq_cb; |
| 55 | |
| 56 | devcb_write_line m_out_hrtc_cb; |
| 57 | devcb_write_line m_out_vrtc_cb; |
| 58 | |
| 59 | i8275_display_pixels_func m_display_pixels_func; |
| 60 | }; |
| 61 | |
| 62 | |
| 63 | class i8275_device : public device_t, |
| 64 | public i8275_interface |
| 65 | { |
23 | 66 | public: |
24 | 67 | i8275_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
25 | | ~i8275_device() { global_free(m_token); } |
26 | 68 | |
27 | | // access to legacy token |
28 | | void *token() const { assert(m_token != NULL); return m_token; } |
| 69 | DECLARE_READ8_MEMBER( read ); |
| 70 | DECLARE_WRITE8_MEMBER( write ); |
| 71 | |
| 72 | DECLARE_WRITE8_MEMBER( dack_w ); |
| 73 | |
| 74 | UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 75 | |
29 | 76 | protected: |
30 | 77 | // device-level overrides |
31 | 78 | virtual void device_config_complete(); |
32 | 79 | virtual void device_start(); |
33 | 80 | virtual void device_reset(); |
34 | | private: |
35 | | // internal state |
36 | | void *m_token; |
37 | | }; |
38 | 81 | |
39 | | extern const device_type I8275; |
| 82 | UINT8 get_parameter_light_pen(offs_t offset); |
| 83 | void recompute_parameters(); |
| 84 | void set_parameter_reset(offs_t offset, UINT8 data); |
| 85 | void set_parameter_cursor(offs_t offset, UINT8 data); |
| 86 | void draw_char_line(); |
40 | 87 | |
| 88 | devcb_resolved_write_line m_out_drq_func; |
| 89 | devcb_resolved_write_line m_out_irq_func; |
| 90 | devcb_resolved_write_line m_out_hrtc_func; |
| 91 | devcb_resolved_write_line m_out_vrtc_func; |
41 | 92 | |
42 | | /*************************************************************************** |
43 | | TYPE DEFINITIONS |
44 | | ***************************************************************************/ |
| 93 | screen_device *m_screen; |
| 94 | bitmap_rgb32 m_bitmap; |
45 | 95 | |
46 | | typedef void (*i8275_display_pixels_func)(device_t *device, int x, int y, UINT8 linecount, UINT8 charcode, UINT8 lineattr, UINT8 lten, UINT8 rvv, UINT8 vsp, UINT8 gpa, UINT8 hlgt); |
47 | | #define I8275_DISPLAY_PIXELS(name) void name(device_t *device, int x, int y, UINT8 linecount, UINT8 charcode, UINT8 lineattr, UINT8 lten, UINT8 rvv, UINT8 vsp, UINT8 gpa, UINT8 hlgt) |
| 96 | UINT8 m_status_reg; /* value of status reggister */ |
| 97 | UINT8 m_num_of_params; /* expected number of parameters */ |
| 98 | UINT8 m_current_command; /* command currently executing */ |
| 99 | UINT8 m_param_type; /* parameter type */ |
48 | 100 | |
49 | | /* interface */ |
50 | | struct i8275_interface |
51 | | { |
52 | | const char *screen_tag; /* screen we are acting on */ |
53 | | int width; /* char width in pixels */ |
54 | | int char_delay; /* delay of display char */ |
| 101 | UINT8 m_cursor_col; /* current cursor column */ |
| 102 | UINT8 m_cursor_row; /* current cursor row */ |
55 | 103 | |
56 | | devcb_write_line out_drq_func; |
| 104 | UINT8 m_light_pen_col; /* current light pen column */ |
| 105 | UINT8 m_light_pen_row; /* current light pen row */ |
57 | 106 | |
58 | | devcb_write_line out_irq_func; |
| 107 | /* reset command parameter values*/ |
| 108 | /* parameter 0 */ |
| 109 | UINT8 m_rows_type; |
| 110 | UINT8 m_chars_per_row; |
| 111 | /* parameter 1 */ |
| 112 | UINT8 m_vert_retrace_rows; |
| 113 | UINT8 m_rows_per_frame; |
| 114 | /* parameter 2 */ |
| 115 | UINT8 m_undeline_line_num; |
| 116 | UINT8 m_lines_per_row; |
| 117 | /* parameter 3 */ |
| 118 | UINT8 m_line_counter_mode; |
| 119 | UINT8 m_field_attribute_mode; |
| 120 | UINT8 m_cursor_format; |
| 121 | UINT8 m_hor_retrace_count; |
59 | 122 | |
60 | | i8275_display_pixels_func display_pixels; |
61 | | }; |
| 123 | /* values for start display command */ |
| 124 | UINT8 m_burst_space_code; |
| 125 | UINT8 m_burst_count_code; |
62 | 126 | |
63 | | /*************************************************************************** |
64 | | FUNCTION PROTOTYPES |
65 | | ***************************************************************************/ |
| 127 | /* buffers */ |
| 128 | UINT8 m_row_buffer_1[80]; |
| 129 | UINT8 m_row_buffer_2[80]; |
| 130 | UINT8 m_row_pos; |
| 131 | UINT8 m_buffer_used; |
66 | 132 | |
67 | | /* register access */ |
68 | | DECLARE_READ8_DEVICE_HANDLER ( i8275_r ); |
69 | | DECLARE_WRITE8_DEVICE_HANDLER ( i8275_w ); |
| 133 | UINT8 m_fifo_buffer_1[16]; |
| 134 | UINT8 m_fifo_buffer_2[16]; |
| 135 | UINT8 m_fifo_write; |
70 | 136 | |
71 | | /* updates the screen */ |
72 | | void i8275_update(device_t *device, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 137 | int m_ypos; |
| 138 | int m_current_row; |
73 | 139 | |
74 | | DECLARE_WRITE8_DEVICE_HANDLER( i8275_dack_w ); |
| 140 | UINT8 m_cursor_blink_cnt; |
| 141 | UINT8 m_char_blink_cnt; |
75 | 142 | |
76 | | /*************************************************************************** |
77 | | DEVICE CONFIGURATION MACROS |
78 | | ***************************************************************************/ |
| 143 | UINT8 m_next_in_fifo; |
79 | 144 | |
80 | | #define MCFG_I8275_ADD(_tag, _intrf) \ |
81 | | MCFG_DEVICE_ADD(_tag, I8275, 0) \ |
82 | | MCFG_DEVICE_CONFIG(_intrf) |
| 145 | UINT8 m_lineattr; |
| 146 | UINT8 m_rvv; |
| 147 | UINT8 m_gpa; |
| 148 | UINT8 m_hlgt; |
| 149 | UINT8 m_underline; |
| 150 | UINT8 m_blink; |
83 | 151 | |
| 152 | UINT8 m_last_data; |
| 153 | }; |
| 154 | |
| 155 | // device type definition |
| 156 | extern const device_type I8275; |
| 157 | |
| 158 | |
84 | 159 | #endif |
trunk/src/mess/drivers/radio86.c
r19910 | r19911 | |
24 | 24 | AM_RANGE( 0x1000, 0x7fff ) AM_RAM // RAM |
25 | 25 | AM_RANGE( 0x8000, 0x8003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x1ffc) |
26 | 26 | //AM_RANGE( 0xa000, 0xa003 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) AM_MIRROR(0x1ffc) |
27 | | AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE_LEGACY("i8275", i8275_r, i8275_w) AM_MIRROR(0x1ffe) // video |
| 27 | AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x1ffe) // video |
28 | 28 | AM_RANGE( 0xe000, 0xffff ) AM_DEVWRITE_LEGACY("dma8257", i8257_w) // DMA |
29 | 29 | AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM |
30 | 30 | ADDRESS_MAP_END |
r19910 | r19911 | |
44 | 44 | AM_RANGE( 0x1000, 0x7fff ) AM_RAM // RAM |
45 | 45 | AM_RANGE( 0x8000, 0x8003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x1ffc) |
46 | 46 | AM_RANGE( 0xa000, 0xa003 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) AM_MIRROR(0x1ffc) |
47 | | AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE_LEGACY("i8275", i8275_r, i8275_w) AM_MIRROR(0x1ffe) // video |
| 47 | AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x1ffe) // video |
48 | 48 | AM_RANGE( 0xe000, 0xffff ) AM_DEVWRITE_LEGACY("dma8257", i8257_w) // DMA |
49 | 49 | AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM |
50 | 50 | ADDRESS_MAP_END |
r19910 | r19911 | |
55 | 55 | AM_RANGE( 0xe000, 0xe7ff ) AM_ROM // System ROM page 2 |
56 | 56 | AM_RANGE( 0xe800, 0xf5ff ) AM_RAM // RAM |
57 | 57 | AM_RANGE( 0xf700, 0xf703 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) |
58 | | AM_RANGE( 0xf780, 0xf7bf ) AM_DEVREADWRITE_LEGACY("i8275", i8275_r, i8275_w) // video |
| 58 | AM_RANGE( 0xf780, 0xf7bf ) AM_DEVREADWRITE("i8275", i8275_device, read, write) // video |
59 | 59 | AM_RANGE( 0xf684, 0xf687 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) |
60 | 60 | AM_RANGE( 0xf688, 0xf688 ) AM_WRITE(radio86_pagesel ) |
61 | 61 | AM_RANGE( 0xf800, 0xffff ) AM_DEVWRITE_LEGACY("dma8257", i8257_w) // DMA |
r19910 | r19911 | |
69 | 69 | AM_RANGE( 0x4000, 0x7fff ) AM_READ(radio_cpu_state_r) |
70 | 70 | AM_RANGE( 0x8000, 0x8003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x1ffc) |
71 | 71 | //AM_RANGE( 0xa000, 0xa003 ) AM_DEVREADWRITE_LEGACY("ppi8255_2", i8255a_r, i8255a_w) AM_MIRROR(0x1ffc) |
72 | | AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE_LEGACY("i8275", i8275_r, i8275_w) AM_MIRROR(0x1ffe) // video |
| 72 | AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x1ffe) // video |
73 | 73 | AM_RANGE( 0xe000, 0xffff ) AM_DEVWRITE_LEGACY("dma8257", i8257_w) // DMA |
74 | 74 | AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM |
75 | 75 | ADDRESS_MAP_END |
r19910 | r19911 | |
80 | 80 | AM_RANGE( 0x1000, 0x7fff ) AM_RAM // RAM |
81 | 81 | AM_RANGE( 0xc000, 0xc003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x00fc) |
82 | 82 | //AM_RANGE( 0xc100, 0xc103 ) AM_DEVREADWRITE_LEGACY("ppi8255_2", i8255a_r, i8255a_w) AM_MIRROR(0x00fc) |
83 | | AM_RANGE( 0xc200, 0xc201 ) AM_DEVREADWRITE_LEGACY("i8275", i8275_r, i8275_w) AM_MIRROR(0x00fe) // video |
| 83 | AM_RANGE( 0xc200, 0xc201 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x00fe) // video |
84 | 84 | AM_RANGE( 0xc300, 0xc3ff ) AM_DEVWRITE_LEGACY("dma8257", i8257_w) // DMA |
85 | 85 | AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM |
86 | 86 | ADDRESS_MAP_END |
r19910 | r19911 | |
90 | 90 | AM_RANGE( 0x1000, 0x7fff ) AM_RAM // RAM |
91 | 91 | AM_RANGE( 0x8000, 0x8003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x1ffc) |
92 | 92 | AM_RANGE( 0xa000, 0xbfff ) AM_ROM // Basic ROM |
93 | | AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE_LEGACY("i8275", i8275_r, i8275_w) AM_MIRROR(0x1ffe) // video |
| 93 | AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x1ffe) // video |
94 | 94 | AM_RANGE( 0xe000, 0xffff ) AM_DEVWRITE_LEGACY("dma8257", i8257_w) // DMA |
95 | 95 | AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM |
96 | 96 | ADDRESS_MAP_END |
r19910 | r19911 | |
359 | 359 | MCFG_I8275_ADD ( "i8275", radio86_i8275_interface) |
360 | 360 | /* video hardware */ |
361 | 361 | MCFG_SCREEN_ADD("screen", RASTER) |
| 362 | MCFG_SCREEN_UPDATE_DEVICE("i8275", i8275_device, screen_update) |
362 | 363 | MCFG_SCREEN_REFRESH_RATE(50) |
363 | 364 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
364 | 365 | MCFG_SCREEN_SIZE(78*6, 30*10) |
365 | 366 | MCFG_SCREEN_VISIBLE_AREA(0, 78*6-1, 0, 30*10-1) |
366 | | MCFG_SCREEN_UPDATE_DRIVER(radio86_state, screen_update_radio86) |
367 | 367 | MCFG_GFXDECODE(radio86) |
368 | 368 | MCFG_PALETTE_LENGTH(3) |
369 | 369 | MCFG_PALETTE_INIT_OVERRIDE(radio86_state,radio86) |