Previous 15994 Revisions Next

r2769 Thursday 29th May, 2008 at 19:07:11 UTC by Miodrag Milanović
[RADIO86] New driver for Radio-86RK and variant with 4K rom
[docs]messnew.txt
[src/mess]mess.mak messdriv.c
[src/mess/drivers]radio86.c*
[src/mess/includes]radio86.h*
[src/mess/machine]radio86.c*
[src/mess/video]i8275.c* i8275.h* radio86.c*

src/mess/includes/radio86.h
r0r2769
1/*****************************************************************************
2 *
3 * includes/radio86.h
4 *
5 ****************************************************************************/
6
7#ifndef radio86_H_
8#define radio86_H_
9
10
11/*----------- defined in machine/radio86.c -----------*/
12
13extern DRIVER_INIT( radio86 );
14extern MACHINE_RESET( radio86 );
15
16extern const ppi8255_interface radio86_ppi8255_interface_1;
17extern const i8275_interface radio86_i8275_interface;
18
19/*----------- defined in video/radio86.c -----------*/
20
21extern I8275_DISPLAY_PIXELS(radio86_display_pixels);
22
23extern VIDEO_UPDATE( radio86 );
24
25
26#endif /* radio86_H_ */
src/mess/video/i8275.c
r0r2769
1/***************************************************************************
2
3    INTEL 8275 Programmable CRT Controller implementation
4
5    25-05-2008 Initial implementation [Miodrag Milanovic]
6
7    Copyright MESS team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#include "driver.h"
13#include "i8275.h"
14
15#define I8275_COMMAND_RESET            0
16#define I8275_COMMAND_START_DISPLAY      1
17#define I8275_COMMAND_STOP_DISPLAY      2
18#define I8275_COMMAND_READ_LIGHT_PEN   3
19#define I8275_COMMAND_LOAD_CURSOR      4
20#define I8275_COMMAND_ENABLE_INTERRUPT   5
21#define I8275_COMMAND_DISABLE_INTERRUPT   6
22#define I8275_COMMAND_PRESET_COUNTERS   7
23
24#define I8275_PARAM_RESET            4
25#define I8275_PARAM_READ_LIGHT_PEN      2
26#define I8275_PARAM_LOAD_CURSOR         2
27
28#define I8275_PARAM_NONE            0
29#define I8275_PARAM_READ            1
30#define I8275_PARAM_WRITE            2
31
32#define I8275_STATUS_FIFO_OVERRUN      0x01
33#define I8275_STATUS_DMA_UNDERRUN      0x02
34#define I8275_STATUS_VIDEO_ENABLE      0x04
35#define I8275_STATUS_IMPROPER_COMMAND   0x08
36#define I8275_STATUS_LIGHT_PEN         0x10
37#define I8275_STATUS_INTERRUPT_REQUEST   0x20
38#define I8275_STATUS_INTERRUPT_ENABLE   0x40
39
40#define I8275_ROW_TYPE_NORMAL         0
41#define I8275_ROW_TYPE_SPACED         1
42
43#define I8275_LINE_COUNTER_MODE_0      0
44#define I8275_LINE_COUNTER_MODE_1      1
45
46#define I8275_FIELD_ATTRIBUTE_TRANSPARENT      0
47#define I8275_FIELD_ATTRIBUTE_NONTRANSPARENT   1
48
49#define I8275_CURSOR_BLINK_REVERSED      0
50#define I8275_CURSOR_BLINK_UNDERLINE   1
51#define I8275_CURSOR_NONBLINK_REVERSED   2
52#define I8275_CURSOR_NONBLINK_UNDERLINE   3
53
54
55#define   VERBOSE         1
56
57#define   LOG(msg)      { if (VERBOSE >= 1) logerror msg; }
58
59
60typedef struct _i8275_t i8275_t;
61
62struct _i8275_t
63{
64   const device_config *screen;
65
66   const i8275_interface *intf;
67
68   UINT8 status_reg;            /* value of status reggister */
69   UINT8 num_of_params;         /* expected number of parameters */
70   UINT8 current_command;         /* command currently executing */
71   UINT8 param_type;            /* parameter type */
72
73   UINT8 cursor_col;            /* current cursor column */
74   UINT8 cursor_row;            /* current cursor row */
75
76   UINT8 light_pen_col;         /* current light pen column */
77   UINT8 light_pen_row;         /* current light pen row */
78
79   /* reset command parameter values*/
80   /* parameter 0 */
81   UINT8 rows_type;
82   UINT8 chars_per_row;
83   /* parameter 1 */
84   UINT8 vert_retrace_rows;
85   UINT8 rows_per_frame;
86   /* parameter 2 */
87   UINT8 undeline_line_num;
88   UINT8 lines_per_row;
89   /* parameter 3 */
90   UINT8 line_counter_mode;
91   UINT8 field_attribute_mode;
92   UINT8 cursor_format;
93   UINT8 hor_retrace_count;
94
95   /* values for start display command */
96   UINT8 burst_space_code;
97   UINT8 burst_count_code;
98
99   /* buffers */
100   UINT8 row_buffer_1[80];
101   UINT8 row_buffer_2[80];
102   UINT8 row_pos;
103   UINT8 buffer_used;
104
105   UINT8 fifo_buffer_1[16];
106   UINT8 fifo_buffer_2[16];
107   UINT8 fifo_pos_1;
108   UINT8 fifo_pos_2;
109
110   int ypos;
111   int current_row;
112
113   UINT8 cursor_blink_cnt;
114   UINT8 char_blink_cnt;
115
116};
117
118INLINE i8275_t *get_safe_token(const device_config *device)
119{
120   assert(device != NULL);
121   assert(device->token != NULL);
122
123   return (i8275_t *)device->token;
124}
125
126
127/* Register Access */
128UINT8 i8275_get_parameter_light_pen(const device_config *device, offs_t offset)
129{
130   i8275_t *i8275 = get_safe_token(device);
131   UINT8 val = 0;
132
133   switch(offset) {
134      case 0 :
135            val = i8275->light_pen_col;
136            break;
137      case 1 :
138            val = i8275->light_pen_row;
139            break;
140   }
141   return val;
142}
143
144READ8_DEVICE_HANDLER( i8275_r )
145{
146   UINT8 val;
147   i8275_t *i8275 = get_safe_token(device);
148
149   if (offset & 0x01)
150   {
151      /* Status register */
152      val = i8275->status_reg;
153      /* status reset after read */
154      i8275->status_reg &= ~I8275_STATUS_FIFO_OVERRUN;
155      i8275->status_reg &= ~I8275_STATUS_DMA_UNDERRUN;
156      i8275->status_reg &= ~I8275_STATUS_IMPROPER_COMMAND;
157      i8275->status_reg &= ~I8275_STATUS_LIGHT_PEN;
158      i8275->status_reg &= ~I8275_STATUS_INTERRUPT_REQUEST;
159   }
160   else
161   {
162      /* Parameter register */
163      val = 0x00;
164      if (i8275->param_type==I8275_PARAM_READ) {
165         if (i8275->num_of_params > 0) {
166            val = i8275_get_parameter_light_pen(device, 2 - i8275->num_of_params);
167            i8275->num_of_params--;
168         } else {
169            i8275->status_reg |= I8275_STATUS_IMPROPER_COMMAND;
170         }
171      } else {
172         LOG(("i8275 : ERROR reading parameter\n"));
173         i8275->status_reg |= I8275_STATUS_IMPROPER_COMMAND;
174      }
175   }
176   return val;
177}
178
179void i8275_recompute_parameters(const device_config *device)
180{
181   i8275_t *i8275 = get_safe_token(device);
182   int horiz_pix_total = 0;
183   int vert_pix_total = 0;
184   rectangle visarea;
185
186   horiz_pix_total = (i8275->chars_per_row + 1) * i8275->intf->width;
187   vert_pix_total  = (i8275->lines_per_row + 1) * (i8275->rows_per_frame + 1);
188   if (i8275->rows_type==1) {
189      vert_pix_total *= 2; // Use of spaced rows
190   }
191
192   visarea.min_x = 0;
193   visarea.min_y = 0;
194   visarea.max_x = horiz_pix_total - 1;
195   visarea.max_y = vert_pix_total - 1;
196
197   video_screen_configure(i8275->screen, horiz_pix_total, vert_pix_total, &visarea,
198            video_screen_get_frame_period(i8275->screen).attoseconds);
199}
200
201void i8275_set_parameter_reset(const device_config *device, offs_t offset, UINT8 data)
202{
203   i8275_t *i8275 = get_safe_token(device);
204   switch(offset) {
205      case 0 :
206            i8275->rows_type = (data >> 7) & 1;
207            i8275->chars_per_row = data & 0x7f;
208            break;
209      case 1 :
210            i8275->vert_retrace_rows = (data >> 6) & 3;
211            i8275->rows_per_frame = data & 0x3f;
212            break;
213      case 2 :
214            i8275->undeline_line_num = (data >> 4) & 0x0f;
215            i8275->lines_per_row = data & 0x0f;
216            break;
217      case 3 :
218            i8275->line_counter_mode = (data >> 7) & 1;
219            i8275->field_attribute_mode = (data >> 6) & 1;
220            i8275->cursor_format  = (data >> 4) & 3;
221            i8275->hor_retrace_count = data & 0x0f;
222            break;
223   }
224}
225
226void i8275_set_parameter_cursor(const device_config *device, offs_t offset, UINT8 data)
227{
228   i8275_t *i8275 = get_safe_token(device);
229   switch(offset) {
230      case 0 :
231            i8275->cursor_col = data;
232            break;
233      case 1 :
234            i8275->cursor_row = data;
235            break;
236   }
237}
238
239
240WRITE8_DEVICE_HANDLER( i8275_w )
241{
242   i8275_t *i8275 = get_safe_token(device);
243
244   if (offset & 0x01)
245   {
246      /* Command register */
247      if (i8275->num_of_params != 0) {
248         i8275->status_reg |= I8275_STATUS_IMPROPER_COMMAND;
249         return;
250      }
251      i8275->current_command = (data >> 5) & 7;
252      i8275->num_of_params = I8275_PARAM_NONE;
253      i8275->param_type = I8275_PARAM_NONE;
254      switch(i8275->current_command) {
255         case I8275_COMMAND_RESET      :
256                                 i8275->num_of_params = I8275_PARAM_RESET;
257                                 i8275->param_type = I8275_PARAM_WRITE;
258                                 /* set status register */
259                                 i8275->status_reg &= ~I8275_STATUS_INTERRUPT_ENABLE;
260                                 i8275->status_reg &= ~I8275_STATUS_VIDEO_ENABLE;
261                                 break;
262         case I8275_COMMAND_START_DISPLAY:
263                                 i8275->burst_space_code = (data >> 2) & 7;
264                                 i8275->burst_count_code = data & 3;
265                                 /* set status register */
266                                 i8275->status_reg |= I8275_STATUS_VIDEO_ENABLE;
267                                 i8275->status_reg |= I8275_STATUS_INTERRUPT_ENABLE;
268                                 i8275_recompute_parameters(device);
269                                 break;
270         case I8275_COMMAND_STOP_DISPLAY :
271                                 /* set status register */
272                                 i8275->status_reg &= ~I8275_STATUS_VIDEO_ENABLE;
273                                 break;
274         case I8275_COMMAND_READ_LIGHT_PEN:
275                                 i8275->num_of_params = I8275_PARAM_READ_LIGHT_PEN;
276                                 i8275->param_type = I8275_PARAM_READ;
277                                 break;
278         case I8275_COMMAND_LOAD_CURSOR   :
279                                 i8275->num_of_params = I8275_PARAM_LOAD_CURSOR;
280                                 i8275->param_type = I8275_PARAM_WRITE;
281                                 break;
282         case I8275_COMMAND_ENABLE_INTERRUPT   :
283                                 /* set status register */
284                                 i8275->status_reg |= I8275_STATUS_INTERRUPT_ENABLE;
285                                 break;
286         case I8275_COMMAND_DISABLE_INTERRUPT:
287                                 /* set status register */
288                                 i8275->status_reg &= ~I8275_STATUS_INTERRUPT_ENABLE;
289                                 break;
290         case I8275_COMMAND_PRESET_COUNTERS   :
291                                 break;
292      }
293   }
294   else
295   {
296      /* Parameter register */
297      if (i8275->param_type==I8275_PARAM_WRITE) {
298         if (i8275->num_of_params > 0) {
299            if (i8275->current_command == I8275_COMMAND_RESET) {
300               i8275_set_parameter_reset(device, 4 - i8275->num_of_params ,data);
301            } else {
302               i8275_set_parameter_cursor(device, 2 - i8275->num_of_params, data);
303            }
304            i8275->num_of_params--;
305         } else {
306            i8275->status_reg |= I8275_STATUS_IMPROPER_COMMAND;
307         }
308      } else {
309         LOG(("i8275 : ERROR writing parameter\n"));
310         i8275->status_reg |= I8275_STATUS_IMPROPER_COMMAND;
311      }
312   }
313}
314
315
316void i8275_draw_char_line(const device_config *device)
317{
318   i8275_t *i8275 = get_safe_token(device);
319   int xpos = 0;
320   int line = 0;
321   UINT8 lc = 0;
322   UINT8 vsp = 0;
323   UINT8 lten = 0;
324
325   for(line=0;line<=i8275->lines_per_row;line++) {
326      if (i8275->undeline_line_num & 0x08) {
327         vsp = (line==0 || line==i8275->lines_per_row) ? 1 : 0;
328      }
329      // If line counter is 1 then select right values
330      lc = (i8275->line_counter_mode==1) ? (line - 1) % i8275->lines_per_row : line;
331
332      for(xpos=0;xpos<=i8275->chars_per_row;xpos++) {
333         UINT8 chr =   (i8275->buffer_used==0) ? i8275->row_buffer_2[xpos] : i8275->row_buffer_1[xpos];
334
335         if ((i8275->current_row == i8275->cursor_row) && (xpos == i8275->cursor_col)) {
336            int vis = 1;
337            if ((i8275->cursor_format & 2)==0) {
338               vis = (i8275->cursor_blink_cnt<16) ? 1 : 0;
339            }
340            if ((i8275->cursor_format & 1)==1) {
341               lten = (line == i8275->undeline_line_num) ? vis : 0; //underline
342            } else {
343               lten = vis; // block cursor
344            }
345         } else {
346            lten = 0;
347         }
348
349         i8275->intf->display_pixels(device,
350            xpos * i8275->intf->width, // x position on screen of starting point
351             i8275->ypos, // y position on screen
352            lc, // current line of char
353            (chr & 0x7f),  // char code to be displayed
354            0,  // line attribute code
355            lten,  // light enable signal
356            0,  // reverse video signal
357            vsp, // video suppression
358            0,  // general purpose attribute code
359            0  // highlight
360         );
361      }
362      i8275->ypos++;
363   }
364   i8275->current_row++;
365}
366
367void i8275_dack_set_data(const device_config *device, UINT8 data)
368{
369   i8275_t *i8275 = get_safe_token(device);
370   if(i8275->buffer_used == 0) {
371      i8275->row_buffer_1[i8275->row_pos++] = data;
372   } else {
373      i8275->row_buffer_2[i8275->row_pos++] = data;
374   }
375   if ((i8275->row_pos - 1)==i8275->chars_per_row ) {
376      i8275->buffer_used = (i8275->buffer_used==0) ? 1 : 0;
377      i8275->row_pos = 0;
378      i8275_draw_char_line(device);
379   }
380   if (i8275->ypos >= (i8275->lines_per_row+1) * (i8275->rows_per_frame + 1)) {
381      i8275->ypos = 0;
382      i8275->current_row = 0;
383      i8275->intf->dma_request(device,0);
384   }
385}
386
387/* Screen Update */
388void i8275_update(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect)
389{
390   i8275_t *i8275 = get_safe_token(device);
391   if ((i8275->status_reg & I8275_STATUS_VIDEO_ENABLE)==0) {
392      fillbitmap(bitmap, get_black_pen(device->machine), cliprect);
393   } else {
394      // if value < 16 it is visible otherwise not
395      i8275->cursor_blink_cnt++;
396      if(i8275->cursor_blink_cnt==32) i8275->cursor_blink_cnt = 0;
397      // if value < 32 it is visible otherwise not
398      i8275->char_blink_cnt++;
399      if(i8275->char_blink_cnt==64) i8275->char_blink_cnt = 0;
400
401      i8275->intf->dma_request(device,1);
402   }
403   if (i8275->status_reg & I8275_STATUS_INTERRUPT_ENABLE) {
404      i8275->status_reg |= I8275_STATUS_INTERRUPT_REQUEST;
405   }
406}
407
408/* Device Interface */
409
410static DEVICE_START( i8275 )
411{
412   i8275_t *i8275 = get_safe_token(device);
413   char unique_tag[30];
414
415   // validate arguments
416
417   assert(device != NULL);
418   assert(device->tag != NULL);
419   assert(strlen(device->tag) < 20);
420   assert(device->static_config != NULL);
421
422   i8275->intf = device->static_config;
423
424   assert(i8275->intf->dma_request != NULL);
425   assert(i8275->intf->display_pixels != NULL);
426
427   // get the screen device
428
429   i8275->screen = device_list_find_by_tag(device->machine->config->devicelist, VIDEO_SCREEN, i8275->intf->screen_tag);
430   assert(i8275->screen != NULL);
431
432   // register for state saving
433   state_save_combine_module_and_tag(unique_tag, "I8275", device->tag);
434
435   state_save_register_item(unique_tag, 0, i8275->status_reg);
436   state_save_register_item(unique_tag, 0, i8275->num_of_params);
437   state_save_register_item(unique_tag, 0, i8275->current_command);
438   state_save_register_item(unique_tag, 0, i8275->param_type);
439
440   state_save_register_item(unique_tag, 0, i8275->cursor_col);
441   state_save_register_item(unique_tag, 0, i8275->cursor_row);
442
443   state_save_register_item(unique_tag, 0, i8275->light_pen_col);
444   state_save_register_item(unique_tag, 0, i8275->light_pen_row);
445
446   state_save_register_item(unique_tag, 0, i8275->rows_type);
447   state_save_register_item(unique_tag, 0, i8275->chars_per_row);
448   state_save_register_item(unique_tag, 0, i8275->vert_retrace_rows);
449   state_save_register_item(unique_tag, 0, i8275->rows_per_frame);
450   state_save_register_item(unique_tag, 0, i8275->undeline_line_num);
451   state_save_register_item(unique_tag, 0, i8275->lines_per_row);
452   state_save_register_item(unique_tag, 0, i8275->line_counter_mode);
453   state_save_register_item(unique_tag, 0, i8275->field_attribute_mode);
454   state_save_register_item(unique_tag, 0, i8275->cursor_format);
455   state_save_register_item(unique_tag, 0, i8275->hor_retrace_count);
456
457   state_save_register_item(unique_tag, 0, i8275->burst_space_code);
458   state_save_register_item(unique_tag, 0, i8275->burst_count_code);
459}
460
461static DEVICE_RESET( i8275 )
462{
463   i8275_t *i8275 = get_safe_token(device);
464
465   i8275->status_reg = 0;
466   i8275->num_of_params = 0;
467   i8275->current_command = 0;
468   i8275->param_type = 0;
469
470   i8275->cursor_col = 0;
471   i8275->cursor_row = 0;
472
473   i8275->light_pen_col = 0;
474   i8275->light_pen_row = 0;
475
476   i8275->rows_type = 0;
477   i8275->chars_per_row = 0;
478   i8275->vert_retrace_rows = 0;
479   i8275->rows_per_frame = 0;
480   i8275->undeline_line_num = 0;
481   i8275->lines_per_row = 0;
482   i8275->line_counter_mode = 0;
483   i8275->field_attribute_mode = 0;
484   i8275->cursor_format = 0;
485   i8275->hor_retrace_count = 0;
486
487   i8275->burst_space_code = 0;
488   i8275->burst_count_code = 0;
489
490   i8275->row_pos = 0;
491   i8275->buffer_used = 0;
492
493   i8275->fifo_pos_1 = 0;
494   i8275->fifo_pos_2 = 0;
495
496   i8275->ypos = 0;
497   i8275->current_row = 0;
498
499   i8275->cursor_blink_cnt = 0;
500   i8275->char_blink_cnt = 0;
501}
502
503static DEVICE_SET_INFO( i8275 )
504{
505   switch (state)
506   {
507      /* no parameters to set */
508   }
509}
510
511DEVICE_GET_INFO( i8275 )
512{
513   switch (state)
514   {
515      /* --- the following bits of info are returned as 64-bit signed integers --- */
516      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(i8275_t);               break;
517      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                        break;
518      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;         break;
519
520      /* --- the following bits of info are returned as pointers to data or functions --- */
521      case DEVINFO_FCT_SET_INFO:                  info->set_info = DEVICE_SET_INFO_NAME(i8275); break;
522      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(i8275);      break;
523      case DEVINFO_FCT_STOP:                     /* Nothing */                        break;
524      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(i8275);      break;
525
526      /* --- the following bits of info are returned as NULL-terminated strings --- */
527      case DEVINFO_STR_NAME:                     info->s = "Intel 8275";                  break;
528      case DEVINFO_STR_FAMILY:                  info->s = "Intel 8275";                  break;
529      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
530      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
531      case DEVINFO_STR_CREDITS:                  info->s = "Copyright MESS Team";         break;
532   }
533}
src/mess/video/i8275.h
r0r2769
1/***************************************************************************
2
3    INTEL 8275 Programmable CRT Controller implementation
4
5    25-05-2008 Initial implementation [Miodrag Milanovic]
6
7    Copyright MESS team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#ifndef __I8275_VIDEO__
13#define __I8275_VIDEO__
14
15#define I8275      DEVICE_GET_INFO_NAME(i8275)
16
17typedef void (*i8275_dma_request_func)(const device_config *device, int state);
18#define I8275_DMA_REQUEST(name)   void name(const device_config *device, int state )
19
20typedef void (*i8275_int_request_func)(const device_config *device, int state);
21#define I8275_INT_REQUEST(name)   void name(const device_config *device, int state)
22
23typedef void (*i8275_display_pixels_func)(const device_config *device, int x, int y, UINT8 linecount, UINT8 charcode, UINT8 lineattr, UINT8 lten, UINT8 rvv, UINT8 vsp, UINT8 gpa, UINT8 hlgt);
24#define I8275_DISPLAY_PIXELS(name)   void name(const device_config *device, int x, int y, UINT8 linecount, UINT8 charcode, UINT8 lineattr, UINT8 lten, UINT8 rvv, UINT8 vsp, UINT8 gpa, UINT8 hlgt)
25
26/* interface */
27typedef struct _i8275_interface i8275_interface;
28struct _i8275_interface
29{
30   const char *screen_tag;      /* screen we are acting on */
31   int width;               /* char width in pixels*/
32
33   i8275_dma_request_func dma_request;
34
35   i8275_int_request_func int_request;
36
37   i8275_display_pixels_func display_pixels;
38};
39
40/* device interface */
41DEVICE_GET_INFO( i8275 );
42
43/* register access */
44READ8_DEVICE_HANDLER ( i8275_r );
45WRITE8_DEVICE_HANDLER ( i8275_w );
46
47/* updates the screen */
48void i8275_update(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect);
49
50void i8275_dack_set_data(const device_config *device, UINT8 data);
51
52#endif
src/mess/video/radio86.c
r0r2769
1/***************************************************************************
2
3        Radio-86RK video driver by Miodrag Milanovic
4
5        06/03/2008 Preliminary driver.
6
7****************************************************************************/
8
9
10#include "driver.h"
11#include "video/i8275.h"
12
13I8275_DISPLAY_PIXELS(radio86_display_pixels) {
14   //int x, int y, UINT8 linecount, UINT8 charcode, UINT8 lineattr, UINT8 lten, UINT8 rvv, UINT8 vsp, UINT8 gpa, UINT8 hlgt);
15   int i;
16   bitmap_t *bitmap = tmpbitmap;
17   UINT8 *charmap = memory_region(REGION_GFX1);
18   UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)];
19   if (vsp) {
20      pixels = 0;
21   }
22   if (lten) {
23      pixels = 0xff;
24   }
25   for(i=0;i<6;i++) {
26      *BITMAP_ADDR16(bitmap, y, x + i) = (pixels >> (5-i)) & 1;
27   }
28}
29
30VIDEO_UPDATE( radio86 )
31{
32   device_config   *devconf = (device_config *) device_list_find_by_tag(screen->machine->config->devicelist, I8275, "i8275");
33   i8275_update( devconf, bitmap, cliprect);
34   VIDEO_UPDATE_CALL ( generic_bitmapped );
35   return 0;
36}
37
src/mess/messdriv.c
r2768r2769
868868   DRIVER( b2m )   
869869   DRIVER( b2mrom )     
870870
871   /* Radio-86RK */
872   DRIVER( radio86 )   
873   DRIVER( radio4k )     
874
871875   /* Bondwell */
872876   DRIVER( bw2 )
873877
src/mess/machine/radio86.c
r0r2769
1/***************************************************************************
2
3        Radio-86RK machine driver by Miodrag Milanovic
4
5        06/03/2008 Preliminary driver.
6
7****************************************************************************/
8
9
10#include "driver.h"
11#include "deprecat.h"
12#include "cpu/i8085/i8085.h"
13#include "devices/cassette.h"
14#include "machine/8255ppi.h"
15#include "machine/8257dma.h"
16#include "video/i8275.h"
17#include "includes/radio86.h"
18
19static int radio86_keyboard_mask;
20
21
22/* Driver initialization */
23DRIVER_INIT(radio86)
24{
25   /* set initialy ROM to be visible on first bank */
26   UINT8 *RAM = memory_region(REGION_CPU1);
27   memset(RAM,0x0000,0x1000); // make frist page empty by default
28     memory_configure_bank(1, 1, 2, RAM, 0x0000);
29   memory_configure_bank(1, 0, 2, RAM, 0xf000);
30}
31
32READ8_HANDLER (radio86_8255_portb_r2 )
33{
34   UINT8 key = 0xff;
35   if ((radio86_keyboard_mask & 0x01)!=0) { key &= input_port_read_indexed(machine,0); }
36   if ((radio86_keyboard_mask & 0x02)!=0) { key &= input_port_read_indexed(machine,1); }
37   if ((radio86_keyboard_mask & 0x04)!=0) { key &= input_port_read_indexed(machine,2); }
38   if ((radio86_keyboard_mask & 0x08)!=0) { key &= input_port_read_indexed(machine,3); }
39   if ((radio86_keyboard_mask & 0x10)!=0) { key &= input_port_read_indexed(machine,4); }
40   if ((radio86_keyboard_mask & 0x20)!=0) { key &= input_port_read_indexed(machine,5); }
41   if ((radio86_keyboard_mask & 0x40)!=0) { key &= input_port_read_indexed(machine,6); }
42   if ((radio86_keyboard_mask & 0x80)!=0) { key &= input_port_read_indexed(machine,7); }
43   return key;
44}
45
46READ8_HANDLER (radio86_8255_portc_r2 )
47{
48   return input_port_read_indexed(machine, 8);
49}
50
51WRITE8_HANDLER (radio86_8255_porta_w2 )
52{
53   radio86_keyboard_mask = data ^ 0xff;
54}
55
56const ppi8255_interface radio86_ppi8255_interface_1 =
57{
58   NULL,
59   radio86_8255_portb_r2,
60   radio86_8255_portc_r2,
61   radio86_8255_porta_w2,
62   NULL,
63   NULL,
64};
65
66I8275_DMA_REQUEST(radio86_video_dma_request) {
67   dma8257_drq_write(0, 2, state);
68}
69
70const i8275_interface radio86_i8275_interface = {
71   "main",
72   6,
73   radio86_video_dma_request,
74   NULL,
75   radio86_display_pixels
76};
77
78static UINT8 radio86_dma_read_byte(int channel, offs_t offset)
79{
80   UINT8 result;
81   cpuintrf_push_context(0);
82   result = program_read_byte(offset);
83   cpuintrf_pop_context();
84   return result;
85}
86
87static void radio86_write_video(UINT8 data)
88{
89   i8275_dack_set_data((device_config*)device_list_find_by_tag( Machine->config->devicelist, I8275, "i8275" ),data);
90}
91
92static const struct dma8257_interface radio86_dma =
93{
94   0,
95   XTAL_16MHz / 9,
96
97   radio86_dma_read_byte,
98   0,
99
100   { 0, 0, 0, 0 },
101   { 0, 0, radio86_write_video, 0 },
102   { 0, 0, 0, 0 }
103};
104
105static TIMER_CALLBACK( radio86_reset )
106{
107   memory_set_bank(1, 0);
108}
109
110MACHINE_RESET( radio86 )
111{
112   timer_set(ATTOTIME_IN_USEC(10), NULL, 0, radio86_reset);
113   memory_set_bank(1, 1);
114
115   radio86_keyboard_mask = 0;
116   dma8257_init(1);
117   dma8257_config(0, &radio86_dma);
118   dma8257_reset();
119}
120
121READ8_HANDLER( radio86_keyboard_r )
122{
123   return ppi8255_r((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_1" ), offset & 3);
124}
125
126WRITE8_HANDLER( radio86_keyboard_w )
127{
128   ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_1" ),offset^0x03, data);
129}
130
131READ8_HANDLER( radio86_tape_r )
132{
133   double level = cassette_input(image_from_devtype_and_index(IO_CASSETTE, 0));
134   if (level <  0) {
135          return 0x00;
136    }
137   return 0xff;
138}
139
src/mess/mess.mak
r2768r2769
408408   $(MESSOBJ)/pel.a \
409409   $(MESSOBJ)/pmd85.a \
410410   $(MESSOBJ)/primo.a \
411   $(MESSOBJ)/radio.a \
411412   $(MESSOBJ)/rca.a \
412413   $(MESSOBJ)/rockwell.a \
413414   $(MESSOBJ)/samcoupe.a \
r2768r2769
12481249   $(MESS_MACHINE)/b2m.o \
12491250   $(MESS_VIDEO)/b2m.o \
12501251
1252$(MESSOBJ)/radio.a:      \
1253   $(MESS_DRIVERS)/radio86.o \
1254   $(MESS_MACHINE)/radio86.o \
1255   $(MESS_VIDEO)/radio86.o \
1256   $(MESS_VIDEO)/i8275.o \
1257
12511258$(MESSOBJ)/comx.a:            \
12521259   $(MESS_DRIVERS)/comx35.o   \
12531260   $(MESS_DRIVERS)/comxpl80.o   \
src/mess/drivers/radio86.c
r0r2769
1/***************************************************************************
2
3        Radio-86RK driver by Miodrag Milanovic
4
5        15/03/2008 Preliminary driver.
6
7****************************************************************************/
8
9
10#include "driver.h"
11#include "cpu/i8085/i8085.h"
12#include "machine/8255ppi.h"
13#include "machine/8257dma.h"
14#include "video/i8275.h"
15#include "includes/radio86.h"
16
17/* Address maps */
18static ADDRESS_MAP_START(radio86_mem, ADDRESS_SPACE_PROGRAM, 8)
19    AM_RANGE( 0x0000, 0x0fff ) AM_RAMBANK(1) // First bank
20    AM_RANGE( 0x1000, 0x7fff ) AM_RAM  // RAM
21    AM_RANGE( 0x8000, 0x8003 ) AM_DEVREADWRITE(PPI8255, "ppi8255_1", ppi8255_r, ppi8255_w) AM_MIRROR(0x1ffc)
22    //AM_RANGE( 0xa000, 0xa003 ) AM_DEVREADWRITE(PPI8255, "ppi8255_2", ppi8255_r, ppi8255_w) AM_MIRROR(0x1ffc)
23    AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE(I8275, "i8275", i8275_r, i8275_w) AM_MIRROR(0x1ffe) // video
24    AM_RANGE( 0xe000, 0xffff ) AM_WRITE(dma8257_0_w)    // DMA
25    AM_RANGE( 0xf000, 0xffff ) AM_ROM  // System ROM
26ADDRESS_MAP_END
27
28/* Input ports */
29INPUT_PORTS_START( radio86 )
30   PORT_START /* line 0 */
31      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME)
32      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT)
33      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC)
34      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1)
35      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2)
36      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3)
37      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4)
38      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5)
39   PORT_START /* line 1 */
40      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB)
41      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("End") PORT_CODE(KEYCODE_END)
42      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER)
43      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Back") PORT_CODE(KEYCODE_BACKSPACE)
44      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT)
45      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP)
46      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT)
47      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN)
48   PORT_START /* line 2 */
49      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0)
50      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1)
51      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2)
52      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3)
53      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4)
54      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5)
55      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6)
56      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7)
57   PORT_START /* line 3 */
58      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8)
59      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9)
60      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_EQUALS)
61      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_COLON)
62      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<") PORT_CODE(KEYCODE_COMMA)
63      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS)
64      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(">") PORT_CODE(KEYCODE_STOP)
65      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_SLASH)
66   PORT_START /* line 4 */
67      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("~") PORT_CODE(KEYCODE_TILDE)
68      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A)
69      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B)
70      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C)
71      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D)
72      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E)
73      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F)
74      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G)
75   PORT_START /* line 5 */
76      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H)
77      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I)
78      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J)
79      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K)
80      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L)
81      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M)
82      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N)
83      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O)
84   PORT_START /* line 6 */
85      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P)
86      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q)
87      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R)
88      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S)
89      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T)
90      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U)
91      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V)
92      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W)
93   PORT_START /* line 7 */
94      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X)
95      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y)
96      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z)
97      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE)
98      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH)
99      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE)
100      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE)
101      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE)
102   PORT_START /* line 8 */
103      PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
104      PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
105      PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
106      PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
107      PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
108      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT)
109      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL)
110      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT)
111INPUT_PORTS_END
112
113/* Machine driver */
114static MACHINE_DRIVER_START( radio86 )
115    /* basic machine hardware */
116    MDRV_CPU_ADD(8080, XTAL_16MHz / 9)
117    MDRV_CPU_PROGRAM_MAP(radio86_mem, 0)
118    MDRV_MACHINE_RESET( radio86 )
119
120   MDRV_DEVICE_ADD( "ppi8255_1", PPI8255 )
121   MDRV_DEVICE_CONFIG( radio86_ppi8255_interface_1 )
122
123   //MDRV_DEVICE_ADD( "ppi8255_2", PPI8255 )
124   //MDRV_DEVICE_CONFIG( radio86_ppi8255_interface_2 )
125
126   MDRV_DEVICE_ADD( "i8275", I8275 )
127   MDRV_DEVICE_CONFIG(radio86_i8275_interface)
128    /* video hardware */
129   MDRV_SCREEN_ADD("main", RASTER)
130   MDRV_SCREEN_REFRESH_RATE(50)
131   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
132   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
133   MDRV_SCREEN_SIZE(78*6, 30*10)
134   MDRV_SCREEN_VISIBLE_AREA(0, 78*6-1, 0, 30*10-1)
135   MDRV_PALETTE_LENGTH(2)
136   MDRV_PALETTE_INIT(black_and_white)
137
138   MDRV_VIDEO_START(generic_bitmapped)
139   MDRV_VIDEO_UPDATE(radio86)
140
141MACHINE_DRIVER_END
142
143/* ROM definition */
144ROM_START( radio86 )
145   ROM_REGION( 0x10000, REGION_CPU1, ROMREGION_ERASEFF )
146   ROM_LOAD( "bios.rom", 0xf000, 0x0800, CRC(BF1CEEA5))
147   ROM_LOAD( "bios.rom", 0xf800, 0x0800, CRC(BF1CEEA5))
148   ROM_REGION(0x0800, REGION_GFX1,0)
149   ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(21E9ED84) )
150ROM_END
151
152ROM_START( radio4k )
153   ROM_REGION( 0x10000, REGION_CPU1, ROMREGION_ERASEFF )
154   ROM_LOAD( "bios4k.rom", 0xf000, 0x1000, CRC(2AC9D864))
155   ROM_REGION(0x0800, REGION_GFX1,0)
156   ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(21E9ED84) )
157ROM_END
158
159/* Driver */
160
161/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT   INIT    CONFIG COMPANY   FULLNAME       FLAGS */
162COMP( 1986, radio86, 0,      0,    radio86,    radio86,radio86, NULL,  "",    "Radio-86RK",   0)
163COMP( 1986, radio4k, radio86, 0,    radio86,    radio86,radio86, NULL,  "",    "Radio-86RK 4k",   0)
docs/messnew.txt
r2768r2769
55- OSCOM Nano  [Curt Coder, HobbyLabs]
66- Galaksija Plus [Miodrag Milanovic]
77- Grundy NewBrain A/AD/MD (not working) [Curt Coder]
8- Radio-86RK [Miodrag Milanovic]
89
9
1010System Driver Changes:
1111----------------------
1212- [AMIGA] Fixed Keyboard. (bug #1590) [Roberto Zandonà]
r2768r2769
5555
5656- [GENESIS / MD] Fixed cheat issue [ShimaPong, Fabio Priuli]
5757
58- [I8275] Implementation of Intel 8275 CRT [Miodrag Milanovic]
59
5860- [MSX2] Fixed bug in floppy emulation.  [Yano Hirokuni]
5961
6062- [ORION] Added SHA-1's.  [Fabio Priuli]

Previous 15994 Revisions Next


© 1998-2018 The MESS Team