Previous 15994 Revisions Next

r4510 Saturday 18th April, 2009 at 05:35:01 UTC by Robbbert
[KAYPRO2] WIP - added 2 nonworking clones, removed old kaypro driver
[src/mess]mess.mak messdriv.c
[src/mess/audio]kaypro.c
[src/mess/drivers]kaypro.c kaypro2.c
[src/mess/machine]cpm_bios.c cpm_bios.h cpm_disk.c kay_kbd.c kay_kbd.h kaypro.c
[src/mess/video]kaypro.c

src/mess/audio/kaypro.c
r4509r4510
1/******************************************************************************
2 *   kaypro.c
3 *
4 *   KAYPRO terminal beeper emulation
5 *
6 ******************************************************************************/
7
8#include "driver.h"
9#include "includes/kaypro.h"
10#include "streams.h"
11
12#ifdef UNUSED_FUNCTION
13static   sound_stream  *channel;
14#endif
15#define BELL_FREQ   1000
16static   INT32 bell_signal;
17#ifdef UNUSED_FUNCTION
18static   INT32 bell_counter;
19#endif
20
21#define CLICK_FREQ   2000
22static   INT32 click_signal;
23#ifdef UNUSED_FUNCTION
24static   INT32 click_counter;
25#endif
26
27#ifdef UNUSED_FUNCTION
28static STREAM_UPDATE( kaypro_sound_update )
29{
30   stream_sample_t *buffer = outputs[0];
31
32   while (samples-- > 0)
33   {
34      if ((bell_counter -= BELL_FREQ) < 0)
35      {
36         bell_counter += device->machine->sample_rate;
37         bell_signal = -(bell_signal * 127) / 128;
38      }
39      if ((click_counter -= CLICK_FREQ) < 0)
40      {
41         click_counter += device->machine->sample_rate;
42         click_signal = -(click_signal * 3) / 4;
43      }
44      *buffer++ = bell_signal + click_signal;
45   }
46}
47
48
49static CUSTOM_START( kaypro_sh_start )
50{
51   channel = stream_create(device, 0, 1, device->machine->sample_rate, 0, kaypro_sound_update);
52   return 0;
53}
54#endif
55
56
57/******************************************************
58 *   Ring my bell ;)
59 ******************************************************/
60
61void kaypro_bell(void)
62{
63   bell_signal = 0x3000;
64}
65
66
67
68/******************************************************
69 *   Clicking keys (for the Kaypro 2x)
70 ******************************************************/
71
72void kaypro_click(void)
73{
74   click_signal = 0x3000;
75}
76
77
78
src/mess/video/kaypro.c
r4509r4510
1/******************************************************************************
2 *   kaypro.c
3 *
4 *   KAYPRO terminal emulation for CP/M
5 *
6 *   from Juergen Buchmueller's VT52 emulation, July 1998
7 *   Benjamin C. W. Sittler, July 1998
8 *
9 ******************************************************************************/
10
11/*
12 * The Kaypro 2/II, 4 and 10 emulate the Lear-Siegler ADM-3A terminal.
13 * Here are the commands they accept:
14 *
15 * Control Characters
16 *
17 * 0x00 - Ignored
18 * 0x09 - Horizontal tab (stops every 8 columns)
19 * 0x07 - Ring Bell (translated to 0x04 and sent to keyboard)
20 * 0x08 - Cursor Left (non-destructive backspace)
21 * 0x0c - Cursor Right
22 * 0x0a - Cursor Down (linefeed)
23 * 0x0b - Cursor Up
24 * 0x0d - Cursor to beginning of line (carriage return)
25 * 0x17 - Clear to end of screen
26 * 0x18 - Clear to end of line
27 * 0x1a - Clear screen, home cursor
28 * 0x1b - ESCape sequence prefix
29 * 0x1e - Home cursor
30 *
31 * ESCape Sequences
32 *
33 * ESCape,A - Display lower case [0]
34 * ESCape,G - Display greek [0]
35 * ESCape,E - Insert line [1]
36 * ESCape,R - Delete line [1]
37 * ESCape,=,row+32,col+32 - Cursor address
38 *
39 * Additionally, the following codes apply to: KAYPRO 2/84, 2X, 4/84, 4X, 10,
40 * ROBIE, and 1 (KAYPRO computers with graphic capability):
41 *
42 * ESCape,B,0 - Reverse video start
43 * ESCape,C,0 - Reverse video stop
44 * ESCape,B,1 - Half intensity start
45 * ESCape,C,1 - Half intensity stop
46 * ESCape,B,2 - Blinking start
47 * ESCape,C,2 - Blinking stop
48 * ESCape,B,3 - Underline start
49 * ESCape,C,3 - Underline stop
50 * ESCape,B,4 - Cursor on, 1/16 sec blink
51 * ESCape,C,4 - Cursor off
52 * ESCape,B,5 - Video mode on [2]
53 * ESCape,C,5 - Video mode off [2]
54 * ESCape,B,6 - Remember current cursor position
55 * ESCape,C,6 - Return to last remembered cursor position
56 * ESCape,B,7 - Status line preservation on
57 * ESCape,C,7 - Status line preservation off
58 * ESCape,*,y+32,x+32 - Set pixel
59 * ESCape, ,y+32,x+32 - Clear pixel
60 * ESCape,L,y+32,x+32,y2+32,x2+32 - Set line
61 * ESCape,D,y+32,x+32,y2+32,x2+32 - Delete line
62 *
63 * Illegal escape sequences are ignored.
64 *
65 * [0] - These sequences were used by the Kaypro 2/II. They are ignored
66 *       on later machines.
67 *
68 * [1] - These sequences are reversed in the KAYPRO documentation;
69 *       this is how they're actually implemented by the ROM console
70 *       driver.
71 *
72 * [2] - In video mode, block graphics (characters in the range 0x80 - 0xff)
73 *       are treated specially. Every GB1 block graphic (the 1st, 3rd, etc.
74 *       after starting video mode) is not printed; rather, its low bit is
75 *       used to set the lower-left block of the next (GB2) block graphic (by
76 *       inverting the low 7 bits and setting the reverse video bit,)
77 *       without affecting the reverse video mode for normal characters.
78 */
79
80#include "driver.h"
81#include "cpu/z80/z80.h"
82#include "includes/kaypro.h"
83#include "mscommon.h"
84
85
86enum state {
87   ST_NORMAL,
88   ST_ESCAPE,
89   ST_CURPOS_ROW,
90   ST_CURPOS_COL,
91   ST_SET_ATTRIB,
92   ST_CLR_ATTRIB,
93   ST_SET_LINE,
94   ST_CLR_LINE,
95   ST_SET_PIXEL,
96   ST_CLR_PIXEL
97
98};
99
100/* visible character attributes */
101#define AT_MASK         0x0f00 /* visible attributes */
102#define AT_REVERSE        0x0200 /* reverse video */
103#define AT_HALF_INTENSITY 0x0400 /* half intensity */
104#define AT_BLINK        0x0800 /* blinking */
105#define AT_UNDERLINE     0x0100 /* underline */
106
107/* dummy character attributes */
108#define AT_VIDEO        0x1000 /* video mode */
109#define AT_VIDEO_GB1     0x4000 /* video GB1 mode */
110
111static int cur_x = 0, cur_y = 0; /* cursor position */
112static int old_x = 0, old_y = 0; /* remembered cursor position */
113static int scroll_lines = 0; /* number of lines to scroll */
114static int state = ST_NORMAL; /* command state */
115static int attrib = 0; /* current attributes */
116static int gb1 = 0; /* 0, AT_REVERSE or AT_VIDEO_GB1 */
117static int cursor = 1; /* cursor visibility */
118
119/* console keyboard buffer */
120static UINT8 kbd_buff[16];
121static int kbd_head = 0;
122static int kbd_tail = 0;
123
124static struct terminal *kaypro_terminal;
125
126static void kaypro_putstr(running_machine *machine, const char * src)
127{
128   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
129   while (*src)
130      kaypro_conout_w(space, 0, *src++);
131}
132
133static int kaypro_getcursorcode(int code)
134{
135   return code ^ 0x200;
136}
137
138VIDEO_START( kaypro )
139{
140   scroll_lines = KAYPRO_SCREEN_H;
141   videoram_size = KAYPRO_SCREEN_W * KAYPRO_SCREEN_H;
142
143   kaypro_terminal = terminal_create(machine, 0, ' ', 10, kaypro_getcursorcode, KAYPRO_SCREEN_W, KAYPRO_SCREEN_H);
144
145   kaypro_putstr(machine,
146   /* a test of GB1/GB2 video mode graphics */ \
147      "\033B5" /* start video mode */ \
148      "MESS KAYPRO Terminal Emulator          \200\220\200\263" \
149      "\200\263\200\202\200\260\200\263\200\263\200\243\200\203" \
150      "\200\260\200\263\200\263\200\263\200\221\200\263\200\263 " \
151      "\200\220\200\261\200\263\200\243\200\262\200\263\200\263" \
152      "\200\263\200\262\200\223\200\263\200\263\200\263\200\263" \
153      "\200\262\200\220\200\260\200\261\200\263\200\263\200\263" \
154      "\200\262\200\240\r\n" \
155      "                                      \200\220\200\263" \
156      "\200\263\200\262\200\263\200\263\200\203 \200\220\200\261" \
157      "\200\263\200\223\200\263\200\263 \200\263\200\263\200\260" \
158      "\200\263\200\243\200\222\200\263\200\263\200\260\200\261" \
159      "\200\263\200\243\200\261\200\262\200\260\200\261\200\263" \
160      "\200\223\200\261\200\263\200\202  \200\263\200\263\200\242\r\n" \
161      "\200\263\200\263\200\263\200\263\200\263\200\263\200\263" \
162      "\200\263\200\263\200\263\200\263\200\263\200\263\200\263" \
163      "\200\263\200\263\200\263\200\263\200\263\200\263\200\263" \
164      "\200\263\200\263\200\263\200\263\200\263\200\263\200\263" \
165      "\200\263\200\263\200\263\200\263\200\263\200\263\200\263" \
166      "\200\263\200\263\200\222\200\263\200\263\200\243\200\223" \
167      "\200\263\200\263\200\240\200\260\200\263\200\263\200\262" \
168      "\200\261\200\263\200\263\200\220\200\263\200\263\200\243" \
169      "\200\202\200\261\200\263\200\263\200\203\200\203\200\223" \
170      "\200\261\200\263\200\243\200\223\200\263\200\263\200\240" \
171      "\200\263\200\263\200\242  \200\261\200\263\200\243\r\n" \
172      "\200\263\200\263\200\263\200\263\200\263\200\263\200\263" \
173      "\200\263\200\263\200\263\200\263\200\263\200\263\200\263" \
174      "\200\263\200\263\200\263\200\263\200\263\200\263\200\263" \
175      "\200\263\200\263\200\263\200\263\200\263\200\263\200\263" \
176      "\200\263\200\263\200\263\200\263\200\263\200\263\200\263" \
177      "\200\263\200\222\200\263\200\263\200\243  \200\223\200\263" \
178      "\200\263\200\241\200\243\200\203\200\203\200\223\200\263" \
179      "\200\263\200\221\200\263\200\243 \200\261\200\263\200\263" \
180      "\200\202 \200\220\200\263\200\263\200\243 \200\221\200\263" \
181      "\200\263\200\242\200\203\200\263\200\263\200\263\200\263" \
182      "\200\203\200\203\r\n" \
183      "\033C5"); /* end video mode */
184}
185
186VIDEO_UPDATE( kaypro )
187{
188   static int blink_count = 0;
189   static int cursor_count = 0;
190
191   blink_count++;
192   if (!(blink_count & 15))
193   {
194      if (blink_count & 16)
195      {
196         palette_set_color_rgb(screen->machine, 3, 0,240,   0);
197         palette_set_color_rgb(screen->machine, 4, 0,120,   0);
198      }
199      else
200      {
201         palette_set_color_rgb(screen->machine, 3, 0,   0,   0);
202         palette_set_color_rgb(screen->machine, 4, 0,   0,   0);
203      }
204   }
205
206   cursor_count++;
207
208   if (cursor && (cursor_count & 16))
209      terminal_showcursor(kaypro_terminal);
210   else
211      terminal_hidecursor(kaypro_terminal);
212   terminal_setcursor(kaypro_terminal, cur_x, cur_y);
213   terminal_draw(bitmap, NULL, kaypro_terminal);
214   return 0;
215}
216
217/******************************************************
218 *   kaypro_vgbout
219 *   output a character code to the given offset
220 *   the given attributes are combined to the code
221 *   and the dirty flag is set if the code changed
222 ******************************************************/
223static void kaypro_vgbout(int offset, int data, short attr)
224{
225   data |= attr & AT_MASK;
226   terminal_putchar(kaypro_terminal, offset % KAYPRO_SCREEN_W, offset / KAYPRO_SCREEN_W, data);
227}
228
229/******************************************************
230 *   kaypro_out
231 *   output a character code to the given offset
232 *   the current attributes are combined to the code
233 *   and the dirty flag is set if the code changed
234 ******************************************************/
235static void kaypro_out(int offset, int data)
236{
237   kaypro_vgbout(offset, data, attrib);
238}
239
240/******************************************************
241 * kaypro_const_r (read console status)
242 * 00  no key available
243 * ff  key(s) available
244 ******************************************************/
245 READ8_HANDLER (   kaypro_const_r )
246{
247   int data = 0x00;
248   if( kbd_head != kbd_tail )
249      data = 0xff;
250   return data;
251}
252
253/******************************************************
254 *   kaypro_const_w (write console status ;)
255 *   bit
256 *   0   flush keyboard buffer
257 ******************************************************/
258WRITE8_HANDLER ( kaypro_const_w )
259{
260   if (data & 1)
261      kbd_head = kbd_tail = 0;
262}
263
264/******************************************************
265 *   kaypro_conin_r (read console input, ie. keyboard)
266 *   returns next character from the keyboard buffer
267 *   suspends CPU if no key is available
268 ******************************************************/
269 READ8_HANDLER (   kaypro_conin_r )
270{
271   int data = 0;
272
273   if (kbd_tail != kbd_head)
274   {
275      data = kbd_buff[kbd_tail];
276      kbd_tail = (kbd_tail + 1) % sizeof(kbd_buff);
277   }
278   return data;
279}
280
281/******************************************************
282 *   kaypro_conin_w
283 *   stuff character into the keyboard buffer
284 *   releases CPU if it was waiting for a key
285 *   sounds bell if buffer would overflow
286 ******************************************************/
287WRITE8_HANDLER ( kaypro_conin_w )
288{
289   int kbd_head_old;
290
291   kaypro_click();
292
293   kbd_head_old = kbd_head;
294   kbd_buff[kbd_head] = data;
295   kbd_head = (kbd_head + 1) % sizeof(kbd_buff);
296   /* will the buffer overflow ? */
297   if (kbd_head == kbd_tail)
298   {
299      kbd_head = kbd_head_old;
300      kaypro_bell();
301   }
302}
303
304/******************************************************************************
305 *   kaypro_scroll
306 *   scroll the screen buffer from line top to line scroll_lines-1
307 *   either up or down. scroll up if lines > 0, down if lines < 0
308 *   repeat lines times and mark changes in dirtybuffer
309 ******************************************************************************/
310static void kaypro_scroll(int top, int lines)
311{
312   int x, y;
313   short attr;
314   while (lines)
315   {
316      if (lines > 0)
317      {
318         for( y = top; y < scroll_lines - 1; y++ )
319         {
320            for( x = 0; x < KAYPRO_SCREEN_W; x++ )
321            {
322               terminal_putchar(kaypro_terminal, x, y, terminal_getchar(kaypro_terminal, x, y+1));
323            }
324         }
325         attr = ' ';
326         for (x = 0; x < KAYPRO_SCREEN_W; x++)
327         {
328            terminal_putchar(kaypro_terminal, x, scroll_lines - 1, attr);
329         }
330         lines--;
331      }
332      else
333      {
334         for (y = scroll_lines - 1; y > top; y--)
335         {
336            for (x = 0; x < KAYPRO_SCREEN_W; x++)
337            {
338               terminal_putchar(kaypro_terminal, x, y, terminal_getchar(kaypro_terminal, x, y-1));
339            }
340         }
341         attr = ' ';
342         for (x = 0; x < KAYPRO_SCREEN_W; x++)
343         {
344            terminal_putchar(kaypro_terminal, x, top, attr);
345         }
346         lines++;
347      }
348   }
349}
350
351static void kaypro_cursor_home(void)
352{
353   cur_x = 0;
354   cur_y = 0;
355}
356
357static void kaypro_carriage_return(void)
358{
359   cur_x = 0;
360}
361
362static void kaypro_cursor_left(int count)
363{
364   while( count-- )
365   {
366      if( cur_x )
367         cur_x--;
368   }
369}
370
371static void kaypro_cursor_right(int count)
372{
373   while( count-- )
374   {
375      if( cur_x < KAYPRO_SCREEN_W )
376         cur_x++;
377   }
378}
379
380static void kaypro_line_feed(int count)
381{
382   /* don't scroll if beyond last line already (protected line 25) */
383   if( cur_y >= scroll_lines )
384      return;
385   while( count-- )
386   {
387      if( ++cur_y >= scroll_lines )
388      {
389         cur_y = scroll_lines - 1;
390         kaypro_scroll(0, +1);
391      }
392   }
393}
394
395static void kaypro_reverse_line_feed(int count)
396{
397   while( count-- )
398   {
399      if( --cur_y < 0 )
400      {
401         cur_y = 0;
402         kaypro_scroll(0, -1);
403      }
404   }
405}
406
407static void kaypro_advance(void)
408{
409
410   kaypro_cursor_right(1);
411   if (cur_x >= KAYPRO_SCREEN_W)
412   {
413      kaypro_carriage_return();
414      kaypro_line_feed(1);
415   }
416}
417
418static void kaypro_erase_end_of_line(void)
419{
420   int x, attr;
421   attr = ' ';
422
423   for (x = cur_x; x < KAYPRO_SCREEN_W; x++)
424      terminal_putchar(kaypro_terminal, x, cur_y, attr);
425}
426
427static void kaypro_erase_end_of_screen(void)
428{
429   int x, y, attr;
430
431   attr = ' ';
432   kaypro_erase_end_of_line();
433
434   for (y = cur_y + 1; y < scroll_lines; y++)
435   {
436      for (x = 0; x < KAYPRO_SCREEN_W; x++)
437         terminal_putchar(kaypro_terminal, x, y, attr);
438   }
439}
440
441static void kaypro_clear_screen(void)
442{
443   attrib &= ~ AT_MASK; /* clear visible attributes */
444   kaypro_cursor_home();
445   kaypro_erase_end_of_screen();
446}
447
448static void kaypro_tab(void)
449{
450   do
451   {
452      kaypro_out(cur_y * KAYPRO_SCREEN_W + cur_x, ' ');
453      kaypro_advance();
454   } while (cur_x & 7);
455}
456
457static void kaypro_pixel(int x, int y, int set)
458{
459   static const int attr_bits[4][2] = {
460      {     0x002, 0x001},
461      {     0x008, 0x004},
462      {     0x020, 0x010},
463      {AT_REVERSE, 0x040}
464   };
465   int cx, cy, /*offs,*/ bits;
466   short attr;
467
468   /* The Kaypro 2x font has a 2x4 pattern block graphics */
469   cx = x / 2;
470   cy = y / 4;
471   //offs = cy * KAYPRO_SCREEN_W + cx;
472   attr = terminal_getchar(kaypro_terminal, cx, cy);
473
474   /* if it is a space, we change it to a graphic space */
475   if ((attr & 0xff) == ' ')
476      attr = (attr & 0xff00) | 0x80;
477
478   /* if it is non graphics, we do nothing */
479   if (! (attr & 0x80))
480      return;
481
482   /* reverse video (lower-left pixel) inverts all the other pixels */
483   if (attr & AT_REVERSE)
484      attr ^= 0x7f;
485
486   /* get the bit mask for the pixel */
487   bits = attr_bits[y % 4][x % 2];
488
489   /* set it ? */
490   if (set)
491      attr |= bits;
492   else
493      attr &= ~ bits;
494
495   /* reverse video (lower-left pixel) inverts all the other pixels */
496   if (attr & AT_REVERSE)
497      attr ^= 0x7f;
498
499   terminal_putchar(kaypro_terminal, cx, cy, attr);
500}
501
502static void kaypro_line(int x0, int y0, int x1, int y1, int set)
503{
504   int dx, dy, sx, sy, c;
505
506   /* delta x and direction */
507   dx = x1 - x0;
508   if (dx < 0)
509   {
510      sx = -1;
511      dx = -dx;
512   }
513   else
514   {
515      sx = +1;
516   }
517   /* delta y and direction */
518   dy = y1 - y0;
519   if (dy < 0)
520   {
521      sy = -1;
522      dy = -dy;
523   }
524   else
525   {
526      sy = +1;
527   }
528   /* The standard Bresenham algorithm ;) */
529   if (dx > dy)
530   {
531      c = dx / 2;
532      for ( ; ; )
533      {
534         kaypro_pixel(x0, y0, set);
535         if (x0 == x1)
536            break;
537         x0 += sx;
538         if ((c -= dy) <= 0)
539         {
540            c += dx;
541            y0 += sy;
542         }
543      }
544   }
545   else
546   {
547      c = dy / 2;
548      for ( ; ; )
549      {
550         kaypro_pixel(x0, y0, set);
551         if (y0 == y1)
552            break;
553         y0 += sy;
554         if ((c -= dx) <= 0)
555         {
556            c += dy;
557            x0 += sx;
558         }
559      }
560   }
561}
562
563
564 READ8_HANDLER ( kaypro_conout_r )
565{
566   return 0xFF;
567}
568
569WRITE8_HANDLER ( kaypro_conout_w )
570{
571   static int argcnt = 0;
572   static int argval[4];
573
574   data &= 0xff;
575   switch (state)
576   {
577   case ST_NORMAL:
578      switch (data)
579      {
580      case 0x00: /* NUL is ignored */
581         break;
582      case 0x07: /* ring my bell ;) */
583         logerror("KAYPRO <007>     bell\n");
584         kaypro_bell();
585         break;
586      case 0x08: /* cursor left */
587         kaypro_cursor_left(1);
588         break;
589      case 0x09: /* tabulator */
590         kaypro_tab();
591         break;
592      case 0x0a: /* line feed */
593         kaypro_line_feed(1);
594         break;
595      case 0x0b: /* reverse line feed */
596         kaypro_reverse_line_feed(1);
597         break;
598      case 0x0d: /* carriage return */
599         kaypro_carriage_return();
600         break;
601      case 0x17: /* clear to end of screen */
602         logerror("KAYPRO <027>     clear to end of screen\n");
603         kaypro_erase_end_of_screen();
604         break;
605      case 0x18: /* clear to end of line */
606         logerror("KAYPRO <030>     clear to end of line\n");
607         kaypro_erase_end_of_line();
608         break;
609      case 0x1a: /* clear screen */
610         logerror("KAYPRO <032>     clear screen, home cursor\n");
611         kaypro_clear_screen();
612         break;
613      case 0x1b: /* ESCape sequence prefix */
614         state = ST_ESCAPE;
615         break;
616      case 0x1e: /* kaypro cursor home */
617         logerror("KAYPRO <036>     cursor home\n");
618         kaypro_cursor_home();
619         break;
620      default:
621         if( (attrib & AT_VIDEO) && (data & 0x80) )
622         {
623            if (gb1 & AT_VIDEO_GB1)
624            {
625               gb1 = (data & 1) ? AT_REVERSE : 0;
626            }
627            else
628            {
629               if (gb1)
630                  data ^= 0x7f;
631               kaypro_vgbout(cur_y * KAYPRO_SCREEN_W + cur_x, data, gb1 | attrib);
632               kaypro_advance();
633               gb1 = AT_VIDEO_GB1;
634            }
635         }
636         else
637         {
638            kaypro_out(cur_y * KAYPRO_SCREEN_W + cur_x, data);
639            kaypro_advance();
640         }
641      }
642      break;
643
644   case ST_ESCAPE:
645      state = ST_NORMAL;
646      switch (data)
647      {
648      case ' ': /* clear dot */
649         argcnt = 2;
650         state = ST_CLR_PIXEL;
651         break;
652      case '=': /* cursor positioning */
653         logerror("KAYPRO <ESC>=    cursor position\n");
654         state = ST_CURPOS_ROW;
655         break;
656      case '*': /* set dot */
657         argcnt = 2;
658         state = ST_SET_PIXEL;
659         break;
660      case 'A': /* Display lower case */
661         logerror("KAYPRO <ESC>A    display lower case (ignored)\n");
662         break;
663      case 'B': /* enable attribute */
664         logerror("KAYPRO <ESC>B    enable attribute\n");
665         state = ST_SET_ATTRIB;
666         break;
667      case 'C': /* disable attribute */
668         logerror("KAYPRO <ESC>C    disable attribute\n");
669         state = ST_CLR_ATTRIB;
670         break;
671      case 'D': /* delete line of dots */
672         argcnt = 4;
673         state = ST_CLR_LINE;
674         break;
675      case 'E': /* insert line */
676         logerror("KAYPRO <ESC>E    insert line\n");
677         kaypro_scroll(cur_y, -1);
678         break;
679      case 'G': /* Display greek */
680         logerror("KAYPRO <ESC>G    display greek (ignored)\n");
681         break;
682      case 'H': /* cursor home */
683         logerror("KAYPRO <ESC>H    cursor home\n");
684         kaypro_cursor_home();
685         break;
686      case 'L': /* set line of dots */
687         argcnt = 4;
688         state = ST_SET_LINE;
689         break;
690      case 'R': /* delete line */
691         logerror("KAYPRO <ESC>R    delete line\n");
692         kaypro_scroll(cur_y, +1);
693         break;
694      default:  /* some other escape sequence? */
695         logerror("KAYPRO <ESC>%c    unknown\n", data);
696      }
697      break;
698
699   case ST_CURPOS_ROW:
700      cur_y = data - ' ';
701      logerror("KAYPRO cursor y  %d\n", cur_y);
702      if( cur_y < 0 )
703         cur_y = 0;
704      if( cur_y >= KAYPRO_SCREEN_H )
705         cur_y = KAYPRO_SCREEN_H - 1;
706      state = ST_CURPOS_COL;
707      break;
708
709   case ST_CURPOS_COL:
710      cur_x = data - ' ';
711      logerror("KAYPRO cursor x  %d\n", cur_x);
712      if( cur_x < 0 )
713         cur_x = 0;
714      if( cur_x >= KAYPRO_SCREEN_W )
715         cur_x = KAYPRO_SCREEN_W - 1;
716      state = ST_NORMAL;
717      break;
718
719   case ST_SET_ATTRIB:
720      state = ST_NORMAL;
721      switch (data)
722      {
723      case '0': /* reverse video */
724         logerror("KAYPRO <ESC>B0   reverse on\n");
725         attrib |= AT_REVERSE;
726         break;
727      case '1': /* half intensity */
728         logerror("KAYPRO <ESC>B1   half intensity\n");
729         attrib |= AT_HALF_INTENSITY;
730         break;
731      case '2': /* start blinking */
732         logerror("KAYPRO <ESC>B2   start blinking\n");
733         attrib |= AT_BLINK;
734         break;
735      case '3': /* start underlining */
736         logerror("KAYPRO <ESC>B3   start underlining\n");
737         attrib |= AT_UNDERLINE;
738         break;
739      case '4': /* cursor on */
740         logerror("KAYPRO <ESC>B4   cursor on\n");
741         cursor = 1;
742         break;
743      case '5': /* video mode on */
744         logerror("KAYPRO <ESC>B5   video mode on\n");
745         attrib |= AT_VIDEO;
746         gb1 = AT_VIDEO_GB1;
747         break;
748      case '6': /* remember cursor position */
749         logerror("KAYPRO <ESC>B6   save cursor (%d,%d)\n", cur_x, cur_y);
750         old_x = cur_x;
751         old_y = cur_y;
752         break;
753      case '7': /* preserve status line */
754         logerror("KAYPRO <ESC>B7   preserve status line\n");
755         scroll_lines = KAYPRO_SCREEN_H - 1;
756         break;
757      default:
758         logerror("KAYPRO <ESC>B%c   unknown\n", data);
759         break;
760      }
761      break;
762
763   case ST_CLR_ATTRIB:
764      state = ST_NORMAL;
765      switch (data)
766      {
767      case '0': /* stop reverse video */
768         logerror("KAYPRO <ESC>C0   reverse off\n");
769         attrib &= ~ AT_REVERSE;
770         break;
771      case '1': /* normal intensity */
772         logerror("KAYPRO <ESC>C1   normal intensity\n");
773         attrib &= ~ AT_HALF_INTENSITY;
774         break;
775      case '2': /* stop blinking */
776         logerror("KAYPRO <ESC>C2   stop blinking\n");
777         attrib &= ~ AT_BLINK;
778         break;
779      case '3': /* stop underlining */
780         logerror("KAYPRO <ESC>C3   stop underlining\n");
781         attrib &= ~ AT_UNDERLINE;
782         break;
783      case '4': /* cursor off */
784         logerror("KAYPRO <ESC>C4   cursor off\n");
785         cursor = 0;
786         break;
787      case '5': /* video mode off */
788         logerror("KAYPRO <ESC>C5   video mode off\n");
789         attrib &= ~ AT_VIDEO;
790         break;
791      case '6': /* restore cursor position */
792         logerror("KAYPRO <ESC>C6   restore cursor (%d,%d)\n", old_x, old_y);
793         cur_x = old_x;
794         cur_y = old_y;
795         break;
796      case '7': /* don't preserve status line */
797         logerror("KAYPRO <ESC>C7   don't preserve status line\n");
798         scroll_lines = KAYPRO_SCREEN_H;
799         break;
800      default:
801         logerror("KAYPRO <ESC>C%c   unknown\n", data);
802         break;
803      }
804      break;
805
806   case ST_SET_LINE:
807      if( argcnt > 0 )
808      {
809         argval[--argcnt] = data - ' ';
810         if( !argcnt )
811         {
812            int x0, y0, x1, y1;
813            x1 = argval[0];
814            y1 = argval[1];
815            x0 = argval[2];
816            y0 = argval[3];
817            logerror("KAYPRO <ESC>L    set line %d,%d - %d,%d\n", x0,y0,x1,y1);
818            kaypro_line(x0,y0,x1,y1, 1);
819            argcnt = 0;
820            state = ST_NORMAL;
821         }
822      }
823      break;
824
825   case ST_CLR_LINE:
826      if( argcnt > 0 )
827      {
828         argval[--argcnt] = data - ' ';
829         if( !argcnt )
830         {
831            int x0, y0, x1, y1;
832            x1 = argval[0];
833            y1 = argval[1];
834            x0 = argval[2];
835            y0 = argval[3];
836            logerror("KAYPRO <ESC>D    clr line %d,%d - %d,%d\n", x0,y0,x1,y1);
837            kaypro_line(x0,y0,x1,y1, 0);
838            argcnt = 0;
839            state = ST_NORMAL;
840         }
841      }
842      break;
843
844   case ST_SET_PIXEL:
845      if( argcnt > 0 )
846      {
847         argval[--argcnt] = data - ' ';
848         if( !argcnt )
849         {
850            int x0, y0;
851            x0 = argval[0];
852            y0 = argval[1];
853            logerror("KAYPRO <ESC>*    set pixel %d,%d\n", x0, y0);
854            kaypro_pixel(x0,y0, 1);
855            argcnt = 0;
856            state = ST_NORMAL;
857         }
858      }
859      break;
860
861   case ST_CLR_PIXEL:
862      if( argcnt > 0 )
863      {
864         argval[--argcnt] = data - ' ';
865         if( !argcnt )
866         {
867            int x0, y0;
868            x0 = argval[0];
869            y0 = argval[1];
870            logerror("KAYPRO <ESC>     clr pixel %d,%d\n", x0, y0);
871            kaypro_pixel(x0,y0, 0);
872            argcnt = 0;
873            state = ST_NORMAL;
874         }
875      }
876      break;
877   }
878}
879
src/mess/messdriv.c
r4509r4510
596596   DRIVER( phc64 )      /* Hegener & Glaser Mephisto PHC 64               */
597597
598598   /* NON LINEAR SYSTEMS */
599   DRIVER( kaypro )   /* Kaypro 2X                              */
600   DRIVER( kaypro2 )   /* Kaypro 2/83                              */
599   DRIVER( kaypro2x )   /* Kaypro 2 - new */
600   DRIVER( kayproii )   /* Kaypro II - 2/83 */
601   DRIVER( omni2 )      /* Omni II */
601602
602603   /* VEB MIKROELEKTRONIK */
603604   /* KC compact is partial CPC compatible */
src/mess/machine/cpm_disk.c
r4509r4510
1/******************************************************************************
2 *
3 *  A list of commonly used floppy disk formats
4 *  This is converted from 22disk's list of formats (ver 1.40)
5 *
6 ******************************************************************************/
7
8static const dsk_fmt formats[] = {
9   {
10      "ATHD", "IBM AT DSHD 3.5\"",
11      0,   /* unique format */
12      DEN_MFM_HI, 80,2, 18, 512, 1,
13      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,},
14      {  1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,},
15      ORD_SIDES, "CPM62K",
16      {   72,  4, 15,  0, 719, 255,0xf0,0x00, 64,  1},
17   },
18   {
19      "A1", "Generic CP/M - SSSD 8\"",
20      0,   /* unique format */
21      DEN_FM_HI, 77,1, 26, 128, 1,
22      {  0, 1,7,13,19,25,5,11,17,23,3,9,15,21,2,8,14,20,26,6,12,18,24,4,10,16,22,},
23      {  0, },
24      ORD_SIDES, 0,
25      {   26,  3,  7,  0, 242,  63,0xc0,0x00, 16,  2},
26   },
27   {
28      "ABC1", "ABC-80 - SSDD 48 tpi 5.25\"",
29      0,   /* unique format */
30      DEN_MFM_LO, 40,1, 16, 256, 1,
31      {  0, 1,8,15,6,13,4,11,2,9,16,7,14,5,12,3,10,},
32      {  0, },
33      ORD_SIDES, 0,
34      {   32,  3,  7,  0, 151,  63,0xc0,0x00, 16,  2},
35   },
36   {
37      "ABD1", "A. B. Dick Magna III - DSDD 48 tpi 5.25\"",
38      0,   /* unique format */
39      DEN_MFM_LO, 40,2, 16, 256, 2,
40      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
41      {  0, 17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,},
42      ORD_SIDES, 0,
43      {   32,  3,  7,  0, 255, 255,0xff,0x00, 64,  4},
44   },
45   {
46      "ACT1", "Actrix (Access Matrix) - SSDD 48 tpi 5.25\"",
47      0,   /* unique format */
48      DEN_MFM_LO, 40,1,  9, 512, 1,
49      {  0, 1,4,7,2,5,8,3,6,9,},
50      {  0, },
51      ORD_SIDES, 0,
52      {   36,  3,  7,  0, 170,  63,0xc0,0x00, 16,  2},
53   },
54   {
55      "ADL1", "Adler Textriter - SSDD 48 tpi 5.25\"",
56      0,   /* unique format */
57      DEN_MFM_LO, 40,1, 16, 256, 1,
58      {  0, 1,4,7,10,13,16,3,6,9,12,15,2,5,8,11,14,},
59      {  0, },
60      ORD_SIDES, 0,
61      {   32,  3,  7,  0, 159,  31,0x80,0x00,  8,  0},
62   },
63   {
64      "ADV1", "Advanced Digital Super 6 - SSDD 48 tpi 5.25\"",
65      0,   /* unique format */
66      DEN_MFM_LO, 40,1,  4,1024, 1,
67      {  0, 1,2,3,4,},
68      {  0, },
69      ORD_SIDES, 0,
70      {   32,  4, 15,  0,  77,  63,0x80,0x00, 16,  1},
71   },
72   {
73      "ADV3", "Advanced Digital Super 6 - DSDD 96 tpi 5.25\"",
74      0,   /* unique format */
75      DEN_MFM_LO, 80,2,  4,1024, 2,
76      {  0, 1,2,3,4,},
77      {  1, 1,2,3,4,},
78      ORD_SIDES, 0,
79      {   32,  4, 15,  0, 300, 127,0xc0,0x00, 32,  2},
80   },
81   {
82      "ADV5", "Advanced Digital TurboDOS 312K - DSDD 48 tpi 5.25\"",
83      0,   /* unique format */
84      DEN_MFM_LO, 40,2,  4,1024, 1,
85      {  0, 1,2,3,4,},
86      {  0, 1,2,3,4,},
87      ORD_SIDES, 0,
88      {   32,  4, 15,  1, 155, 127,0xc0,0x00, 32,  2},
89   },
90   {
91      "ALT5", "Altos Series 5 - DSDD 96 tpi 5.25\"",
92      0,   /* unique format */
93      DEN_MFM_LO, 80,2,  9, 512, 2,
94      {  0, 1,2,3,4,5,6,7,8,9,},
95      {  1, 1,2,3,4,5,6,7,8,9,},
96      ORD_SIDES, 0,
97      {   36,  5, 31,  3, 176, 176,0xc0,0x00, 44,  2},
98   },
99   {
100      "AMI1", "Amigo - SSDD 48 tpi 5.25\"",
101      0,   /* unique format */
102      DEN_MFM_LO, 40,1, 10, 512, 3,
103      {  0, 1,2,3,4,5,6,7,8,9,10,},
104      {  0, },
105      ORD_SIDES, 0,
106      {   40,  3,  7,  0, 189,  63,0xc0,0x00, 16,  2},
107   },
108   {
109      "AMP1", "Ampro - SSDD 48 tpi 5.25\"",
110      0,   /* unique format */
111      DEN_MFM_LO, 40,1, 10, 512, 2,
112      {  0, 1,2,3,4,5,6,7,8,9,10,},
113      {  0, },
114      ORD_SIDES, 0,
115      {   40,  4, 15,  1,  94,  63,0x80,0x00, 16,  2},
116   },
117   {
118      "AMP3", "Ampro - SSDD 96 tpi 5.25\"",
119      0,   /* unique format */
120      DEN_MFM_LO, 80,1,  5,1024, 2,
121      {  0, 1,2,3,4,5,},
122      {  0, },
123      ORD_SIDES, 0,
124      {   40,  4, 15,  1, 194, 127,0xc0,0x00, 32,  2},
125   },
126   {
127      "AMS1", "Amstrad PCW8256 - DSDD 96 tpi 5.25\"",
128      0,   /* unique format */
129      DEN_MFM_LO, 80,2,  9, 512, 2,
130      {  0, 1,2,3,4,5,6,7,8,9,},
131      {  1, 1,2,3,4,5,6,7,8,9,},
132      ORD_SIDES, "AMS1",
133      {   36,  4, 15,  0, 356, 255,0xf0,0x00, 64,  1},
134   },
135   {
136      "AMSD", "Amstrad PCW 9256, 9512 Disckit - DSDD 3.5\"",
137      "AMS1",   /* reused format */
138   },
139   {
140        "APL1", "Apple ][ - SSDD 48 tpi 5.25\" (CP/M)",
141        0,  /* unique format */
142      DEN_MFM_LO, 35,1, 16, 256, 1,
143        {  0, 0,3,6,9,12,15,2,5,8,11,14,1,4,7,10,13},
144        {  0, },
145        ORD_SIDES, 0,
146      {   32,  3,  7,  0, 127,  47,0xc0,0x00, 12,  3},
147    },
148    {
149      "APL2", "Apple ][ - SSDD 48 tpi 5.25\" (CP/M read as DOS 3.3 image)",
150      0,   /* unique format */
151      DEN_MFM_LO, 35,1, 16, 256, 1,
152      {  0, 0,6,12,3,9,15,14,5,11,2,8,7,13,4,10,1},
153      {  0, },
154      ORD_SIDES, 0,
155      {   32,  3,  7,  0, 127,  47,0xc0,0x00, 12,  3},
156   },
157    {
158      "ARC1", "Archive I - SSDD 96 tpi 5.25\"",
159      0,   /* unique format */
160      DEN_MFM_LO, 80,1,  5,1024, 1,
161      {  0, 1,4,2,5,3,},
162      {  0, },
163      ORD_SIDES, 0,
164      {   40,  4, 15,  1, 194, 127,0xc0,0x00, 32,  2},
165   },
166   {
167      "ARC2", "Archive II & III - DSDD 96 tpi 5.25\"",
168      0,   /* unique format */
169      DEN_MFM_LO, 80,2,  5,1024, 1,
170      {  0, 1,4,2,5,3,},
171      {  1, 1,4,2,5,3,},
172      ORD_SIDES, 0,
173      {   40,  4, 15,  0, 394, 319,0xf8,0x00, 80,  2},
174   },
175   {
176      "ARI1", "Arisia - SSDD 48 tpi 5.25\"",
177      0,   /* unique format */
178      DEN_MFM_LO, 40,1, 18, 256, 2,
179      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,},
180      {  0, },
181      ORD_SIDES, 0,
182      {   36,  3,  7,  0, 147, 127,0xf0,0x00, 32,  2},
183   },
184   {
185      "ATR1", "ATR-8000 - SSDD 48 tpi 5.25\"",
186      0,   /* unique format */
187      DEN_MFM_LO, 40,1,  5,1024, 3,
188      {  0, 1,2,3,4,5,},
189      {  0, },
190      ORD_SIDES, 0,
191      {   40,  3,  7,  0, 189,  63,0xc0,0x00, 16,  2},
192   },
193   {
194      "AVA1", "Avatar - DSDD 48 tpi 5.25\"",
195      0,   /* unique format */
196      DEN_MFM_LO, 40,2, 10, 512, 1,
197      {  0, 1,5,9,3,7,2,6,10,4,8,},
198      {  1, 1,5,9,3,7,2,6,10,4,8,},
199      ORD_CYLINDERS, 0,
200      {   40,  4, 15,  1, 191, 127,0xc0,0x00, 32,  3},
201   },
202   {
203      "BEE1", "Beehive - DSDD 48 tpi 5.25\"",
204      0,   /* unique format */
205      DEN_MFM_LO, 40,2, 10, 512, 2,
206      {  0, 1,2,3,4,5,6,7,8,9,10,},
207      {  1, 1,2,3,4,5,6,7,8,9,10,},
208      ORD_SIDES, 0,
209      {   40,  4, 15,  1, 194, 127,0xc0,0x00, 32,  2},
210   },
211   {
212      "BEE2", "Beehive Microbee - DSDD 48 tpi 5.25\"",
213      0,   /* unique format */
214      DEN_MFM_LO, 40,2, 10, 512, 1,
215      {  0, 2,5,8,1,4,7,10,3,6,9,},
216      {  1, 2,5,8,1,4,7,10,3,6,9,},
217      ORD_SIDES, 0,
218      {   40,  4, 15,  1, 194, 127,0xc0,0x00, 32,  2},
219   },
220   {
221      "BIT1", "Bitelex - SSDD 48 tpi 5.25\"",
222      0,   /* unique format */
223      DEN_MFM_LO, 40,1, 16, 256, 1,
224      {  0, 1,3,5,7,9,11,13,15,2,4,6,8,10,12,14,16,},
225      {  0, },
226      ORD_SIDES, 0,
227      {   32,  3,  7,  0, 131,  95,0xe0,0x00, 24,  2},
228   },
229   {
230      "BMC1", "BMC IF800 Model 20 - DSDD 48 tpi 5.25\"",
231      0,   /* unique format */
232      DEN_MFM_LO, 40,2, 10, 512, 1,
233      {  0, 1,7,13,19,5,11,17,3,9,15,},
234      {  1, 1,7,13,19,5,11,17,3,9,15,},
235      ORD_SIDES, 0,
236      {   40,  4, 15,  0, 191, 127,0xc0,0x00, 32,  3},
237   },
238   {
239      "BON1", "Bondwell 12 - SSDD 48 tpi 5.25\"",
240      0,   /* unique format */
241      DEN_MFM_LO, 40,1, 18, 256, 2,
242      {  0, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,},
243      {  0, },
244      ORD_SIDES, 0,
245      {   36,  4, 15,  1,  84, 127,0xc0,0x00, 32,  2},
246   },
247   {
248      "BON2", "Bondwell 14 - DSDD 48 tpi 5.25\"",
249      0,   /* unique format */
250      DEN_MFM_LO, 40,2, 18, 256, 2,
251      {  0, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,},
252      {  1, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,},
253      ORD_CYLINDERS, 0,
254      {   36,  4, 15,  1, 174, 127,0xc0,0x00, 32,  2},
255   },
256   {
257      "BUR1", "Burr-Brown - DSDD 48 tpi 5.25\"",
258      0,   /* unique format */
259      DEN_MFM_LO, 40,2, 18, 256, 1,
260      {  0, 1,10,2,11,3,12,4,13,5,14,6,15,7,16,8,17,9,18,},
261      {  1, 1,10,2,11,3,12,4,13,5,14,6,15,7,16,8,17,9,18,},
262      ORD_SIDES, 0,
263      {   36,  4, 15,  1, 170,  63,0x80,0x00, 16,  4},
264   },
265   {
266      "CAL1", "Cal-PC - DSDD 48 tpi 5.25\"",
267      0,   /* unique format */
268      DEN_MFM_LO, 40,2,  5,1024, 1,
269      {  0, 1,2,3,4,5,},
270      {  1, 1,2,3,4,5,},
271      ORD_SIDES, 0,
272      {   40,  4, 15,  1, 194, 127,0xc0,0x00, 32,  2},
273   },
274   {
275      "CAS1", "Cashcom 100 - DSDD 96 tpi 5.25\"",
276      0,   /* unique format */
277      DEN_MFM_LO, 80,2,  4,1024, 1,
278      {  0, 1,2,3,4,},
279      {  1, 1,2,3,4,},
280      ORD_SIDES, 0,
281      {   32,  4, 15,  0, 303, 127,0xc0,0x00, 32,  2},
282   },
283   {
284      "CAS2", "Casio FP-1100/FP-1020 - DSDD 48tpi 5.25\"",
285      "FUJ2",   /* reused format */
286   },
287   {
288      "CCS1", "CCS (256 bytes/sector) - DSDD 48 tpi 5.25\"",
289      0,   /* unique format */
290      DEN_MFM_LO, 40,2, 18, 256, 1,
291      {  0, 1,5,9,13,17,3,7,11,15,2,6,10,14,18,4,8,12,16,},
292      {  0, 1,5,9,13,17,3,7,11,15,2,6,10,14,18,4,8,12,16,},
293      ORD_SIDES, 0,
294      {   36,  4, 15,  1, 165,  63,0x80,0x00, 16,  6},
295   },
296   {
297      "CCS2", "CCS (512 bytes/sector) - DSDD 48 tpi 5.25\"",
298      0,   /* unique format */
299      DEN_MFM_LO, 40,2, 10, 512, 1,
300      {  0, 1,4,7,10,3,6,9,2,5,8,},
301      {  0, 1,4,7,10,3,6,9,2,5,8,},
302      ORD_SIDES, 0,
303      {   40,  4, 15,  1, 184,  63,0x80,0x00, 16,  6},
304   },
305   {
306      "CCS3", "CCS (1024 bytes/sector) - DSDD 48 tpi 5.25\"",
307      0,   /* unique format */
308      DEN_MFM_LO, 40,2,  5,1024, 1,
309      {  0, 1,3,5,2,4,},
310      {  0, 1,3,5,2,4,},
311      ORD_SIDES, 0,
312      {   40,  4, 15,  1, 184,  63,0x80,0x00, 16,  6},
313   },
314   {
315      "CDI1", "CDI-5000 - DSDD 48 tpi 5.25\"",
316      0,   /* unique format */
317      DEN_MFM_LO, 40,2,  5,1024, 1,
318      {  0, 1,4,2,5,3,},
319      {  1, 1,4,2,5,3,},
320      ORD_SIDES, 0,
321      {   40,  4, 15,  1, 194,  63,0x80,0x00, 16,  2},
322   },
323   {
324      "CMC1", "CMC Supersystem 2 - DSDD 96 tpi 5.25\"",
325      0,   /* unique format */
326      DEN_MFM_LO, 80,2,  5,1024, 1,
327      {  0, 1,2,3,4,5,},
328      {  1, 1,2,3,4,5,},
329      ORD_SIDES, 0,
330      {   40,  4, 15,  0, 391, 127,0xc0,0x00, 32,  3},
331   },
332   {
333      "COL1", "Coleco ADAM, 40 track - SSDD 48 tpi 5.25\"",
334      0,   /* unique format */
335      DEN_MFM_LO, 40,1,  8, 512, 1,
336      {  0, 1,6,3,8,5,2,7,4,},
337      {  0, },
338      ORD_SIDES, 0,
339      {   32,  3,  7,  0, 146,  63,0xc0,0x00, 16,  2},
340   },
341   {
342      "COM1", "Compis - DSDD 96 tpi 5.25\"",
343      0,   /* unique format */
344      DEN_MFM_LO, 80,2,  8, 512, 2,
345      {  0, 1,2,3,4,5,6,7,8,},
346      {  1, 1,2,3,4,5,6,7,8,},
347      ORD_CYLINDERS, 0,
348      {   32,  4, 15,  0, 317, 127,0xc0,0x00, 32,  1},
349   },
350   {
351      "COM2", "Compugraphic MCS-5 - SSDD 48 tpi 5.25\"",
352      0,   /* unique format */
353      DEN_MFM_LO, 40,1, 16, 256, 1,
354      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
355      {  0, },
356      ORD_SIDES, 0,
357      {   32,  3,  7,  0, 155,  63,0xc0,0x00, 16,  1},
358   },
359   {
360      "COM3", "Compustar Model 30 - DSDD 48 tpi 5.25\"",
361      0,   /* unique format */
362      DEN_MFM_LO, 35,2, 10, 512, 1,
363      {  0, 1,3,5,7,9,2,4,6,8,10,},
364      {  1, 1,3,5,7,9,2,4,6,8,10,},
365      ORD_EAGLE, 0,
366      {   40,  4, 15,  1, 169,  63,0x80,0x00, 16,  2},
367   },
368   {
369      "COM4", "Compupro (Viasyn) (1024 bytes/sector) - DSDD 96 tpi 5.25\"",
370      0,   /* unique format */
371      DEN_MFM_LO, 80,2,  5,1024, 1,
372      {  0, 1,3,5,2,4,},
373      {  1, 1,3,5,2,4,},
374      ORD_SIDES, 0,
375      {   40,  4, 15,  0, 389, 255,0xf0,0x00, 64,  4},
376   },
377   {
378      "CRO1", "Cromemco CDOS - SSSD 48 tpi 5.25\"",
379      0,   /* unique format */
380      DEN_FM_LO, 40,1, 18, 128, 1,
381      {  0, 1,6,11,16,3,8,13,18,5,10,15,2,7,12,17,4,9,14,},
382      {  0, },
383      ORD_SIDES, 0,
384      {   18,  3,  7,  0,  82,  63,0xc0,0x00, 16,  3},
385   },
386   {
387      "CRO3", "Cromemco CDOS - SSDD 48 tpi 5.25\"",
388      0,   /* unique format */
389      DEN_MFM_LO, 40,1, 10, 512, 1,
390      {  0, 1,5,9,3,7,2,6,10,4,8,},
391      {  0, },
392      ORD_SIDES, "CRO3",
393      {   40,  3,  7,  0, 189,  63,0xc0,0x00, 16,  2},
394   },
395   {
396      "CRO6", "Cromemco CP/M - SSDD 48 tpi 5.25\"",
397      0,   /* unique format */
398      DEN_MFM_LO, 40,1, 10, 512, 1,
399      {  0, 1,4,7,10,3,6,9,2,5,8,},
400      {  0, },
401      ORD_SIDES, 0,
402      {   40,  4, 15,  1,  94, 127,0xc0,0x00, 32,  2},
403   },
404   {
405      "CWP1", "C/WP Cortex - SSDD 48 tpi 5.25\"",
406      0,   /* unique format */
407      DEN_MFM_LO, 40,1, 10, 512, 3,
408      {  0, 1,2,3,4,5,6,7,8,9,10,},
409      {  0, },
410      ORD_SIDES, 0,
411      {   40,  3,  7,  0, 189,  63,0xc0,0x00, 16,  2},
412   },
413   {
414      "CYK1", "Cykey - DSDD 48 tpi 5.25\"",
415      0,   /* unique format */
416      DEN_MFM_LO, 40,2, 16, 256, 1,
417      {  0, 1,5,9,13,2,6,10,14,3,7,11,15,4,8,12,16,},
418      {  1, 1,5,9,13,2,6,10,14,3,7,11,15,4,8,12,16,},
419      ORD_SIDES, 0,
420      {   32,  4, 15,  1, 153,  63,0xc0,0x00, 16,  3},
421   },
422   {
423      "DAT1", "Datavue DV80 - DSDD 48 tpi 5.25\"",
424      0,   /* unique format */
425      DEN_MFM_LO, 40,2, 10, 512, 3,
426      {  0, 129,130,131,132,133,134,135,136,137,138,},
427      {  1, 129,130,131,132,133,134,135,136,137,138,},
428      ORD_SIDES, 0,
429      {   40,  5, 31,  3,  94, 127,0x80,0x00, 32,  4},
430   },
431   {
432      "DAT2", "Datavue DV80 - DSDD 96 tpi 5.25\"",
433      0,   /* unique format */
434      DEN_MFM_LO, 80,2, 10, 512, 3,
435      {  0, 193,194,195,196,197,198,199,200,201,202,},
436      {  1, 193,194,195,196,197,198,199,200,201,202,},
437      ORD_SIDES, 0,
438      {   40,  5, 31,  3, 194, 127,0x80,0x00, 32,  4},
439   },
440   {
441      "DEC1", "DEC DECMate II - SSDD 96 tpi 5.25\"",
442      0,   /* unique format */
443      DEN_MFM_LO, 80,1, 10, 512, 1,
444      {  0, 1,3,5,7,9,2,4,6,8,10,},
445      {  0, },
446      ORD_SIDES, 0,
447      {   40,  4, 15,  1, 194, 127,0xc0,0x00, 32,  2},
448   },
449   {
450      "DEC2", "DEC Rainbow - SSDD 96 tpi 5.25\"",
451      "DEC1",   /* reused format */
452   },
453   {
454      "DEC3", "DEC VT-180 - SSDD 48 tpi 5.25\"",
455      0,   /* unique format */
456      DEN_MFM_LO, 40,1,  9, 512, 1,
457      {  0, 1,3,5,7,9,2,4,6,8,},
458      {  0, },
459      ORD_SIDES, 0,
460      {   36,  3,  7,  0, 170,  63,0xc0,0x00, 16,  2},
461   },
462   {
463      "DIG1", "Digilog - DSDD 48 tpi 5.25\"",
464      0,   /* unique format */
465      DEN_MFM_LO, 35,2,  5,1024, 1,
466      {  0, 1,2,3,4,5,},
467      {  0, 1,2,3,4,5,},
468      ORD_EAGLE, 0,
469      {   40,  4, 15,  1, 166,  63,0x80,0x00, 16,  3},
470   },
471   {
472      "DIG2", "Digilog 1500 - DSDD 96 tpi 5.25\"",
473      0,   /* unique format */
474      DEN_MFM_LO, 80,2,  5,1024, 1,
475      {  0, 1,2,3,4,5,},
476      {  1, 1,2,3,4,5,},
477      ORD_CYLINDERS, 0,
478      {   40,  4, 15,  0, 392, 127,0xc0,0x00, 32,  3},
479   },
480   {
481      "DIR1", "Direct 1025 - DSDD 48 tpi 5.25\"",
482      0,   /* unique format */
483      DEN_MFM_LO, 40,2, 16, 256, 1,
484      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
485      {  1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
486      ORD_SIDES, 0,
487      {   32,  4, 15,  0, 152, 127,0xc0,0x00, 32,  3},
488   },
489   {
490      "DIS1", "Discovery - DSDD 96 tpi 5.25\"",
491      0,   /* unique format */
492      DEN_MFM_LO, 80,2,  8, 512, 2,
493      {  0, 1,2,3,4,5,6,7,8,},
494      {  1, 1,2,3,4,5,6,7,8,},
495      ORD_SIDES, 0,
496      {   32,  4, 15,  0, 313, 127,0xc0,0x00, 32,  3},
497   },
498   {
499      "EAG1", "Eagle II - SSDD 96 tpi 5.25\"",
500      0,   /* unique format */
501      DEN_MFM_LO, 80,1,  5,1024, 1,
502      {  0, 1,3,5,2,4,},
503      {  0, },
504      ORD_SIDES, 0,
505      {   40,  4, 15,  1, 194, 191,0xe0,0x00, 48,  2},
506   },
507   {
508      "EAG2", "Eagle III - DSDD 96 tpi 5.25\"",
509      0,   /* unique format */
510      DEN_MFM_LO, 80,2,  5,1024, 1,
511      {  0, 1,3,5,2,4,},
512      {  1, 1,3,5,2,4,},
513      ORD_EAGLE, 0,
514      {   40,  4, 15,  0, 394, 191,0xe0,0x00, 48,  2},
515   },
516   {
517      "EPS1", "Epson QX-10 - DSDD 48 tpi 5.25\"",
518      0,   /* unique format */
519      DEN_MFM_LO, 40,2, 10, 512, 5,
520      {  0, 1,2,3,4,5,6,7,8,9,10,},
521      {  1, 1,2,3,4,5,6,7,8,9,10,},
522      ORD_SIDES, 0,
523      {   40,  4, 15,  1, 189, 127,0xc0,0x00, 32,  4},
524   },
525   {
526      "EPS2", "Epson QX-10 (256 bytes/sector) - DSDD 48 tpi 5.25\"",
527      0,   /* unique format */
528      DEN_MFM_LO, 40,2, 16, 256, 1,
529      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
530      {  1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
531      ORD_SIDES, 0,
532      {   32,  4, 15,  1, 139,  63,0x80,0x00, 16,  8},
533   },
534   {
535      "EPS3", "Epson PX-8 - DSDD 3.5\"",
536      0,   /* unique format */
537      DEN_MFM_LO, 40,2,  8, 512, 1,
538      {  0, 1,2,3,4,5,6,7,8,},
539      {  1, 1,2,3,4,5,6,7,8,},
540      ORD_SIDES, 0,
541      {   32,  4, 15,  1, 139,  63,0x80,0x00, 16,  8},
542   },
543   {
544      "ERI1", "Ericsson DTC - SSDD 96 tpi 5.25\"",
545      0,   /* unique format */
546      DEN_MFM_LO, 80,1, 16, 256, 1,
547      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
548      {  0, },
549      ORD_SIDES, 0,
550      {   32,  5, 31,  3,  77, 127,0x80,0x00, 32,  2},
551   },
552   {
553      "ERI2", "Ericsson DTC2 - DSDD 96 tpi 5.25\"",
554      0,   /* unique format */
555      DEN_MFM_LO, 80,2, 16, 256, 1,
556      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
557      {  1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
558      ORD_CYLINDERS, 0,
559      {   32,  5, 31,  3, 157, 127,0x80,0x00, 32,  2},
560   },
561   {
562      "ERI3", "Ericsson Step One - DSDD 96 tpi 5.25\"",
563      0,   /* unique format */
564      DEN_MFM_LO, 80,2,  9, 512, 1,
565      {  0, 1,2,3,4,5,6,7,8,9,},
566      {  1, 1,2,3,4,5,6,7,8,9,},
567      ORD_SIDES, 0,
568      {   36,  5, 31,  3, 174, 127,0x80,0x00, 32,  4},
569   },
570   {
571      "FLO1", "Florida Graphics - DSDD 96 tpi 5.25\"",
572      0,   /* unique format */
573      DEN_MFM_LO, 80,2, 16, 256, 2,
574      {  0, 1,3,5,7,9,11,13,15,2,4,6,8,10,12,14,16,},
575      {  1, 1,3,5,7,9,11,13,15,2,4,6,8,10,12,14,16,},
576      ORD_SIDES, 0,
577      {   32,  4, 15,  0, 295, 127,0xc0,0x00, 32, 12},
578   },
579   {
580      "FOR1", "Formula 1 - DSDD 48 tpi 5.25\"",
581      0,   /* unique format */
582      DEN_MFM_LO, 40,2, 18, 256, 1,
583      {  0, 1,2,5,6,9,10,13,14,17,18,3,4,7,8,11,12,15,16,},
584      {  1, 1,2,5,6,9,10,13,14,17,18,3,4,7,8,11,12,15,16,},
585      ORD_SIDES, 0,
586      {   36,  4, 15,  1, 172, 127,0xc0,0x00, 32,  3},
587   },
588   {
589      "FUJ1", "Fujitsu Micro 16 - DSDD 48 tpi 5.25\"",
590      "IBM2",   /* reused format */
591   },
592   {
593      "FUJ2", "Fujitsu Micro 8 - DSDD 48 tpi 5.25\"",
594      0,   /* unique format */
595      DEN_MFM_LO, 40,2, 16, 256, 3,
596      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
597      {  1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
598      ORD_SIDES, 0,
599      {   32,  4, 15,  1, 151, 127,0xc0,0x00, 32,  4},
600   },
601   {
602      "GNA1", "Gnat System 10 - DSDD 48 tpi 5.25\"",
603      0,   /* unique format */
604      DEN_MFM_LO, 35,2, 10, 512, 2,
605      {  0, 1,2,3,4,5,6,7,8,9,10,},
606      {  1, 11,12,13,14,15,16,17,18,19,20,},
607      ORD_SIDES, 0,
608      {   40,  4, 15,  0, 169, 127,0xc0,0x00, 32,  2},
609   },
610   {
611      "HCL1", "HCL System 2 - DSDD 96 tpi 5.25\"",
612      0,   /* unique format */
613      DEN_MFM_LO, 80,2,  5,1024, 1,
614      {  0, 1,2,3,4,5,},
615      {  1, 1,2,3,4,5,},
616      ORD_SIDES, 0,
617      {   40,  4, 15,  0, 389, 255,0xf0,0x00, 64,  4},
618   },
619   {
620      "HEA1", "Heath H89, Magnolia CP/M - SSDD 48 tpi 5.25\"",
621      0,   /* unique format */
622      DEN_MFM_LO, 40,1,  9, 512, 4,
623      {  0, 1,2,3,4,5,6,7,8,9,},
624      {  0, },
625      ORD_SIDES, 0,
626      {   36,  4, 15,  1,  82,  95,0xc0,0x00, 24,  3},
627   },
628   {
629      "HEA3", "Heath H89, Magnolia CP/M - DSDD 96 tpi 5.25\"",
630      0,   /* unique format */
631      DEN_MFM_LO, 80,2,  9, 512, 4,
632      {  0, 1,2,3,4,5,6,7,8,9,},
633      {  1, 1,2,3,4,5,6,7,8,9,},
634      ORD_CYLINDERS, 0,
635      {   36,  5, 31,  3, 176, 127,0x80,0x00, 32,  3},
636   },
637   {
638      "HEU1", "Heurikon MLZ-91A - DSDD 96 tpi 5.25\"",
639      0,   /* unique format */
640      DEN_MFM_LO, 80,2, 16, 256, 1,
641      {  0, 1,2,5,6,9,10,13,14,3,4,7,8,11,12,15,16,},
642      {  1, 1,2,5,6,9,10,13,14,3,4,7,8,11,12,15,16,},
643      ORD_SIDES, 0,
644      {   32,  4, 15,  0, 315, 127,0xc0,0x00, 32,  2},
645   },
646   {
647      "HP1", "Hewlett-Packard HP 86, 87, 125 - DSDD 48 tpi 5.25\"",
648      0,   /* unique format */
649      DEN_MFM_LO, 40,2, 16, 256, 4,
650      {  0, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,},
651      {  1, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,},
652      ORD_SIDES, 0,
653      {   32,  3,  7,  0, 251, 127,0xf0,0x00, 32,  3},
654   },
655   {
656      "IBM1", "IBM PC, CP/M-86 - SSDD 48 tpi 5.25\"",
657      0,   /* unique format */
658      DEN_MFM_LO, 40,1,  8, 512, 1,
659      {  0, 1,2,3,4,5,6,7,8,},
660      {  0, },
661      ORD_SIDES, "IBM1",
662      {   32,  3,  7,  0, 155,  63,0xc0,0x00, 16,  1},
663   },
664   {
665      "IBM2", "IBM PC, CP/M-86 - DSDD 48 tpi 5.25\"",
666      0,   /* unique format */
667      DEN_MFM_LO, 40,2,  8, 512, 1,
668      {  0, 1,2,3,4,5,6,7,8,},
669      {  1, 1,2,3,4,5,6,7,8,},
670      ORD_CYLINDERS, "IBM2",
671      {   32,  4, 15,  1, 157,  63,0x80,0x00, 16,  1},
672   },
673   {
674      "IMS1", "IMS 5000 - SSDD 48 tpi 5.25\"",
675      0,   /* unique format */
676      DEN_MFM_LO, 40,1, 16, 256, 1,
677      {  0, 1,9,2,10,3,11,4,12,5,13,6,14,7,15,8,16,},
678      {  0, },
679      ORD_SIDES, 0,
680      {   32,  3,  7,  0, 147,  63,0xc0,0x00, 16,  3},
681   },
682   {
683      "IMS2", "IMS 5000 TurboDOS - DSDD 96 tpi 5.25\"",
684      0,   /* unique format */
685      DEN_MFM_LO, 80,2,  5,1024, 1,
686      {  0, 1,2,3,4,5,},
687      {  1, 1,2,3,4,5,},
688      ORD_SIDES, 0,
689      {   40,  4, 15,  0, 380, 127,0xc0,0x00, 32,  4},
690   },
691   {
692      "INT1", "Intel iPDS 100 - DSDD 96 tpi 5.25\"",
693      0,   /* unique format */
694      DEN_MFM_LO, 80,2, 16, 256, 4,
695      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
696      {  1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
697      ORD_SIDES, 0,
698      {   32,  4, 15,  0, 307, 255,0xf0,0x00, 64,  6},
699   },
700   {
701      "INS1", "Insight Enterprises - DSDD 48 tpi 5.25\"",
702      0,   /* unique format */
703      DEN_MFM_LO, 40,2, 16, 256, 1,
704      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
705      {  1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
706      ORD_SIDES, 0,
707      {   32,  4, 15,  1, 155,  63,0x80,0x00, 16,  2},
708   },
709   {
710      "ITH1", "Ithaca Intersystems - SSDD 96 tpi 5.25\"",
711      0,   /* unique format */
712      DEN_MFM_LO, 80,1, 18, 256, 2,
713      {  0, 1,2,5,6,9,10,13,14,17,18,3,4,7,8,11,12,15,16,},
714      {  0, },
715      ORD_SIDES, 0,
716      {   36,  4, 15,  1, 174, 127,0xc0,0x00, 32,  2},
717   },
718   {
719      "JET1", "Jet-80 - DSDD 48 tpi 5.25\"",
720      0,   /* unique format */
721      DEN_MFM_LO, 40,2,  5,1024, 1,
722      {  0, 1,2,3,4,5,},
723      {  1, 1,2,3,4,5,},
724      ORD_SIDES, 0,
725      {   40,  4, 15,  1, 194, 127,0xc0,0x00, 32,  2},
726   },
727   {
728      "KAY1", "Kaypro II/2 - SSDD 48 tpi 5.25\"",
729      0,   /* unique format */
730      DEN_MFM_LO, 40,1, 10, 512, 4,
731      {  0, 0,1,2,3,4,5,6,7,8,9,},
732      {  0, },
733      ORD_SIDES, 0,
734      {   40,  3,  7,  0, 194,  63,0xf0,0x00, 16,  1},
735   },
736   {
737      "KAY2", "Kaypro 2X/4/10 - DSDD 48 tpi 5.25\"",
738      0,   /* unique format */
739      DEN_MFM_LO, 40,2, 10, 512, 4,
740      {  0, 0,1,2,3,4,5,6,7,8,9,},
741      {  0, 10,11,12,13,14,15,16,17,18,19,},
742      ORD_SIDES, 0,
743      {   40,  4, 15,  1, 196,  63,0xc0,0x00, 16,  1},
744   },
745   {
746      "KAY3", "Kaypro, Pro-8 ROM - DSDD 96 tpi 5.25\"",
747      0,   /* unique format */
748      DEN_MFM_LO, 80,2, 10, 512, 4,
749      {  0, 0,1,2,3,4,5,6,7,8,9,},
750      {  0, 20,21,22,23,24,25,26,27,28,29,},
751      ORD_SIDES, 0,
752      {   40,  5, 31,  3, 196,  95,0x80,0x00, 24,  2},
753   },
754   {
755      "KON1", "Kontron - DSDD 96 tpi 5.25\"",
756      0,   /* unique format */
757      DEN_MFM_LO, 77,2, 16, 256, 1,
758      {  0, 1,4,7,10,13,16,3,6,9,12,15,2,5,8,11,14,},
759      {  1, 1,4,7,10,13,16,3,6,9,12,15,2,5,8,11,14,},
760      ORD_CYLINDERS, 0,
761      {   32,  4, 15,  0, 299, 255,0xf0,0x00, 64,  4},
762   },
763   {
764      "LEX1", "Lexoriter - SSDD 48 tpi 5.25\"",
765      0,   /* unique format */
766      DEN_MFM_LO, 40,1, 16, 256, 1,
767      {  0, 1,4,7,10,13,16,3,6,9,12,15,2,5,8,11,14,},
768      {  0, },
769      ORD_SIDES, 0,
770      {   32,  3,  7,  0, 159,  31,0x80,0x00,  8,  0},
771   },
772   {
773      "LOB1", "Lobo Max-80 (256 bytes/sector) - SSDD 48 tpi 5.25\"",
774      0,   /* unique format */
775      DEN_MFM_LO, 40,1, 18, 256, 2,
776      {  0, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,},
777      {  0, },
778      ORD_SIDES, 0,
779      {   36,  3,  7,  0, 165,  63,0xc0,0x00, 16,  3},
780   },
781   {
782      "LOB3", "Lobo Max-80 (512 bytes/sector) - DSDD 48 tpi 5.25\"",
783      0,   /* unique format */
784      DEN_MFM_LO, 40,2, 10, 512, 2,
785      {  0, 0,1,2,3,4,5,6,7,8,9,},
786      {  1, 0,1,2,3,4,5,6,7,8,9,},
787      ORD_SIDES, 0,
788      {   40,  4, 15,  0, 191, 127,0xc0,0x00, 32,  3},
789   },
790   {
791      "LOB4", "Lobo Max-80 (512 bytes/sector) - DSDD 96 tpi 5.25\"",
792      0,   /* unique format */
793      DEN_MFM_LO, 80,2, 10, 512, 2,
794      {  0, 0,1,2,3,4,5,6,7,8,9,},
795      {  1, 0,1,2,3,4,5,6,7,8,9,},
796      ORD_SIDES, 0,
797      {   40,  4, 15,  0, 391, 255,0xf0,0x00, 64,  3},
798   },
799   {
800      "LNW1", "LNW 2 - SSDD 48 tpi 5.25\"",
801      0,   /* unique format */
802      DEN_MFM_LO, 40,1, 18, 256, 1,
803      {  0, 1,6,11,16,3,8,13,18,5,10,15,2,7,12,17,4,9,14,},
804      {  0, },
805      ORD_SIDES, 0,
806      {   36,  4, 15,  1,  82,  63,0x80,0x00, 16,  3},
807   },
808   {
809      "MAC1", "Macsym 150 - SSDD 96 tpi 5.25\"",
810      0,   /* unique format */
811      DEN_MFM_LO, 80,1,  8, 512, 1,
812      {  0, 1,2,3,4,5,6,7,8,},
813      {  0, },
814      ORD_SIDES, 0,
815      {   32,  4, 15,  1, 155, 127,0xc0,0x00, 32,  2},
816   },
817   {
818      "MAG1", "Magic - DSDD 48 tpi 5.25\"",
819      0,   /* unique format */
820      DEN_MFM_LO, 40,2, 10, 512, 3,
821      {  0, 1,2,3,4,5,6,7,8,9,10,},
822      {  1, 1,2,3,4,5,6,7,8,9,10,},
823      ORD_SIDES, 0,
824      {   40,  4, 15,  0, 194,  63,0x80,0x00, 16,  2},
825   },
826   {
827      "MAI1", "MAI Basic Four - DSDD 96 tpi 5.25\"",
828      0,   /* unique format */
829      DEN_MFM_LO, 80,2, 16, 256, 1,
830      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
831      {  1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
832      ORD_SIDES, 0,
833      {   32,  4, 15,  0, 312, 127,0xc0,0x00, 32,  3},
834   },
835   {
836      "MIC2", "Micromint SB180 - DSDD 48 tpi 5.25\"",
837      0,   /* unique format */
838      DEN_MFM_LO, 40,2, 10, 512, 2,
839      {  0, 17,18,19,20,21,22,23,24,25,26,},
840      {  1, 17,18,19,20,21,22,23,24,25,26,},
841      ORD_SIDES, 0,
842      {   40,  4, 15,  1, 194, 127,0xc0,0x00, 32,  2},
843   },
844   {
845      "MIC3", "Micron Quark - DSDD 48 tpi 5.25\"",
846      0,   /* unique format */
847      DEN_MFM_LO, 40,2,  4,1024, 1,
848      {  0, 1,2,3,4,},
849      {  1, 1,2,3,4,},
850      ORD_SIDES, 0,
851      {   32,  4, 15,  0, 155, 127,0xc0,0x00, 32,  2},
852   },
853   {
854      "MIC5", "Micro Source M6000 - DSDD 48 tpi 5.25\"",
855      0,   /* unique format */
856      DEN_MFM_LO, 40,2, 10, 512, 1,
857      {  0, 1,5,9,3,7,2,6,10,4,8,},
858      {  0, 11,15,19,13,17,12,16,20,14,18,},
859      ORD_SIDES, 0,
860      {   40,  4, 15,  1, 189, 127,0xc0,0x00, 32,  4},
861   },
862   {
863      "MOL1", "Molecular Series 9 - DSDD 48 tpi 5.25\"",
864      0,   /* unique format */
865      DEN_MFM_LO, 40,2,  9, 512, 2,
866      {  240, 1,2,3,4,5,6,7,8,9,},
867      {  242, 1,2,3,4,5,6,7,8,9,},
868      ORD_SIDES, 0,
869      {   36,  4, 15,  1, 179, 127,0xc0,0x00, 32,  4},
870   },
871   {
872      "MOL2", "Molecular/Durango Poppy 54 - DSDD 96 tpi 5.25\"",
873      0,   /* unique format */
874      DEN_MFM_LO, 80,2, 10, 512, 3,
875      {  0, 128,129,130,131,132,133,134,135,136,137,},
876      {  1, 138,139,140,141,142,143,144,145,146,147,},
877      ORD_SIDES, 0,
878      {   40,  4, 15,  0, 389, 127,0xc0,0x00, 32,  4},
879   },
880   {
881      "MON1", "Monroe 8800 Series - SSDD 96 tpi 5.25\"",
882      0,   /* unique format */
883      DEN_MFM_LO, 80,1, 16, 256, 1,
884      {  0, 1,5,9,13,2,6,10,14,3,7,11,15,4,8,12,16,},
885      {  0, },
886      ORD_SIDES, 0,
887      {   32,  4, 15,  1, 153,  63,0x80,0x00, 16,  3},
888   },
889   {
890      "MOR1", "Morrow MD2 - SSDD 48 tpi 5.25\"",
891      0,   /* unique format */
892      DEN_MFM_LO, 40,1,  5,1024, 1,
893      {  0, 1,4,2,5,3,},
894      {  0, },
895      ORD_SIDES, 0,
896      {   40,  4, 15,  1,  94, 127,0xc0,0x00, 32,  2},
897   },
898   {
899      "MOR2", "Morrow MD3, 5, 11, 16, 34 - DSDD 48 tpi 5.25\"",
900      0,   /* unique format */
901      DEN_MFM_LO, 40,2,  5,1024, 1,
902      {  0, 1,4,2,5,3,},
903      {  1, 1,4,2,5,3,},
904      ORD_SIDES, "MOR2",
905      {   40,  4, 15,  1, 194, 191,0xe0,0x00, 48,  2},
906   },
907   {
908      "MOR6", "Morrow TurboDOS - DSDD 48 tpi 5.25\"",
909      0,   /* unique format */
910      DEN_MFM_LO, 40,2,  4,1024, 1,
911      {  0, 1,2,3,4,},
912      {  1, 1,2,3,4,},
913      ORD_SIDES, 0,
914      {   32,  4, 15,  0, 155, 127,0xc0,0x00, 32,  2},
915   },
916   {
917      "NCR1", "NCR Decision Mate V - DSDD 48 tpi 5.25\"",
918      0,   /* unique format */
919      DEN_MFM_LO, 40,2,  8, 512, 2,
920      {  0, 1,2,3,4,5,6,7,8,},
921      {  1, 1,2,3,4,5,6,7,8,},
922      ORD_EAGLE, 0,
923      {   32,  4, 15,  1, 153, 127,0xc0,0x00, 32,  3},
924   },
925   {
926      "NCR2", "NCR FirstStep - DSDD 96 tpi 5.25\"",
927      0,   /* unique format */
928      DEN_MFM_LO, 80,2, 16, 256, 1,
929      {  0, 1,5,9,13,2,6,10,14,3,7,11,15,4,8,12,16,},
930      {  1, 1,5,9,13,2,6,10,14,3,7,11,15,4,8,12,16,},
931      ORD_SIDES, 0,
932      {   32,  4, 15,  0, 276, 255,0xf0,0x00, 64,  6},
933   },
934   {
935      "NEC1", "NEC PC-8001A - SSDD 48 tpi 5.25\"",
936      0,   /* unique format */
937      DEN_MFM_LO, 40,1, 16, 256, 1,
938      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
939      {  0, },
940      ORD_SIDES, 0,
941      {   32,  3,  7,  0, 151,  63,0xc0,0x00, 16,  2},
942   },
943   {
944      "NEC3", "NEC PC 8801A/8831A - DSDD 48 tpi 5.25\"",
945      0,   /* unique format */
946      DEN_MFM_LO, 40,2,  8, 512, 3,
947      {  0, 1,2,3,4,5,6,7,8,},
948      {  1, 1,2,3,4,5,6,7,8,},
949      ORD_SIDES, 0,
950      {   32,  4, 15,  1, 152, 127,0xc0,0x00, 32,  4},
951   },
952   {
953      "NEC4", "NEC PC 8500/8431A, Starlet - DSDD 3.5\"",
954      0,   /* unique format */
955      DEN_MFM_LO, 80,1, 16, 256, 3,
956      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
957      {  0, },
958      ORD_SIDES, 0,
959      {   32,  4, 15,  1, 151, 127,0xc0,0x00, 32,  4},
960   },
961   {
962      "NIA1", "Niat - DSDD 96 tpi 5.25\"",
963      0,   /* unique format */
964      DEN_MFM_LO, 80,2, 16, 256, 1,
965      {  0, 1,5,9,13,2,6,10,14,3,7,11,15,4,8,12,16,},
966      {  1, 1,5,9,13,2,6,10,14,3,7,11,15,4,8,12,16,},
967      ORD_CYLINDERS, 0,
968      {   32,  5, 31,  3, 157, 127,0x80,0x00, 32,  2},
969   },
970   {
971      "NIX1", "Nixdorf 8810/30 - DSDD 96 tpi 5.25\"",
972      0,   /* unique format */
973      DEN_MFM_LO, 80,2, 10, 512, 1,
974      {  0, 1,2,3,4,5,6,7,8,9,10,},
975      {  1, 1,2,3,4,5,6,7,8,9,10,},
976      ORD_SIDES, 0,
977      {   40,  4, 15,  0, 384, 127,0xc0,0x00, 32,  6},
978   },
979   {
980      "OKI1", "OKI IF800 Model 20 - DSDD 48 tpi 5.25\"",
981      0,   /* unique format */
982      DEN_MFM_LO, 40,2, 10, 512, 1,
983      {  0, 1,7,13,19,5,11,17,3,9,15,},
984      {  1, 1,7,13,19,5,11,17,3,9,15,},
985      ORD_SIDES, 0,
986      {   40,  4, 15,  0, 191, 127,0xc0,0x00, 32,  3},
987   },
988   {
989      "OLI1", "Olivetti ETV300 - SSDD 48 tpi 5.25\"",
990      0,   /* unique format */
991      DEN_MFM_LO, 40,1, 18, 256, 1,
992      {  0, 1,3,5,7,9,11,13,15,17,2,4,6,8,10,12,14,20,26,},
993      {  0, },
994      ORD_SIDES, 0,
995      {   36,  3,  7,  0, 170,  63,0xc0,0x00, 16,  2},
996   },
997   {
998      "OLI2", "Olivetti M20 - DSDD 48 tpi 5.25\"",
999      0,   /* unique format */
1000      DEN_MFM_LO, 40,2, 16, 256, 2,
1001      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
1002      {  1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
1003      ORD_SIDES, 0,
1004      {   32,  3,  7,  0, 255,  63,0xc0,0x00, 16,  3},
1005   },
1006   {
1007      "OLI3", "Olivetti 250 -  SSDD 3.5\"",
1008      0,   /* unique format */
1009      DEN_MFM_LO, 80,1, 16, 256, 1,
1010      {  0, 1,3,5,7,9,11,13,15,2,4,6,8,10,12,14,16,},
1011      {  0, },
1012      ORD_SIDES, 0,
1013      {   32,  4, 15,  1, 157,  63,0x80,0x00, 16,  1},
1014   },
1015   {
1016      "OLY1", "Olympia EX-100 - DSDD 48 tpi 5.25\"",
1017      0,   /* unique format */
1018      DEN_MFM_LO, 40,2,  9, 512, 2,
1019      {  0, 1,2,3,4,5,6,7,8,9,},
1020      {  1, 1,2,3,4,5,6,7,8,9,},
1021      ORD_SIDES, 0,
1022      {   36,  4, 15,  1, 174, 127,0xc0,0x00, 32,  2},
1023   },
1024   {
1025      "OLY2", "Olympia ETX II - SSDD 48 tpi 5.25\"",
1026      0,   /* unique format */
1027      DEN_MFM_LO, 40,1,  9, 512, 2,
1028      {  0, 1,2,3,4,5,6,7,8,9,},
1029      {  0, },
1030      ORD_SIDES, 0,
1031      {   36,  3,  7,  0, 170, 127,0xf0,0x00, 32,  2},
1032   },
1033   {
1034      "OSB1", "Osborne 1 - SSSD 48 tpi 5.25\"",
1035      0,   /* unique format */
1036      DEN_FM_LO, 40,1, 10, 256, 1,
1037      {  0, 1,3,5,7,9,2,4,6,8,10,},
1038      {  0, },
1039      ORD_SIDES, 0,
1040      {   20,  4, 15,  1,  45,  63,0x80,0x00, 16,  3},
1041   },
1042   {
1043      "OSB2", "Osborne 1 - SSDD 48 tpi 5.25\"",
1044      0,   /* unique format */
1045      DEN_MFM_LO, 40,1,  5,1024, 1,
1046      {  0, 1,2,3,4,5,},
1047      {  0, },
1048      ORD_SIDES, 0,
1049      {   40,  3,  7,  0, 184,  63,0xc0,0x00, 16,  3},
1050   },
1051   {
1052      "OSB3", "Osborne Executive - SSDD 48 tpi 5.25\"",
1053      0,   /* unique format */
1054      DEN_MFM_LO, 40,1,  5,1024, 1,
1055      {  0, 1,2,3,4,5,},
1056      {  0, },
1057      ORD_SIDES, 0,
1058      {   40,  3,  7,  0, 184,  63,0xc0,0x00, 16,  3},
1059   },
1060   {
1061      "OSB4", "Osborne G2 System - DSDD 48 tpi 5.25\"",
1062      0,   /* unique format */
1063      DEN_MFM_LO, 40,2,  5,1024, 1,
1064      {  0, 1,2,3,4,5,},
1065      {  1, 6,7,8,9,10,},
1066      ORD_SIDES, 0,
1067      {   40,  4, 15,  0, 189, 127,0xc0,0x00, 32,  4},
1068   },
1069   {
1070      "OSB5", "Osborne G2 System - DSDD 96 tpi 5.25\"",
1071      0,   /* unique format */
1072      DEN_MFM_LO, 80,2,  5,1024, 1,
1073      {  0, 1,2,3,4,5,},
1074      {  1, 6,7,8,9,10,},
1075      ORD_SIDES, 0,
1076      {   40,  4, 15,  0, 389, 255,0xf0,0x00, 64,  4},
1077   },
1078   {
1079      "OSB6", "Osborne 1 + Osmosis - DSDD 96 tpi 5.25\"",
1080      0,   /* unique format */
1081      DEN_MFM_LO, 40,2, 10, 512, 1,
1082      {  0, 1,3,5,7,9,2,4,6,8,10,},
1083      {  1, 1,3,5,7,9,2,4,6,8,10,},
1084      ORD_SIDES, 0,
1085      {   40,  4, 15,  0, 384, 127,0xc0,0x00, 32,  6},
1086   },
1087   {
1088      "OSB7", "Osborne Nuevo - DSDD 48 tpi 5.25\"",
1089      0,   /* unique format */
1090      DEN_MFM_LO, 40,2,  5,1024, 1,
1091      {  0, 1,3,5,2,4,},
1092      {  1, 6,8,10,7,9,},
1093      ORD_SIDES, 0,
1094      {   40,  4, 15,  1, 194, 127,0xc0,0x00, 32,  2},
1095   },
1096   {
1097      "OSB8", "Osborne Vixen - DSDD 48 tpi 5.25\"",
1098      0,   /* unique format */
1099      DEN_MFM_LO, 40,2,  5,1024, 1,
1100      {  0, 1,3,5,2,4,},
1101      {  1, 1,3,5,2,4,},
1102      ORD_SIDES, 0,
1103      {   40,  4, 15,  1, 194, 127,0xc0,0x00, 32,  2},
1104   },
1105   {
1106      "OSB9", "Osborne Executive w/Z3 - DSDD 96 tpi 5.25\"",
1107      0,   /* unique format */
1108      DEN_MFM_LO, 80,2,  5,1024, 1,
1109      {  0, 1,3,5,2,4,},
1110      {  1, 1,3,5,2,4,},
1111      ORD_SIDES, 0,
1112      {   40,  4, 15,  0, 395, 127,0xf8,0x00, 32,  2},
1113   },
1114   {
1115      "OSM1", "OSM Zeus 4 - DSDD 96 tpi 5.25\"",
1116      0,   /* unique format */
1117      DEN_MFM_LO, 80,2,  8, 512, 1,
1118      {  0, 1,2,3,4,5,6,7,8,},
1119      {  1, 1,2,3,4,5,6,7,8,},
1120      ORD_SIDES, 0,
1121      {   32,  4, 15,  0, 311, 127,0xc0,0x00, 32,  4},
1122   },
1123   {
1124      "OTR1", "Otrona Attache - DSDD 48 tpi 5.25\"",
1125      0,   /* unique format */
1126      DEN_MFM_LO, 40,2, 10, 512, 2,
1127      {  0, 1,2,3,4,5,6,7,8,9,10,},
1128      {  1, 1,2,3,4,5,6,7,8,9,10,},
1129      ORD_EAGLE, 0,
1130      {   40,  4, 15,  1, 181, 127,0xc0,0x00, 32,  3},
1131   },
1132   {
1133      "OTR2", "Otrona Attache - DSDD 96 tpi 5.25\"",
1134      0,   /* unique format */
1135      DEN_MFM_LO, 80,2, 10, 512, 2,
1136      {  0, 1,2,3,4,5,6,7,8,9,10,},
1137      {  1, 1,2,3,4,5,6,7,8,9,10,},
1138      ORD_CYLINDERS, 0,
1139      {   40,  4, 15,  0, 386, 127,0xc0,0x00, 32,  3},
1140   },
1141   {
1142      "PAN1", "Panasonic KX-E828 - DSDD 48 tpi 5.25\"",
1143      0,   /* unique format */
1144      DEN_MFM_LO, 40,2, 16, 256, 3,
1145      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
1146      {  1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
1147      ORD_SIDES, 0,
1148      {   32,  4, 15,  1, 151, 127,0xc0,0x00, 32,  4},
1149   },
1150   {
1151      "PEG1", "Pegasus Data Logger - DSDD 48 tpi 5.25\"",
1152      0,   /* unique format */
1153      DEN_MFM_LO, 40,2,  9, 512, 1,
1154      {  0, 1,4,7,2,5,8,3,6,9,},
1155      {  1, 1,4,7,2,5,8,3,6,9,},
1156      ORD_SIDES, 0,
1157      {   36,  4, 15,  0, 170,  63,0x80,0x00, 16,  6},
1158   },
1159   {
1160      "PHI1", "Philips PC-2010 - SSDD 48 tpi 5.25\"",
1161      0,   /* unique format */
1162      DEN_MFM_LO, 40,1, 16, 256, 1,
1163      {  0, 1,3,5,7,9,11,13,15,2,4,6,8,10,12,14,16,},
1164      {  0, },
1165      ORD_SIDES, 0,
1166      {   32,  3,  7,  0, 151,  63,0xc0,0x00, 16,  2},
1167   },
1168   {
1169      "PHI3", "Philips PC-3000 - 3004 - SSDD 96 tpi 5.25\"",
1170      0,   /* unique format */
1171      DEN_MFM_LO, 80,1, 16, 256, 1,
1172      {  0, 1,4,7,10,13,16,3,6,9,12,15,2,5,8,11,14,},
1173      {  0, },
1174      ORD_SIDES, 0,
1175      {   32,  4, 15,  1, 147,  63,0xc0,0x00, 16,  3},
1176   },
1177   {
1178      "PIE1", "Pied Piper - DSDD 96 tpi 5.25\"",
1179      0,   /* unique format */
1180      DEN_MFM_LO, 80,2, 10, 512, 1,
1181      {  0, 1,3,5,7,9,2,4,6,8,10,},
1182      {  1, 1,3,5,7,9,2,4,6,8,10,},
1183      ORD_SIDES, 0,
1184      {   40,  4, 15,  0, 391, 255,0xf0,0x00, 64,  3},
1185   },
1186   {
1187      "PMC1", "PMC Micromate - DSDD 48 tpi 5.25\"",
1188      0,   /* unique format */
1189      DEN_MFM_LO, 40,2,  5,1024, 1,
1190      {  0, 1,2,3,4,5,},
1191      {  1, 1,2,3,4,5,},
1192      ORD_SIDES, 0,
1193      {   40,  4, 15,  1, 194, 127,0xc0,0x00, 32,  2},
1194   },
1195   {
1196      "PRO2", "Proglas 770KB - DSDD 96 tpi 5.25\"",
1197      0,   /* unique format */
1198      DEN_MFM_LO, 80,2, 10, 512, 2,
1199      {  0, 1,2,3,4,5,6,7,8,9,10,},
1200      {  1, 1,2,3,4,5,6,7,8,9,10,},
1201      ORD_SIDES, 0,
1202      {   40,  4, 15,  0, 388, 255,0xf0,0x00, 64,  4},
1203   },
1204   {
1205      "ROY1", "Royal Alphatronic - DSDD 48 tpi 5.25\"",
1206      0,   /* unique format */
1207      DEN_MFM_LO, 40,2, 16, 256, 1,
1208      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
1209      {  1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
1210      ORD_SIDES, 0,
1211      {   32,  4, 15,  1, 151, 127,0xc0,0x00, 32,  4},
1212   },
1213   {
1214      "SAG1", "Sage IV - DSDD 48 tpi 5.25\"",
1215      0,   /* unique format */
1216      DEN_MFM_LO, 40,2,  8, 512, 1,
1217      {  0, 1,2,3,4,5,6,7,8,},
1218      {  1, 1,2,3,4,5,6,7,8,},
1219      ORD_CYLINDERS, 0,
1220      {   32,  4, 15,  1, 155,  63,0x80,0x00, 16,  2},
1221   },
1222   {
1223      "SAG2", "Sage IV - DSDD 96 tpi 5.25\"",
1224      0,   /* unique format */
1225      DEN_MFM_LO, 80,2,  8, 512, 1,
1226      {  0, 1,2,3,4,5,6,7,8,},
1227      {  1, 1,2,3,4,5,6,7,8,},
1228      ORD_SIDES, 0,
1229      {   32,  4, 15,  0, 315,  63,0x80,0x00, 16,  2},
1230   },
1231   {
1232      "SAN1", "Sanyo MBC-1000, MBC-1150 - DSDD 48 tpi 5.25\"",
1233      0,   /* unique format */
1234      DEN_MFM_LO, 40,2, 16, 256, 1,
1235      {  0, 1,4,7,10,13,16,3,6,9,12,15,2,5,8,11,14,},
1236      {  1, 1,4,7,10,13,16,3,6,9,12,15,2,5,8,11,14,},
1237      ORD_SIDES, 0,
1238      {   32,  4, 15,  1, 155,  63,0x80,0x00, 16,  2},
1239   },
1240   {
1241      "SAN2", "Sanyo  MBC-1250 - DSDD 96 tpi 5.25\"",
1242      0,   /* unique format */
1243      DEN_MFM_LO, 80,2, 16, 256, 1,
1244      {  0, 1,4,7,10,13,16,3,6,9,12,15,2,5,8,11,14,},
1245      {  1, 1,4,7,10,13,16,3,6,9,12,15,2,5,8,11,14,},
1246      ORD_SIDES, 0,
1247      {   32,  5, 31,  3, 155, 127,0x80,0x00, 32,  4},
1248   },
1249   {
1250      "SEE1", "Seequa Chameleon - SSDD 48 tpi 5.25\"",
1251      0,   /* unique format */
1252      DEN_MFM_LO, 40,1,  8, 512, 1,
1253      {  0, 1,2,3,4,5,6,7,8,},
1254      {  0, },
1255      ORD_SIDES, 0,
1256      {   32,  3,  7,  0, 155,  63,0xc0,0x00, 16,  1},
1257   },
1258   {
1259      "SEI1", "Seiko - DSDD 96 tpi 5.25\"",
1260      0,   /* unique format */
1261      DEN_MFM_LO, 80,2, 16, 256, 1,
1262      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
1263      {  1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
1264      ORD_SIDES, 0,
1265      {   32,  4, 15,  0, 315, 127,0xc0,0x00, 32,  2},
1266   },
1267   {
1268      "SHL1", "Shelton SIG/NET 2 - SSDD 48 tpi 5.25\"",
1269      "SUP2",   /* reused format */
1270   },
1271   {
1272      "SHA1", "Sharp MZ-80 - DSDD 48 tpi 5.25\"",
1273      0,   /* unique format */
1274      DEN_MFM_LO, 40,2, 10, 512, 2,
1275      {  1, 1,2,3,4,5,6,7,8,9,10,},
1276      {  0, 1,2,3,4,5,6,7,8,9,10,},
1277      ORD_SIDES, 0,
1278      {   40,  4, 15,  1, 169, 127,0xc0,0x00, 32,  2},
1279   },
1280   {
1281      "SIE1", "Siemens  PG-685 - DSDD 96 tpi 5.25\"",
1282      0,   /* unique format */
1283      DEN_MFM_LO, 80,2,  9, 512, 1,
1284      {  0, 1,2,3,4,5,6,7,8,9,},
1285      {  1, 1,2,3,4,5,6,7,8,9,},
1286      ORD_SIDES, 0,
1287      {   36,  4, 15,  0, 350, 255,0xf0,0x00, 64,  4},
1288   },
1289   {
1290      "SIE2", "Siemens PG-675 DSDD 48 tpi 5.25\"",
1291      0,   /* unique format */
1292      DEN_MFM_LO, 40,2,  9, 512, 1,
1293      {  0, 1,2,3,4,5,6,7,8,9,},
1294      {  1, 1,2,3,4,5,6,7,8,9,},
1295      ORD_SIDES, 0,
1296      {   36,  4, 15,  1, 170,  63,0x80,0x00, 16,  4},
1297   },
1298   {
1299      "SIE3", "Siemens PG-635 DSDD 3.5\"",
1300      0,   /* unique format */
1301      DEN_MFM_LO, 80,2,  9, 512, 1,
1302      {  0, 1,2,3,4,5,6,7,8,9,},
1303      {  1, 1,2,3,4,5,6,7,8,9,},
1304      ORD_SIDES, 0,
1305      {   36,  4, 15,  0, 350, 255,0xf0,0x00, 64,  4},
1306   },
1307   {
1308      "SOR1", "Sorbus TurboDOS - 5.25\" DSHD (or 8\" DSDD)",
1309      0,   /* unique format */
1310      DEN_MFM_HI, 77,2,  8,1024, 1,
1311      {  0, 1,2,3,4,5,6,7,8,},
1312      {  1, 1,2,3,4,5,6,7,8,},
1313      ORD_SIDES, 0,
1314      {   64,  5, 31,  1, 308, 255,0xc0,0x00, 64,  0},
1315   },
1316   {
1317      "SPE1", "Spectravideo SV-328 - DSDD 48 tpi 5.25\"",
1318      0,   /* unique format */
1319      DEN_MFM_LO, 40,2, 17, 256, 2,
1320      {  1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,},
1321      {  1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,},
1322      ORD_CYLINDERS, 0,
1323      {   34,  4, 15,  1, 162,  63,0x80,0x00, 16,  3},
1324   },
1325   {
1326      "SPE2", "Sperry UTS 30, UTS 5000 - DSDD 96 tpi 5.25\"",
1327      0,   /* unique format */
1328      DEN_MFM_LO, 80,2,  9, 512, 2,
1329      {  0, 1,2,3,4,5,6,7,8,9,},
1330      {  1, 1,2,3,4,5,6,7,8,9,},
1331      ORD_SIDES, 0,
1332      {   36,  4, 15,  0, 354, 383,0xfc,0x00, 96,  2},
1333   },
1334   {
1335      "SUP1", "Superbrain JR - SSDD 48 tpi 5.25\"",
1336      0,   /* unique format */
1337      DEN_MFM_LO, 35,1, 10, 512, 1,
1338      {  0, 1,3,5,7,9,2,4,6,8,10,},
1339      {  0, },
1340      ORD_SIDES, 0,
1341      {   40,  4, 15,  1,  81,  63,0x80,0x00, 16,  2},
1342   },
1343   {
1344      "SUP2", "Superbrain 40 track - SSDD 48 tpi 5.25\"",
1345      0,   /* unique format */
1346      DEN_MFM_LO, 40,1, 10, 512, 1,
1347      {  0, 1,3,5,7,9,2,4,6,8,10,},
1348      {  0, },
1349      ORD_SIDES, 0,
1350      {   40,  4, 15,  1,  94,  63,0x80,0x00, 16,  2},
1351   },
1352   {
1353      "SUP3", "Superbrain QD - DSDD 48 tpi 5.25\"",
1354      0,   /* unique format */
1355      DEN_MFM_LO, 35,2, 10, 512, 1,
1356      {  0, 1,3,5,7,9,2,4,6,8,10,},
1357      {  1, 1,3,5,7,9,2,4,6,8,10,},
1358      ORD_CYLINDERS, 0,
1359      {   40,  4, 15,  1, 169,  63,0x80,0x00, 16,  2},
1360   },
1361   {
1362      "SYS2", "Systel 2 - SSDD 48 tpi 5.25\"",
1363      0,   /* unique format */
1364      DEN_MFM_LO, 40,1,  9, 512, 2,
1365      {  0, 1,2,3,4,5,6,7,8,9,},
1366      {  0, },
1367      ORD_SIDES, 0,
1368      {   36,  3,  7,  0, 170, 127,0xf0,0x00, 32,  2},
1369   },
1370   {
1371      "SYS3", "Systel 3 - DSDD 48 tpi 5.25\"",
1372      0,   /* unique format */
1373      DEN_MFM_LO, 40,2,  9, 512, 2,
1374      {  0, 1,2,3,4,5,6,7,8,9,},
1375      {  1, 1,2,3,4,5,6,7,8,9,},
1376      ORD_SIDES, 0,
1377      {   36,  4, 15,  1, 174, 127,0xc0,0x00, 32,  2},
1378   },
1379   {
1380      "TEK1", "Tektronix 4170 - DSDD 48 tpi 5.25\"",
1381      0,   /* unique format */
1382      DEN_MFM_LO, 40,2,  8, 512, 1,
1383      {  0, 1,2,3,4,5,6,7,8,},
1384      {  1, 1,2,3,4,5,6,7,8,},
1385      ORD_CYLINDERS, 0,
1386      {   32,  4, 15,  0, 153,  63,0x80,0x00, 16,  1},
1387   },
1388   {
1389      "TEL2", "Teletek Systemaster - DSDD 48 tpi 5.25\"",
1390      0,   /* unique format */
1391      DEN_MFM_LO, 40,2, 18, 256, 1,
1392      {  0, 1,7,13,2,8,14,3,9,15,4,10,16,5,11,17,6,12,18,},
1393      {  1, 1,7,13,2,8,14,3,9,15,4,10,16,5,11,17,6,12,18,},
1394      ORD_CYLINDERS, 0,
1395      {   36,  4, 15,  1, 172, 127,0xc0,0x00, 32,  3},
1396   },
1397   {
1398      "TEL3", "Televideo 801, 806 - DSDD 48 tpi 5.25\"",
1399      0,   /* unique format */
1400      DEN_MFM_LO, 40,2, 18, 256, 6,
1401      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,},
1402      {  1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,},
1403      ORD_SIDES, 0,
1404      {   36,  4, 15,  0, 170,  63,0x80,0x00, 16,  4},
1405   },
1406   {
1407      "TEL4", "Televideo 1603 - DSDD 96 tpi 5.25\"",
1408      0,   /* unique format */
1409      DEN_MFM_LO, 80,2,  9, 512, 3,
1410      {  0, 1,2,3,4,5,6,7,8,9,},
1411      {  1, 1,2,3,4,5,6,7,8,9,},
1412      ORD_SIDES, 0,
1413      {   36,  4, 15,  0, 354, 127,0xc0,0x00, 32,  2},
1414   },
1415   {
1416      "TI1", "TI Professional, CP/M-86 - SSDD 48 tpi 5.25\"",
1417      0,   /* unique format */
1418      DEN_MFM_LO, 40,1,  8, 512, 1,
1419      {  0, 1,2,3,4,5,6,7,8,},
1420      {  0, },
1421      ORD_SIDES, 0,
1422      {   32,  3,  7,  0, 155,  63,0xc0,0x00, 16,  1},
1423   },
1424   {
1425      "TOS1", "Toshiba T100, T200 - DSDD 48 tpi 5.25\"",
1426      0,   /* unique format */
1427      DEN_MFM_LO, 40,2, 16, 256, 1,
1428      {  0, 1,5,9,13,2,6,10,14,3,7,11,15,4,8,12,16,},
1429      {  1, 1,5,9,13,2,6,10,14,3,7,11,15,4,8,12,16,},
1430      ORD_SIDES, 0,
1431      {   32,  3,  7,  0, 255,  63,0xc0,0x00, 16,  6},
1432   },
1433   {
1434      "TRS1", "TRS-80 Model 1, Omikron CP/M - SSSD 48 tpi 5.25\"",
1435      0,   /* unique format */
1436      DEN_FM_LO,  0,1, 18, 128, 1,
1437      {  0, 1,5,9,13,17,3,7,11,15,2,6,10,14,18,4,8,12,16,},
1438      {  0, },
1439      ORD_SIDES, 0,
1440      {   18,  3,  7,  0,  71,  63,0xc0,0x00, 16,  3},
1441   },
1442   {
1443      "TRS3", "TRS-80 Model 1, Color Power II - SSDD 48 tpi 5.25\"",
1444      0,   /* unique format */
1445      DEN_MFM_LO, 40,1, 18, 256, 5,
1446      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,},
1447      {  0, },
1448      ORD_SIDES, 0,
1449      {   36,  3,  7,  0, 170,  63,0xc0,0x00, 16,  2},
1450   },
1451   {
1452      "TRS7", "TRS-80, Holmes CP/M - DSDD 48 tpi 5.25\"",
1453      0,   /* unique format */
1454      DEN_MFM_LO, 40,2, 10, 512, 4,
1455      {  0, 0,1,2,3,4,5,6,7,8,9,},
1456      {  1, 10,11,12,13,14,15,16,17,18,19,},
1457      ORD_SIDES, 0,
1458      {   40,  4, 15,  1, 190,  63,0xf0,0x00, 16,  2},
1459   },
1460   {
1461      "TRS8", "TRS-80, MM CP/M - SSDD 48 tpi 5.25\"",
1462      0,   /* unique format */
1463      DEN_MFM_LO, 40,1, 10, 512, 1,
1464      {  0, 1,2,3,4,5,6,7,8,9,10,},
1465      {  0, },
1466      ORD_SIDES, 0,
1467      {   40,  4, 15,  1,  94, 127,0xc0,0x00, 32,  2},
1468   },
1469   {
1470      "TRS9", "TRS-80 Model 4, MT CP/M - SSDD 48 tpi 5.25\"",
1471      0,   /* unique format */
1472      DEN_MFM_LO, 40,1, 18, 256, 1,
1473      {  0, 1,3,5,7,9,11,13,15,17,2,4,6,8,10,12,14,16,18,},
1474      {  0, },
1475      ORD_SIDES, 0,
1476      {   36,  4, 15,  1,  84, 127,0xc0,0x00, 32,  2},
1477   },
1478   {
1479      "TRSA", "TRS-80 Model 4, MT CP/M - DSDD 48 tpi 5.25\"",
1480      0,   /* unique format */
1481      DEN_MFM_LO, 40,2, 18, 256, 1,
1482      {  0, 1,3,5,7,9,11,13,15,17,2,4,6,8,10,12,14,16,18,},
1483      {  1, 1,3,5,7,9,11,13,15,17,2,4,6,8,10,12,14,16,18,},
1484      ORD_SIDES, 0,
1485      {   36,  4, 15,  1, 174, 127,0xc0,0x00, 32,  2},
1486   },
1487   {
1488      "TRSB", "TRS-80 Model 4 - SSDD 48 tpi 5.25\"",
1489      0,   /* unique format */
1490      DEN_MFM_LO, 40,1,  8, 512, 4,
1491      {  0, 1,2,3,4,5,6,7,8,},
1492      {  0, },
1493      ORD_SIDES, 0,
1494      {   32,  3,  7,  0, 155,  63,0xc0,0x00, 16,  1},
1495   },
1496   {
1497      "TRSC", "TRS-80 Model 3, Hurricane CP/M - SSDD 48 tpi 5.25\"",
1498      "MOR1",   /* reused format */
1499   },
1500   {
1501      "VEC1", "Vector 4 - DSDD 96 tpi 5.25\"",
1502      0,   /* unique format */
1503      DEN_MFM_LO, 80,2,  9, 512, 2,
1504      {  240, 1,2,3,4,5,6,7,8,9,},
1505      {  242, 1,2,3,4,5,6,7,8,9,},
1506      ORD_EAGLE, 0,
1507      {   36,  4, 15,  0, 356, 127,0xc0,0x00, 32,  1},
1508   },
1509   {
1510      "VIS1", "Visual 1050 - SSDD 96 tpi 5.25\"",
1511      0,   /* unique format */
1512      DEN_MFM_LO, 80,1, 10, 512, 3,
1513      {  0, 1,2,3,4,5,6,7,8,9,10,},
1514      {  0, },
1515      ORD_SIDES, 0,
1516      {   40,  4, 15,  1, 194, 127,0xc0,0x00, 32,  2},
1517   },
1518   {
1519      "WAN1", "Wangwriter - DSDD 48 tpi 5.25\"",
1520      0,   /* unique format */
1521      DEN_MFM_LO, 40,2, 16, 256, 1,
1522      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
1523      {  1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
1524      ORD_SIDES, 0,
1525      {   32,  4, 15,  1, 155, 127,0xc0,0x00, 32,  2},
1526   },
1527   {
1528      "WAV1", "Wave Mate Bullet - SSDD 48 tpi 5.25\"",
1529      0,   /* unique format */
1530      DEN_MFM_LO, 40,1,  5,1024, 1,
1531      {  0, 1,2,3,4,5,},
1532      {  0, },
1533      ORD_SIDES, 0,
1534      {   40,  3,  7,  0, 189,  63,0xc0,0x00, 16,  2},
1535   },
1536   {
1537      "XER1", "Xerox (512 byte/sector) - DSDD 48 tpi 5.25\"",
1538      0,   /* unique format */
1539      DEN_MFM_LO, 40,2, 10, 512, 1,
1540      {  0, 1,2,3,4,5,6,7,8,9,10,},
1541      {  1, 1,2,3,4,5,6,7,8,9,10,},
1542      ORD_CYLINDERS, 0,
1543      {   40,  4, 15,  1, 170, 127,0xc0,0x00, 32,  2},
1544   },
1545   {
1546      "XER2", "Xerox 820 - SSSD 48 tpi 5.25\"",
1547      0,   /* unique format */
1548      DEN_FM_LO, 40,1, 18, 128, 1,
1549      {  0, 1,6,11,16,3,8,13,18,5,10,15,2,7,12,17,4,9,14,},
1550      {  0, },
1551      ORD_SIDES, 0,
1552      {   18,  3,  7,  0,  82,  31,0x80,0x00,  8,  3},
1553   },
1554   {
1555      "XER3", "Xerox 820 II - SSDD 48 tpi 5.25\"",
1556      0,   /* unique format */
1557      DEN_MFM_LO, 40,1, 17, 256, 3,
1558      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,},
1559      {  0, },
1560      ORD_SIDES, 0,
1561      {   34,  3,  7,  0, 156,  63,0xc0,0x00, 16,  3},
1562   },
1563   {
1564      "XER4", "Xerox 820-II and 16/8 (EM II) - DSDD 48 tpi 5.25\"",
1565      0,   /* unique format */
1566      DEN_MFM_LO, 40,2, 17, 256, 3,
1567      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,},
1568      {  1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,},
1569      ORD_EAGLE, "XER4",
1570      {   34,  4, 15,  1, 162,  63,0xc0,0x00, 16,  3},
1571   },
1572   {
1573      "XER7", "XEROX 16/8, EM-II (Standalone) - DSDD 48 tpi 5.25\"",
1574      0,   /* unique format */
1575      DEN_MFM_LO, 40,2,  9, 512, 2,
1576      {  240, 1,2,3,4,5,6,7,8,9,},
1577      {  242, 1,2,3,4,5,6,7,8,9,},
1578      ORD_CYLINDERS, 0,
1579      {   36,  4, 15,  1, 162,  63,0x80,0x00, 16,  2},
1580   },
1581   {
1582      "XOR1", "Xor 5 - DSDD 48 tpi 5.25\"",
1583      0,   /* unique format */
1584      DEN_MFM_LO, 40,2, 10, 512, 1,
1585      {  0, 1,6,2,7,3,8,4,9,5,10,},
1586      {  0, 1,6,2,7,3,8,4,9,5,10,},
1587      ORD_SIDES, 0,
1588      {   40,  4, 15,  1, 191, 127,0xc0,0x00, 32,  3},
1589   },
1590   {
1591      "XYZ1", "XYZ - DSDD 48 tpi 5.25\"",
1592      0,   /* unique format */
1593      DEN_MFM_LO, 40,2, 10, 512, 1,
1594      {  0, 1,5,9,3,7,2,6,10,4,8,},
1595      {  1, 11,15,19,13,17,12,16,20,14,18,},
1596      ORD_SIDES, 0,
1597      {   40,  4, 15,  1, 194, 127,0xc0,0x00, 32,  4},
1598   },
1599   {
1600      "ZEN1", "Zenith Z-37 Disk - SSSD 48 tpi 5.25\"",
1601      0,   /* unique format */
1602      DEN_FM_LO, 40,1, 10, 256, 3,
1603      {  0, 1,2,3,4,5,6,7,8,9,10,},
1604      {  0, },
1605      ORD_SIDES, 0,
1606      {   20,  3,  7,  0,  91,  63,0xc0,0x00, 16,  3},
1607   },
1608   {
1609      "ZEN2", "Zenith Z-37 Disk - DSDD 96 tpi 5.25\"",
1610      0,   /* unique format */
1611      DEN_MFM_LO, 80,2, 16, 256, 3,
1612      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
1613      {  1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
1614      ORD_SIDES, 0,
1615      {   32,  4, 15,  0, 315, 255,0xf0,0x00, 64,  2},
1616   },
1617   {
1618      "ZEN3", "Zenith Z89, Heath H89 - DSDD 48 tpi 5.25\"",
1619      0,   /* unique format */
1620      DEN_MFM_LO, 40,2, 16, 256, 3,
1621      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
1622      {  1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
1623      ORD_SIDES, 0,
1624      {   32,  4, 15,  0, 155, 255,0xf0,0x00, 64,  2},
1625   },
1626   {
1627      "ZEN4", "Zenith Z89, Heath H89 - DSDD 96 tpi 5.25\"",
1628      0,   /* unique format */
1629      DEN_MFM_LO, 80,2, 16, 256, 3,
1630      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
1631      {  1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
1632      ORD_SIDES, 0,
1633      {   32,  4, 15,  0, 315, 255,0xf0,0x00, 64,  2},
1634   },
1635   {
1636      "ZEN5", "Zenith Z90 - SSDD 48 tpi 5.25\"",
1637      0,   /* unique format */
1638      DEN_MFM_LO, 40,1, 16, 256, 3,
1639      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
1640      {  0, },
1641      ORD_SIDES, 0,
1642      {   32,  3,  7,  0, 151, 127,0xf0,0x00, 32,  2},
1643   },
1644   {
1645      "ZEN6", "Zenith Z90 - DSDD 48 tpi 5.25\"",
1646      0,   /* unique format */
1647      DEN_MFM_LO, 40,2, 16, 256, 3,
1648      {  0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
1649      {  1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,},
1650      ORD_SIDES, 0,
1651      {   32,  4, 15,  0, 155, 255,0xf0,0x00, 64,  2},
1652   },
1653   {
1654      "ZEN7", "Zenith Z-100 - SSDD 48 tpi 5.25\"",
1655      0,   /* unique format */
1656      DEN_MFM_LO, 40,1,  8, 512, 1,
1657      {  0, 1,2,3,4,5,6,7,8,},
1658      {  0, },
1659      ORD_SIDES, 0,
1660      {   32,  3,  7,  0, 151, 127,0xf0,0x00, 32,  2},
1661   },
1662   {
1663      "ZEN8", "Zenith Z-100 - DSDD 48 tpi 5.25\"",
1664      0,   /* unique format */
1665      DEN_MFM_LO, 40,2,  8, 512, 1,
1666      {  0, 1,2,3,4,5,6,7,8,},
1667      {  1, 1,2,3,4,5,6,7,8,},
1668      ORD_SIDES, 0,
1669      {   32,  4, 15,  1, 155, 255,0xf0,0x00, 64,  2},
1670   },
1671   {
1672      "ZOR1", "Zorba - DSDD 48 tpi 5.25\"",
1673      0,   /* unique format */
1674      DEN_MFM_LO, 40,2, 10, 512, 2,
1675      {  0, 1,2,3,4,5,6,7,8,9,10,},
1676      {  0, 11,12,13,14,15,16,17,18,19,20,},
1677      ORD_SIDES, 0,
1678      {   40,  4, 15,  1, 194,  63,0x80,0x00, 16,  2},
1679   },
1680   {
1681      "ZOR2", "Zorba - DSDD 96 tpi 5.25\"",
1682      0,   /* unique format */
1683      DEN_MFM_LO, 80,2, 10, 512, 2,
1684      {  0, 1,2,3,4,5,6,7,8,9,10,},
1685      {  0, 11,12,13,14,15,16,17,18,19,20,},
1686      ORD_SIDES, 0,
1687      {   40,  5, 31,  3, 194, 127,0x80,0x00, 32,  2},
1688   },
1689   {
1690      0,   /* end of list */
1691   }
1692};
src/mess/machine/kaypro.c
r4509r4510
1/******************************************************************************
2 *
3 *   kaypro.c
4 *
5 *   Machine interface for Kaypro 2x
6 *
7 *   Juergen Buchmueller, July 1998
8 *   Benjamin C. W. Sittler, July 1998 (new keyboard table)
9 *
10 ******************************************************************************/
11
12#include "driver.h"
13#include "includes/kaypro.h"
14
15#include "cpu/z80/z80.h"
16#include "machine/wd17xx.h"
17#include "machine/cpm_bios.h"
18
19
20static const char *const disk_ids[4] = {"KAY2","KAY2","KAY2","KAY2"};
21
22static UINT8 keyrows[10] = { 0,0,0,0,0,0,0,0,0,0 };
23static const char keyboard[8][10][8] = {
24   { /* normal */
25      { 27,'1','2','3','4','5','6','7'},
26      {'8','9','0','-','=','`',  8,  9},
27      {'q','w','e','r','t','y','u','i'},
28      {'o','p','[',']', 13,127,  0,  0},
29      {'a','s','d','f','g','h','j','k'},
30      {'l',';', 39, 92,  0,'z','x','c'},
31      {'v','b','n','m',',','.','/',  0},
32      { 10,' ','-',',', 13,'.','0','1'},
33      {'2','3','4','5','6','7','8','9'},
34      { 11, 13,  8, 12,  0,  0,  0,  0},
35   },
36   { /* Shift */
37      { 27,'!','@','#','$','%','^','&'},
38      {'*','(',')','_','+','~',  8,  9},
39      {'Q','W','E','R','T','Y','U','I'},
40      {'O','P','{','}', 13,127,  0,  0},
41      {'A','S','D','F','G','H','J','K'},
42      {'L',':','"','|',  0,'Z','X','C'},
43      {'V','B','N','M','<','>','?',  0},
44      { 10,' ','-',',', 13,'.','0','1'},
45      {'2','3','4','5','6','7','8','9'},
46      { 11, 13,  8, 12,  0,  0,  0,  0},
47   },
48   { /* Control */
49      { 27,'1','2','3','4','5','6','7'},
50      {'8','9','0','-','=','`',  8,  9},
51      { 17, 23,  5, 18, 20, 25, 21,  9},
52      { 15, 16, 27, 29, 13,127,  0,  0},
53      {  1, 19,  4,  6,  7,  8, 10, 11},
54      { 12,';', 39, 28,  0, 26, 24,  3},
55      { 22,  2, 14, 13,',','.','/',  0},
56      { 10,' ','-',',', 13,'.','0','1'},
57      {'2','3','4','5','6','7','8','9'},
58      { 11, 13,  8, 12,  0,  0,  0,  0},
59   },
60   { /* Shift+Control */
61      { 27,'!',  0,'#','$','%', 30,'&'},
62      {'*','(',')', 31,'+','~',  8,  9},
63      { 17, 23,  5, 18, 20, 25, 21,  9},
64      { 15, 16, 27, 29, 13,127,  0,  0},
65      {  1, 19,  4,  6,  7,  8, 10, 11},
66      { 12,':','"', 28,  0, 26, 24,  3},
67      { 22,  2, 14, 13,',','.','/',  0},
68      { 10,' ','-',',', 13,'.','0','1'},
69      {'2','3','4','5','6','7','8','9'},
70      { 11, 13,  8, 12,  0,  0,  0,  0},
71   },
72   { /* CapsLock */
73      { 27,'1','2','3','4','5','6','7'},
74      {'8','9','0','-','=','`',  8,  9},
75      {'Q','W','E','R','T','Y','U','I'},
76      {'O','P','[',']', 13,127,  0,  0},
77      {'A','S','D','F','G','H','J','K'},
78      {'L',';', 39, 92,  0,'Z','X','C'},
79      {'V','B','N','M',',','.','/',  0},
80      { 10,' ','-',',', 13,'.','0','1'},
81      {'2','3','4','5','6','7','8','9'},
82      { 11, 13,  8, 12,  0,  0,  0,  0},
83   },
84   { /* Shift+CapsLock */
85      { 27,'!','@','#','$','%','^','&'},
86      {'*','(',')','_','+','~',  8,  9},
87      {'Q','W','E','R','T','Y','U','I'},
88      {'O','P','{','}', 13,127,  0,  0},
89      {'A','S','D','F','G','H','J','K'},
90      {'L',':','"','|',  0,'Z','X','C'},
91      {'V','B','N','M','<','>','?',  0},
92      { 10,' ','-',',', 13,'.','0','1'},
93      {'2','3','4','5','6','7','8','9'},
94      { 11, 13,  8, 12,  0,  0,  0,  0},
95   },
96   { /* Control+CapsLock */
97      { 27,'1','2','3','4','5','6','7'},
98      {'8','9','0','-','=','`',  8,  9},
99      { 17, 23,  5, 18, 20, 25, 21,  9},
100      { 15, 16, 27, 29, 13,127,  0,  0},
101      {  1, 19,  4,  6,  7,  8, 10, 11},
102      { 12,';', 39, 28,  0, 26, 24,  3},
103      { 22,  2, 14, 13,',','.','/',  0},
104      { 10,' ','-',',', 13,'.','0','1'},
105      {'2','3','4','5','6','7','8','9'},
106      { 11, 13,  8, 12,  0,  0,  0,  0},
107   },
108   { /* Shift+Control+CapsLock */
109      { 27,'!',  0,'#','$','%', 30,'&'},
110      {'*','(',')', 31,'+','~',  8,  9},
111      { 17, 23,  5, 18, 20, 25, 21,  9},
112      { 15, 16, 27, 29, 13,127,  0,  0},
113      {  1, 19,  4,  6,  7,  8, 10, 11},
114      { 12,':','"', 28,  0, 26, 24,  3},
115      { 22,  2, 14, 13,',','.','/',  0},
116      { 10,' ','-',',', 13,'.','0','1'},
117      {'2','3','4','5','6','7','8','9'},
118      { 11, 13,  8, 12,  0,  0,  0,  0},
119   },
120};
121
122DRIVER_INIT( kaypro )
123{
124   UINT8 * gfx = memory_region(machine, "gfx1");
125   int i;
126
127   /* copy font, but add underline in last line */
128   for( i = 0; i < 0x1000; i++ )
129      gfx[0x1000 + i] = ((i % KAYPRO_FONT_H) == (KAYPRO_FONT_H - 1)) ?
130         gfx[i] ^ 0xff : gfx[i];
131
132   /* copy font inverted */
133   for( i = 0; i < 0x2000; i++ )
134      gfx[0x2000 + i] = gfx[i] ^ 0xff;
135
136   cpm_init(machine, 4, disk_ids);
137}
138
139MACHINE_RESET( kaypro )
140{
141   /* disable CapsLock LED initially */
142   set_led_status(1, 1);
143   set_led_status(1, 0);
144}
145
146/******************************************************
147 * vertical blank interrupt
148 * used to scan keyboard; newly pressed keys
149 * are stuffed into a keyboard buffer;
150 * also drives keyboard LEDs and
151 * and handles autorepeating keys
152 ******************************************************/
153INTERRUPT_GEN( kaypro_interrupt )
154{
155   const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
156   int mod, row, col, chg, new;
157   static int lastrow = 0, mask = 0x00, key = 0x00, repeat = 0, repeater = 0;
158
159   if( repeat )
160   {
161      if( !--repeat )
162         repeater = 4;
163   }
164   else
165   if( repeater )
166   {
167      repeat = repeater;
168   }
169
170   row = 9;
171   new = input_port_read(device->machine, "ROW9");
172   chg = keyrows[row] ^ new;
173
174   if (!chg) { new = input_port_read(device->machine, "ROW8"); chg = keyrows[--row] ^ new; }
175   if (!chg) { new = input_port_read(device->machine, "ROW7"); chg = keyrows[--row] ^ new; }
176   if (!chg) { new = input_port_read(device->machine, "ROW6"); chg = keyrows[--row] ^ new; }
177   if (!chg) { new = input_port_read(device->machine, "ROW5"); chg = keyrows[--row] ^ new; }
178   if (!chg) { new = input_port_read(device->machine, "ROW4"); chg = keyrows[--row] ^ new; }
179   if (!chg) { new = input_port_read(device->machine, "ROW3"); chg = keyrows[--row] ^ new; }
180   if (!chg) { new = input_port_read(device->machine, "ROW2"); chg = keyrows[--row] ^ new; }
181   if (!chg) { new = input_port_read(device->machine, "ROW1"); chg = keyrows[--row] ^ new; }
182   if (!chg) { new = input_port_read(device->machine, "ROW0"); chg = keyrows[--row] ^ new; }
183   if (!chg) --row;
184
185   if (row >= 0)
186   {
187      repeater = 0x00;
188      mask = 0x00;
189      key = 0x00;
190      lastrow = row;
191      /* CapsLock LED */
192      if( row == 3 && chg == 0x80 )
193         set_led_status(1, (keyrows[3] & 0x80) ? 0 : 1);
194
195      if (new & chg)   /* key(s) pressed ? */
196      {
197         mod = 0;
198
199         /* Shift modifier */
200         if ( (keyrows[5] & 0x10) || (keyrows[6] & 0x80) )
201            mod |= 1;
202
203         /* Control modifier */
204         if (keyrows[3] & 0x40)
205            mod |= 2;
206
207         /* CapsLock modifier */
208         if (keyrows[3] & 0x80)
209            mod |= 4;
210
211         /* find new key */
212         mask = 0x01;
213         for (col = 0; col < 8; col ++)
214         {
215            if (chg & mask)
216            {
217               new &= mask;
218               key = keyboard[mod][row][col];
219               break;
220            }
221            mask <<= 1;
222         }
223         if( key )   /* normal key */
224         {
225            repeater = 30;
226            kaypro_conin_w(space, 0, key);
227         }
228         else
229         if( (row == 0) && (chg == 0x04) ) /* Ctrl-@ (NUL) */
230            kaypro_conin_w(space, 0, 0);
231         keyrows[row] |= new;
232      }
233      else
234      {
235         keyrows[row] = new;
236      }
237      repeat = repeater;
238   }
239   else if ( key && (keyrows[lastrow] & mask) && repeat == 0 )
240   {
241      kaypro_conin_w(space, 0, key);
242   }
243}
244
src/mess/machine/cpm_bios.c
r4509r4510
1/******************************************************************************
2 *
3 *   cpm_bios.c
4 *
5 *   CP/M bios emulation (used for Kaypro 2x)
6 *
7 *   Juergen Buchmueller, July 1998
8 *   Benjamin C. W. Sittler, July 1998 (minor modifications)
9 *
10 ******************************************************************************/
11
12#include "driver.h"
13#include "memory.h"
14#include "cpu/z80/z80.h"
15#include "machine/wd17xx.h"
16#include "cpm_bios.h"
17#include "image.h"
18
19#define VERBOSE       1
20#define VERBOSE_FDD    1
21#define VERBOSE_BIOS   1
22#define VERBOSE_CONIO   0
23
24/* buffer for one physical sector */
25typedef struct {
26   UINT8    unit;         /* unit number to use for this drive */
27   UINT8    cyl;         /* physical cylinder */
28   UINT8    side;         /* physical side */
29   UINT8    head;         /* logical head number */
30   UINT8    sec;         /* physical sector number */
31   UINT8    dirty;       /* non zero if the sector buffer is dirty */
32   UINT8    buffer[4096];   /* buffer to hold one physical sector */
33}   SECBUF;
34
35static int curdisk = 0;          /* currently selected disk */
36static int num_disks = 0;         /* number of supported disks */
37static int fmt[NDSK] = {0,};      /* index of disk formats */
38static int mode[NDSK] = {0,};      /* 0 read only, !0 read/write */
39static int bdos_trk[NDSK] = {0,};   /* BDOS track number */
40static int bdos_sec[NDSK] = {0,};   /* BDOS sector number */
41static const device_config *fp[NDSK] = {NULL, };   /* image file pointer */
42static int ff[NDSK] = {0, };            /* image filenames specified flags */
43static mame_file *lp = NULL;          /* list file handle (ie. PIP LST:=X:FILE.EXT) */
44//static const device_config *pp = NULL;         /* punch file handle (ie. PIP PUN:=X:FILE.EXT) */
45//static const device_config *rp = NULL;         /* reader file handle (ie. PIP X:FILE.EXE=RDR:) */
46static int dma = 0;             /* DMA transfer address */
47
48static UINT8 zeropage0[8] =
49{
50   0xc3,                     /* JP  BIOS+3 */
51   BIOS & 0xff,
52   BIOS >> 8,
53   0x80,                     /* io byte */
54   0x00,                     /* usr drive */
55   0xc3,                     /* JP  BDOS */
56   BDOS & 0xff,
57   BDOS >> 8
58};
59
60static cpm_dph dph[NDSK] = {
61   { 0, 0, 0, 0, DIRBUF, DPB0, 0, 0 },
62   { 0, 0, 0, 0, DIRBUF, DPB1, 0, 0 },
63   { 0, 0, 0, 0, DIRBUF, DPB2, 0, 0 },
64   { 0, 0, 0, 0, DIRBUF, DPB3, 0, 0 }
65};
66
67static void cpm_exit(running_machine *machine);
68
69#include "cpm_disk.c"
70
71#define CP(n) ((n)<32?'.':(n))
72
73
74/*****************************************************************************
75 *   cpm_jumptable
76 *   initialize a jump table with 18 entries for bios functions
77 *   initialize bios functions at addresses BIOS_00 .. BIOS_11
78 *   and the central bios execute function at BIOS_EXEC
79 *****************************************************************************/
80static void cpm_jumptable(running_machine *machine)
81{
82   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
83   UINT8 * RAM = memory_get_write_ptr(space, 0x0000);
84   int i;
85   int jmp_addr, fun_addr;
86
87   /* reset RST7 vector (RET) */
88   RAM[0x0038] = 0xc9;
89
90   /* reset NMI vector (RETI) */
91   RAM[0x0066] = 0xed;
92   RAM[0x0067] = 0x5d;
93
94   for (i = 0; i < NFUN; i++)
95   {
96      jmp_addr = BIOS + 3 * i;
97      fun_addr = BIOS_00 + 4 * i;
98
99      RAM[jmp_addr + 0] = 0xc3;
100      RAM[jmp_addr + 1] = fun_addr & 0xff;
101      RAM[jmp_addr + 2] = fun_addr >> 8;
102
103      RAM[fun_addr + 0] = 0x3e;      /* LD   A,i */
104      RAM[fun_addr + 1] = i;
105      RAM[fun_addr + 2] = 0x18;      /* JR   BIOS_EXEC */
106      RAM[fun_addr + 3] = BIOS_EXEC - fun_addr - 4;
107   }
108
109   /* initialize bios execute */
110   RAM[BIOS_EXEC + 0] = 0xd3;         /* OUT (BIOS_CMD),A */
111   RAM[BIOS_EXEC + 1] = BIOS_CMD;
112   RAM[BIOS_EXEC + 2] = 0xc9;         /* RET */
113}
114
115DEVICE_IMAGE_LOAD( cpm_floppy )
116{
117   int id = image_index_in_device(image);
118
119   ff[id] = TRUE;
120
121   /* now try to open the image if a filename is given */
122   fp[id] = image;
123   mode[id] = image_is_writable(image);
124
125   return INIT_PASS;
126}
127
128/*TODO: implement DEVICE_IMAGE_UNLOAD that clears ff[id]*/
129
130/*****************************************************************************
131 *   cpm_init
132 *   Initialize the BIOS simulation for 'n' drives of types stored in 'ids'
133 *****************************************************************************/
134int cpm_init( running_machine *machine, int n, const char *const ids[])
135{
136   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
137   UINT8 * RAM = memory_get_write_ptr(space, 0x0000);
138   const dsk_fmt *f;
139   int i, d;
140
141
142   /* fill memory with HALT insn */
143   memset(RAM + 0x100, 0x76, 0xff00);
144
145   /* Reset jump */
146   zeropage0[0] = 0xc3;
147   zeropage0[1] = BIOS & 0xff;
148   zeropage0[2] = BIOS >> 8;
149
150   /* Copy substantial zero page data */
151   for (i = 0; i < 8; i++)
152      RAM[i] = zeropage0[i];
153
154   if (VERBOSE)
155   {
156      logerror("CPM CCP     %04X\n", CCP);
157      logerror("CPM BDOS    %04X\n", BDOS);
158      logerror("CPM BIOS    %04X\n", BIOS);
159   }
160
161   /* Start allocating CSV & ALV */
162   i = DATA_START;
163
164   num_disks = n;
165
166   for (d = 0; d < num_disks; d++)
167   {
168      if (ids[d])
169      {
170         /* select a format by name */
171         if( cpm_disk_select_format(d, ids[d]) )
172         {
173            if (VERBOSE)
174               logerror("Error drive #%d id '%s' is unknown\n", d, ids[d]);
175            return 1;
176         }
177
178         f = &formats[fmt[d]];
179
180         /* transfer DPB to memory */
181         RAM[DPB0 + d * DPBL +  0] = f->dpb.spt & 0xff;
182         RAM[DPB0 + d * DPBL +  1] = f->dpb.spt >> 8;
183         RAM[DPB0 + d * DPBL +  2] = f->dpb.bsh;
184         RAM[DPB0 + d * DPBL +  3] = f->dpb.blm;
185         RAM[DPB0 + d * DPBL +  4] = f->dpb.exm;
186         RAM[DPB0 + d * DPBL +  5] = f->dpb.dsm & 0xff;
187         RAM[DPB0 + d * DPBL +  6] = f->dpb.dsm >> 8;
188         RAM[DPB0 + d * DPBL +  7] = f->dpb.drm & 0xff;
189         RAM[DPB0 + d * DPBL +  8] = f->dpb.drm >> 8;
190         RAM[DPB0 + d * DPBL +  9] = f->dpb.al0;
191         RAM[DPB0 + d * DPBL + 10] = f->dpb.al1;
192         RAM[DPB0 + d * DPBL + 11] = f->dpb.cks & 0xff;
193         RAM[DPB0 + d * DPBL + 12] = f->dpb.cks >> 8;
194         RAM[DPB0 + d * DPBL + 13] = f->dpb.off & 0xff;
195         RAM[DPB0 + d * DPBL + 14] = f->dpb.off >> 8;
196
197         if (VERBOSE)
198            logerror("CPM DPB%d    %04X\n", d, DPB0 + d * DPBL);
199
200         /* TODO: generate sector translation table and
201            allocate space for it; for now it is always 0 */
202         dph[d].xlat = 0;
203         if (VERBOSE)
204            logerror("CPM XLAT%d   %04X\n", d, dph[d].xlat);
205
206         /* memory address for dirbuf */
207         dph[d].dirbuf = DIRBUF + d * RECL;
208         if (VERBOSE)
209            logerror("CPM DIRBUF%d %04X\n", d, dph[d].dirbuf);
210
211         /* memory address for CSV */
212         dph[d].csv = i;
213         if (VERBOSE)
214            logerror("CPM CSV%d    %04X\n", d, dph[d].csv);
215
216         /* length is CKS bytes */
217         i += f->dpb.cks;
218
219         /* memory address for ALV */
220         dph[d].alv = i;
221         if (VERBOSE)
222            logerror("CPM ALV%d    %04X\n", d, dph[d].alv);
223
224         /* length is DSM+1 bits */
225         i += (f->dpb.dsm + 1 + 7) >> 3;
226
227         if (i >= BIOS_00)
228         {
229            if (VERBOSE)
230               logerror("Error configuring BIOS tables: out of memory!\n");
231            return 1;
232         }
233      }
234      else
235      {
236         memset(&dph[d], 0, DPHL);
237      }
238
239      logerror("CPM DPH%d    %04X\n", d, DPH0 + d * DPHL);
240
241      /* transfer DPH to memory */
242      RAM[DPH0 + d * DPHL +  0] = dph[d].xlat & 0xff;
243      RAM[DPH0 + d * DPHL +  1] = dph[d].xlat >> 8;
244      RAM[DPH0 + d * DPHL +  2] = dph[d].scr1 & 0xff;
245      RAM[DPH0 + d * DPHL +  3] = dph[d].scr1 >> 8;
246      RAM[DPH0 + d * DPHL +  4] = dph[d].scr2 & 0xff;
247      RAM[DPH0 + d * DPHL +  5] = dph[d].scr2 >> 8;
248      RAM[DPH0 + d * DPHL +  6] = dph[d].scr3 & 0xff;
249      RAM[DPH0 + d * DPHL +  7] = dph[d].scr3 >> 8;
250      RAM[DPH0 + d * DPHL +  8] = dph[d].dirbuf & 0xff;
251      RAM[DPH0 + d * DPHL +  9] = dph[d].dirbuf >> 8;
252      RAM[DPH0 + d * DPHL + 10] = dph[d].dpb & 0xff;
253      RAM[DPH0 + d * DPHL + 11] = dph[d].dpb >> 8;
254      RAM[DPH0 + d * DPHL + 12] = dph[d].csv & 0xff;
255      RAM[DPH0 + d * DPHL + 13] = dph[d].csv >> 8;
256      RAM[DPH0 + d * DPHL + 14] = dph[d].alv & 0xff;
257      RAM[DPH0 + d * DPHL + 15] = dph[d].alv >> 8;
258   }
259
260   /* create a file to receive list output (ie. PIP LST:=FILE.EXT) */
261   mame_fopen(SEARCHPATH_IMAGE, "cpm.lst", OPEN_FLAG_WRITE, &lp);
262
263   cpm_jumptable(machine);
264
265   add_exit_callback(machine, cpm_exit);
266   return 0;
267}
268
269/*****************************************************************************
270 *   cpm_exit
271 *   Shut down the BIOS simulation; close image files; exit osd_fdc
272 *****************************************************************************/
273static void cpm_exit(running_machine *machine)
274{
275   int d;
276
277   /* if a list file is still open close it now */
278   if (lp)
279   {
280      mame_fclose(lp);
281      lp = NULL;
282   }
283
284   /* close all opened disk images */
285   for (d = 0; d < NDSK; d++)
286   {
287      if (fp[d])
288      {
289         fp[d] = NULL;
290      }
291   }
292}
293
294/*****************************************************************************
295 * cpm_conout_chr
296 * send a character to the console
297 *****************************************************************************/
298static void cpm_conout_chr(running_machine *machine, int data)
299{
300   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO);
301   memory_write_byte(space, BIOS_CONOUT, data);
302}
303
304/*****************************************************************************
305 * cpm_conout_str
306 * send a zero terminated string to the console
307 *****************************************************************************/
308static void cpm_conout_str(running_machine *machine, const char *src)
309{
310   while (*src)
311      cpm_conout_chr(machine, *src++);
312}
313
314/*****************************************************************************
315 * cpm_conout_str
316 * select a disk format for drive 'd' by searching formats for 'id'
317 *****************************************************************************/
318int cpm_disk_select_format(int d, const char *id)
319{
320   int i, j;
321
322   if (!id)
323      return 1;
324
325   if (VERBOSE)
326      logerror("CPM search format '%s'\n", id);
327
328   for (i = 0; formats[i].id && mame_stricmp(formats[i].id, id); i++)
329      ;
330
331   if (!formats[i].id)
332   {
333      if (VERBOSE)
334         logerror("CPM format '%s' not supported\n", id);
335      return 1;
336   }
337
338   /* references another type id? */
339   if (formats[i].ref)
340   {
341      if (VERBOSE)
342         logerror("CPM search format '%s' for '%s'\n", formats[i].ref, id);
343
344      /* search for the referred id */
345      for (j = 0; formats[j].id && mame_stricmp(formats[j].id, formats[i].ref); j++)
346         ;
347      if (!formats[j].id)
348      {
349         if (VERBOSE)
350            logerror("CPM format '%s' not supported\n", formats[i].ref);
351         return 1;
352      }
353      /* set current format */
354      fmt[d] = j;
355   }
356   else
357   {
358      /* set current format */
359      fmt[d] = i;
360   }
361
362   if (VERBOSE)
363   {
364      const dsk_fmt *f = &formats[fmt[d]];
365
366      logerror("CPM '%s' is '%s'\n", id, f->name);
367      logerror("CPM #%d %dK (%d cylinders, %d sides, %d %d bytes sectors/track)\n",
368         d,
369         f->cylinders * f->sides * f->spt * f->seclen / 1024,
370         f->cylinders, f->sides, f->spt, f->seclen);
371   }
372
373   return 0;
374}
375
376
377/*****************************************************************************
378 * cpm_disk_image_seek
379 * seek to an image offset for the currently selected disk 'curdisk'
380 * the track 'bdos_trk[curdisk]' and sector 'bdos_sec[curdisk]' are used
381 * to calculate the offset.
382 *****************************************************************************/
383static void cpm_disk_image_seek(void)
384{
385   const dsk_fmt *f = &formats[fmt[curdisk]];
386   int offs, o, r, s, h;
387
388   switch (f->order)
389   {
390   /* TRACK  0   1   2       n/2-1      n/2      n/2+1    n/2+2     n-1 */
391   /* F/B    f0, f1, f2 ... f(n/2)-1, b(n/2)-1, b(n/2)-2, b(n/2)-3 ... b0 */
392   case ORD_CYLINDERS:
393      offs = (bdos_trk[curdisk] % f->cylinders) * 2;
394      offs *= f->dpb.spt * RECL;
395      o = bdos_sec[curdisk] * RECL;
396      r = (o % f->seclen) / RECL;
397      s = o / f->seclen;
398      h = (s >= f->spt) ? f->side2[0] : f->side1[0];
399      s = (s >= f->spt) ? f->side2[s+1] : f->side1[s+1];
400      s -= f->side1[1];      /* subtract first sector number */
401      offs += (h * f->spt + s) * f->seclen + r * RECL;
402      if (bdos_trk[curdisk] >= f->cylinders)
403         offs += (int)f->cylinders * f->sides * f->spt * f->seclen / 2;
404
405      if (VERBOSE_FDD)
406         logerror("CPM image #%d ord_cylinders C:%2d H:%d S:%2d REC:%d -> 0x%08X\n", curdisk, bdos_trk[curdisk], h, s, r, offs * RECL);
407      break;
408
409   /* TRACK  0   1   2       n/2-1 n/2  n/2+1  n/2+3      n-1      */
410   /* F/B    f0, f1, f2 ... f(n/2)-1, b0,    b1,   b2 ... b(n/2)-1 */
411   case ORD_EAGLE:
412      offs = (bdos_trk[curdisk] % f->cylinders) * 2;
413      if (bdos_trk[curdisk] >= f->cylinders)
414         offs = f->cylinders * 2 - 1 - offs;
415      offs *= f->dpb.spt * RECL;
416      o = bdos_sec[curdisk] * RECL;
417      r = (o % f->seclen) / RECL;
418      s = o / f->seclen;
419      h = (s >= f->spt) ? f->side2[0] : f->side1[0];
420      s = (s >= f->spt) ? f->side2[s+1] : f->side1[s+1];
421      s -= f->side1[1];      /* subtract first sector number */
422      offs += (h * f->spt + s) * f->seclen + r * RECL;
423
424      if (VERBOSE_FDD)
425         logerror("CPM image #%d ord_eagle     C:%2d H:%d S:%2d REC:%d -> 0x%08X\n", curdisk, bdos_trk[curdisk], h, s, r, offs);
426      break;
427
428   /* TRACK    0      1     2         n-1 */
429   /* F/B    f0/b0, f1/b1 f2/b2 ... fn-1/bn-1 */
430   case ORD_SIDES:
431   default:
432      offs = bdos_trk[curdisk];
433      offs *= f->dpb.spt * RECL;
434      o = bdos_sec[curdisk] * RECL;
435      r = (o % f->seclen) / RECL;
436      s = o / f->seclen;
437      h = (s >= f->spt) ? f->side2[0] : f->side1[0];
438      s = (s >= f->spt) ? f->side2[s+1] : f->side1[s+1];
439      s -= f->side1[1];      /* subtract first sector number */
440      offs += (h * f->spt + s) * f->seclen + r * RECL;
441
442      if (VERBOSE_FDD)
443         logerror("CPM image #%d ord_sides     C:%2d H:%d S:%2d REC:%d -> 0x%08X\n", curdisk, bdos_trk[curdisk], h, s, r, offs);
444      break;
445
446   }
447   image_fseek(fp[curdisk], offs, SEEK_SET);
448}
449
450
451/*****************************************************************************
452 * cpm_disk_select
453 * select a disk drive and return it's DPH (disk parameter header)
454 * offset in Z80s memory range.
455 *****************************************************************************/
456static int cpm_disk_select(int d)
457{
458   int return_dph = 0;
459
460   curdisk = d;
461   switch (curdisk)
462   {
463      case 0:
464         if (num_disks > 0)
465            return_dph = DPH0;
466         break;
467      case 1:
468         if (num_disks > 1)
469            return_dph   = DPH1;
470         break;
471      case 2:
472         if (num_disks > 2)
473            return_dph   = DPH2;
474         break;
475      case 3:
476         if (num_disks > 3)
477            return_dph   = DPH3;
478         break;
479   }
480   return return_dph;
481
482}
483
484void cpm_disk_set_track(int t)
485{
486   if (curdisk >= 0 && curdisk < num_disks)
487      bdos_trk[curdisk] = t;
488}
489
490void cpm_disk_set_sector(int s)
491{
492   if (curdisk >= 0 && curdisk < num_disks)
493      bdos_sec[curdisk] = s;
494}
495
496void cpm_disk_home(void)
497{
498   cpm_disk_set_track(0);
499}
500
501void cpm_disk_set_dma(int d)
502{
503   dma = d;
504}
505
506static void dump_sector(running_machine *machine)
507{
508   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
509   UINT8 *DMA = ((UINT8 *) memory_get_write_ptr(space, 0x0000)) + dma;
510
511   {
512      int i;
513      for (i = 0x00; i < 0x80; i += 0x10)
514      {
515         logerror("%02X: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n",
516            i,
517            DMA[i+0x00],DMA[i+0x01],DMA[i+0x02],DMA[i+0x03],
518            DMA[i+0x04],DMA[i+0x05],DMA[i+0x06],DMA[i+0x07],
519            DMA[i+0x08],DMA[i+0x09],DMA[i+0x0a],DMA[i+0x0b],
520            DMA[i+0x0c],DMA[i+0x0d],DMA[i+0x0e],DMA[i+0x0f],
521            CP(DMA[i+0x00]),CP(DMA[i+0x01]),CP(DMA[i+0x02]),CP(DMA[i+0x03]),
522            CP(DMA[i+0x04]),CP(DMA[i+0x05]),CP(DMA[i+0x06]),CP(DMA[i+0x07]),
523            CP(DMA[i+0x08]),CP(DMA[i+0x09]),CP(DMA[i+0x0a]),CP(DMA[i+0x0b]),
524            CP(DMA[i+0x0c]),CP(DMA[i+0x0d]),CP(DMA[i+0x0e]),CP(DMA[i+0x0f]));
525      }
526   }
527}
528
529int cpm_disk_read_sector(running_machine *machine)
530{
531   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
532   int result = -1;
533
534   /* TODO: remove this */
535   unsigned char *RAM = memory_get_write_ptr(space, 0x0000);
536
537   if (curdisk >= 0 &&
538      curdisk < num_disks &&
539      fmt[curdisk] != -1 &&
540      bdos_trk[curdisk] >= 0 &&
541      bdos_trk[curdisk] < formats[fmt[curdisk]].sides * formats[fmt[curdisk]].cylinders)
542   {
543      {
544         if (fp[curdisk])
545         {
546            cpm_disk_image_seek();
547            if (image_fread(fp[curdisk], &RAM[dma], RECL) == RECL)
548               result = 0;
549         }
550      }
551   }
552   if (result)
553   {
554      logerror("BDOS Err on %c: Select\n", curdisk + 'A');
555   }
556   dump_sector(machine);
557   return result;
558}
559
560int cpm_disk_write_sector(running_machine *machine)
561{
562   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
563   int result = -1;
564
565   /* TODO: remove this */
566   unsigned char *RAM = memory_get_write_ptr(space, 0x0000);
567
568   if (curdisk >= 0 &&
569      curdisk < num_disks &&
570      fmt[curdisk] != -1 &&
571      bdos_trk[curdisk] >= 0 &&
572      bdos_trk[curdisk] < formats[fmt[curdisk]].sides * formats[fmt[curdisk]].cylinders)
573   {
574      {
575         if (fp[curdisk])
576         {
577            cpm_disk_image_seek();
578            if (image_fwrite(fp[curdisk], &RAM[dma], RECL) == RECL)
579               result = 0;
580         }
581      }
582   }
583   if (result)
584      logerror("BDOS Err on %c: Select\n", curdisk + 'A');
585   return result;
586}
587
588 READ8_HANDLER (   cpm_bios_command_r )
589{
590   return 0xff;
591}
592
593WRITE8_HANDLER ( cpm_bios_command_w )
594{
595   const dsk_fmt *f;
596   char buff[256];
597   const address_space *program_space = cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
598   UINT8 * RAM = memory_get_write_ptr(program_space, 0x0000);
599   UINT16 tmp, af, bc, de, hl;
600   int i;
601
602   /* Get the values of the basic Z80 registers */
603   af = cpu_get_reg( space->machine->cpu[0], Z80_AF );
604   bc = cpu_get_reg( space->machine->cpu[0], Z80_BC );
605   de = cpu_get_reg( space->machine->cpu[0], Z80_DE );
606   hl = cpu_get_reg( space->machine->cpu[0], Z80_HL );
607
608   switch( data )
609   {
610   case 0x00: /* CBOOT */
611      if (VERBOSE)
612         logerror("BIOS 00 cold boot\n");
613
614      cpm_conout_str(space->machine, "MESS CP/M 2.2 Emulator\r\n\n");
615      for (i = 0; i < NDSK; i++)
616      {
617         if (fmt[i] != -1)
618         {
619            f = &formats[fmt[i]];
620            sprintf(buff, "Drive %c: '%s' %5dK (%d %s%s %2d,%4d) %d %dK blocks\r\n",
621               'A'+i,
622               f->id,
623               f->cylinders * f->sides * f->spt * f->seclen / 1024,
624               f->cylinders,
625               (f->sides == 2) ? "DS" : "SS",
626               (f->density == DEN_FM_LO || f->density == DEN_FM_HI) ? "SD" : "DD",
627               f->spt, f->seclen,
628               f->dpb.dsm + 1, (RECL << f->dpb.bsh) / 1024);
629            cpm_conout_str(space->machine, buff);
630         }
631      }
632      /* change vector at 0000 to warm start */
633      zeropage0[0] = 0xc3;
634      zeropage0[1] = (BIOS + 3) & 0xff;
635      zeropage0[2] = (BIOS + 3) >> 8;
636      /* fall through */
637
638   case 0x01: /* WBOOT */
639      if (VERBOSE)
640         logerror("BIOS 01 warm boot\n");
641
642      zeropage0[4] = curdisk;
643      /* copy substantial zero page data */
644      for (i = 0; i < 8; i++)
645         RAM[0x0000 + i] = zeropage0[i];
646
647      /* copy the CP/M 2.2 image to Z80 memory space */
648      for (i = 0; i < 0x1600; i++)
649         RAM[CCP + i] = memory_region(space->machine, "cpu1")[i];
650
651      /* build the bios jump table */
652      cpm_jumptable(space->machine);
653      bc = curdisk;
654      cpu_set_reg(space->machine->cpu[0],  Z80_BC, bc );
655      cpu_set_reg(space->machine->cpu[0],  Z80_SP, 0x0080  );
656      cpu_set_reg(space->machine->cpu[0],  Z80_PC, CCP + 3 );
657      break;
658
659   case 0x02: /* CSTAT */
660      tmp = memory_read_byte(cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_IO), BIOS_CONST) & 0xff;
661      af = (af & 0xff) | (tmp << 8);
662
663      if (VERBOSE_CONIO)
664         logerror("BIOS 02 console status      A:%02X\n", tmp);
665      break;
666
667   case 0x03: /* CONIN */
668      if ( memory_read_byte(cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_IO), BIOS_CONST) == 0 )
669      {
670         cpu_set_reg(space->machine->cpu[0], Z80_PC, cpu_get_reg(space->machine->cpu[0], Z80_PC) - 2 );
671         break;
672      }
673      tmp = memory_read_byte(cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_IO), BIOS_CONIN) & 0xff;
674      af = (af & 0xff) | (tmp << 8);
675      if (VERBOSE_CONIO)
676         logerror("BIOS 03 console input       A:%02X\n", tmp);
677      break;
678
679   case 0x04: /* CONOUT */
680      tmp = bc & 0xff;
681      if (VERBOSE_CONIO)
682         logerror("BIOS 04 console output      C:%02X\n", tmp);
683      cpm_conout_chr( space->machine, tmp );
684      break;
685
686   case 0x05: /* LSTOUT */
687      tmp = bc & 0xff;
688      if (VERBOSE_BIOS)
689         logerror("BIOS 05 list output         C:%02X\n", tmp);
690      /* If the line printer file is created */
691      if (lp)
692         mame_fwrite(lp, &tmp, 1);
693      break;
694
695
696   case 0x06: /* PUNOUT */
697      tmp = bc & 0xff;
698      if (VERBOSE_BIOS)
699         logerror("BIOS 06 punch output        C:%02X\n", tmp);
700
701      /* We have no punch in MESS (yet ;-) */
702      break;
703
704
705   case 0x07: /* RDRIN */
706      /* We have no reader in MESS (yet ;-) */
707      tmp = 0x00;
708      af = (af & 0xff) | (tmp << 8);
709
710      if (VERBOSE_BIOS)
711         logerror("BIOS 07 reader input        A:%02X\n", tmp);
712      break;
713
714
715   case 0x08: /* HOME */
716      if (VERBOSE_BIOS)
717         logerror("BIOS 08 home\n");
718
719      cpm_disk_home();
720      break;
721
722
723   case 0x09: /* SELDSK */
724      tmp = bc & 0xff;
725      if (VERBOSE_BIOS)
726         logerror("BIOS 09 select disk         C:%02X\n", tmp);
727
728      hl = cpm_disk_select(tmp);
729      break;
730
731   case 0x0a: /* SETTRK */
732      tmp = bc;
733
734      if (VERBOSE_BIOS)
735         logerror("BIOS 0A set bdos_trk        BC:%04X\n", tmp);
736
737      cpm_disk_set_track(tmp);
738      break;
739
740
741   case 0x0b: /* SETSEC */
742      tmp = bc & 0xff;
743
744      if (VERBOSE_BIOS)
745         logerror("BIOS 0B set bdos_sec        C:%02X\n", tmp);
746
747      cpm_disk_set_sector(tmp);
748      break;
749
750
751   case 0x0c: /* SETDMA */
752      tmp = bc;
753
754      if (VERBOSE_BIOS)
755         logerror("BIOS 0C set DMA             BC:%04X\n", tmp);
756      cpm_disk_set_dma(tmp);
757      break;
758
759
760   case 0x0d: /* RDSEC */
761      tmp = cpm_disk_read_sector(space->machine);
762      af = (af & 0xff) | (tmp << 8);
763
764      if (VERBOSE_BIOS)
765         logerror("BIOS 0D read sector         A:%02X\n", tmp);
766      break;
767
768
769   case 0x0e: /* WRSEC */
770      tmp = cpm_disk_write_sector(space->machine);
771      af = (af & 0xff) | (tmp << 8);
772
773      if (VERBOSE_BIOS)
774         logerror("BIOS 0E write sector        A:%02X\n", tmp);
775      break;
776
777   case 0x0f: /* LSTSTA */
778      tmp = 0xff;    /* always ready */
779      af = (af & 0xff) | (tmp << 8);
780
781      if (VERBOSE_BIOS)
782         logerror("BIOS 0F list status         A:%02X\n", tmp);
783      break;
784
785   case 0x10: /* SECTRA */
786      bc = bc & 0x00ff;   /* mvi b,0 */
787      if( de )         /* translation table ? */
788      {
789         /* XCHG    */
790         tmp = hl;
791         hl = de;
792         de = tmp;
793         /* DAD B   */
794         hl += bc;
795         /* MOV A,M */
796         af = (af & 0xff) | ( memory_read_byte(space, hl) << 8);
797         /* MOV L,A */
798         hl = (hl & 0xff00) | (af >> 8);
799      }
800      else
801      {
802         /* MOV L,C */
803         /* MOV H,B */
804         hl = bc;
805      }
806      if( curdisk >= 0 && curdisk < num_disks )
807         bdos_sec[curdisk] = hl & 0xff;
808
809      if (VERBOSE_BIOS)
810         logerror("BIOS 10 sector trans        BC:%04X DE:%04X HL:%04X A:%02X\n", bc, de, hl, af>>8 );
811      break;
812
813
814   case 0x11: /* TRAP */
815      cpm_conout_str(space->machine, buff);
816      break;
817   }
818
819   /* Write back the possibly modified Z80 basic registers */
820   cpu_set_reg(space->machine->cpu[0], Z80_AF, af );
821   cpu_set_reg(space->machine->cpu[0], Z80_BC, bc );
822   cpu_set_reg(space->machine->cpu[0], Z80_DE, de );
823   cpu_set_reg(space->machine->cpu[0], Z80_HL, hl );
824}
825
src/mess/machine/cpm_bios.h
r4509r4510
1/******************************************************************************
2 *
3 *   cpm_bios.h
4 *
5 *   CP/M bios emulation (used for Kaypro 2x)
6 *
7 *   Juergen Buchmueller, July 1998
8 *
9 ******************************************************************************/
10
11#ifndef _CPM_BIOS_H
12#define _CPM_BIOS_H
13
14
15/* CCP   load address (console command processor of 62K cpm.sys) */
16#define CCP       0xde00
17
18/* BDOS load address (basic disk operating system of 62K cpm.sys) */
19#define BDOS      (CCP + 0x0806)
20
21#define NDSK   4         /* maximum number of disk drives */
22
23#define NFUN    18          /* number of bios functions */
24#define DPHL   16         /* length of a DPH structure */
25#define DPBL   15         /* length of a DPB structure */
26#define RECL   128       /* CP/M record length */
27
28/* BIOS 'hardware' interface addresses (to be handled by readport/writeport) */
29#define BIOS_LSTST  0x60    /* list status */
30#define BIOS_LSTIN  0x61    /* list in (w to stuff characters) */
31#define BIOS_LSTOUT 0x62    /* list out */
32
33#define BIOS_RDRST  0x64    /* reader status */
34#define BIOS_RDRIN  0x65    /* reader in (w to stuff characters) */
35#define BIOS_RDROUT 0x66    /* reader out */
36
37#define BIOS_PUNST  0x68    /* punch status */
38#define BIOS_PUNIN  0x69    /* punch in (w to stuff characters) */
39#define BIOS_PUNOUT 0x6a    /* punch out */
40
41#define BIOS_CONST  0x6c    /* console status */
42#define BIOS_CONIN  0x6d    /* console in (w to stuff characters) */
43#define BIOS_CONOUT 0x6e    /* console out (r to ) */
44
45#define BIOS_CMD    0x70    /* bios command out */
46
47/* BIOS load address (5,5K after CCP/BDOS) contains a jump table */
48#define BIOS        (CCP + 0x1600)
49
50/* BIOS DPHs (disk parameter headers) */
51#define DPH0      (BIOS + NFUN * 3)
52#define DPH1      (BIOS + NFUN * 3 + 1 * DPHL)
53#define DPH2      (BIOS + NFUN * 3 + 2 * DPHL)
54#define DPH3      (BIOS + NFUN * 3 + 3 * DPHL)
55/* BIOS DPBs (disk parameter blocks) */
56#define DPB0        (BIOS + NFUN * 3 + 4 * DPHL)
57#define DPB1      (BIOS + NFUN * 3 + 4 * DPHL + 1 * DPBL)
58#define DPB2      (BIOS + NFUN * 3 + 4 * DPHL + 2 * DPBL)
59#define DPB3      (BIOS + NFUN * 3 + 4 * DPHL + 3 * DPBL)
60
61/* 4 times 128 byte directory buffers */
62#define DIRBUF      (BIOS + NFUN * 3 + 4 * DPHL + 4 * DPBL)
63
64/* BIOS DATA (XLATs, CSVs, ALVs) */
65#define DATA_START   (BIOS + NFUN * 3 + 4 * DPHL + 4 * DPBL + 4 * RECL)
66
67/* BIOS functions */
68#define BIOS_00    0xffb0
69#define BIOS_01    0xffb4
70#define BIOS_02    0xffb8
71#define BIOS_03    0xffbc
72#define BIOS_04    0xffc0
73#define BIOS_05    0xffc4
74#define BIOS_06    0xffc8
75#define BIOS_07    0xffcc
76#define BIOS_08    0xffd0
77#define BIOS_09    0xffd4
78#define BIOS_0A    0xffd8
79#define BIOS_0B    0xffdc
80#define BIOS_0C    0xffe0
81#define BIOS_0D    0xffe4
82#define BIOS_0E    0xffe8
83#define BIOS_0F    0xffec
84#define BIOS_10    0xfff0
85#define BIOS_11    0xfff4
86
87/* BIOS central function exec via OUT (0),A */
88#define BIOS_EXEC   0xfff8   /* code here is: D3 00 C9 */
89#define BIOS_END   0xffff
90
91#if 0
92
93typedef enum {
94    DEN_FM_LO = 0,
95    DEN_FM_HI,
96    DEN_MFM_LO,
97    DEN_MFM_HI
98} DENSITY;
99
100#endif
101
102typedef enum {
103    ORD_SIDES = 0,
104    ORD_CYLINDERS,
105    ORD_EAGLE
106} ORDER;
107
108typedef struct {
109   UINT16 xlat;            /* sector translation table */
110   UINT16 scr1;            /* scratch memory 1       */
111   UINT16 scr2;            /* scratch memory 2       */
112   UINT16 scr3;            /* scratch memory 3       */
113   UINT16 dirbuf;         /* directory buffer       */
114   UINT16 dpb;            /* drive parameter block   */
115   UINT16 csv;            /* check sector vector      */
116   UINT16 alv;            /* allocation vector      */
117} cpm_dph;
118
119typedef struct {
120   UINT16 spt;            /* sectors per track      */
121   UINT8 bsh;            /* block shift            */
122   UINT8 blm;            /* block mask            */
123   UINT8 exm;            /* extent mask            */
124   UINT16 dsm;            /* drive storage max sector */
125   UINT16 drm;            /* directory max sector    */
126   UINT8 al0;            /* allocation bits low      */
127   UINT8 al1;            /* allocation bits high    */
128   UINT16 cks;            /* check sectors (drm+1)/4 if media is removable */
129   UINT16 off;            /* offset (boot sectors)   */
130} cpm_dpb;
131
132typedef struct {
133   const char   *id;      /* short name */
134   const char   *name;      /* long name */
135   const char   *ref;      /* id reference */
136   DENSITY density;      /* fdd density */
137   UINT16   cylinders;      /* number of cylinders */
138   UINT8   sides;         /* number of sides */
139   UINT8   spt;         /* sectors per track */
140   UINT16   seclen;       /* sector length */
141   UINT8   skew;         /* sector skew */
142   UINT8   side1[32];      /* side number, sector numbers */
143   UINT8   side2[32];      /* side number, sector numbers */
144   ORDER   order;         /* sector ordering */
145   const char   *label;    /* disk label */
146   cpm_dpb dpb;         /* associated dpb */
147} dsk_fmt;
148
149/* these are in cpm_bios.c */
150DEVICE_IMAGE_LOAD( cpm_floppy );
151extern int cpm_init(running_machine *machine, int n, const char *const ids[]);
152
153extern READ8_HANDLER ( cpm_bios_command_r );
154extern WRITE8_HANDLER ( cpm_bios_command_w );
155
156/* these are in cpm_disk.c */
157extern int cpm_disk_select_format(int disk, const char *disk_id);
158extern void cpm_disk_home(void);
159extern void cpm_disk_set_track(int t);
160extern void cpm_disk_set_sector(int s);
161extern void cpm_disk_set_dma(int d);
162extern int cpm_disk_read_sector(running_machine *machine);
163extern int cpm_disk_write_sector(running_machine *machine);
164
165#endif  /* _CPM_BIOS_H */
src/mess/machine/kay_kbd.c
r4509r4510
280280   beep_on = 1;
281281   beep_set_state(kay_kbd_beeper, 0);
282282   beep_set_frequency(kay_kbd_beeper, 950);   /* piezo-device needs to be measured */
283   kbd_head = kbd_tail = 0;         /* init buffer */
283284}
284285 
285286/******************************************************
src/mess/machine/kay_kbd.h
r4509r4510
33void kay_kbd_d_w( running_machine *machine, UINT8 data );
44INTERRUPT_GEN( kay_kbd_interrupt );
55MACHINE_RESET( kay_kbd );
6INPUT_PORTS_EXTERN( kay_kbd );
src/mess/mess.mak
r4509r4510
598598   $(MESS_DRIVERS)/apexc.o
599599
600600$(MESSOBJ)/kaypro.a:   \
601   $(MESS_DRIVERS)/kaypro.o   \
602601   $(MESS_DRIVERS)/kaypro2.o   \
603   $(MESS_MACHINE)/cpm_bios.o   \
604   $(MESS_VIDEO)/kaypro.o    \
605   $(MESS_AUDIO)/kaypro.o    \
606   $(MESS_MACHINE)/kaypro.o    \
607602   $(MESS_MACHINE)/kay_kbd.o    \
608603
609604$(MESSOBJ)/sinclair.a: \
src/mess/drivers/kaypro.c
r4509r4510
1/******************************************************************************
2 *
3 *  kaypro.c
4 *
5 *  Driver for Kaypro 2x
6 *
7 *  Juergen Buchmueller, July 1998
8 *  Benjamin C. W. Sittler, July 1998 (new keyboard)
9 *
10 ******************************************************************************/
11
12#include "driver.h"
13#include "cpu/z80/z80.h"
14#include "includes/kaypro.h"
15
16#include "machine/wd17xx.h"
17#include "machine/cpm_bios.h"
18#include "devices/basicdsk.h"
19
20
21static ADDRESS_MAP_START( kaypro_mem , ADDRESS_SPACE_PROGRAM, 8)
22   AM_RANGE( 0x0000, 0xffff) AM_RAM
23ADDRESS_MAP_END
24
25static ADDRESS_MAP_START( kaypro_io , ADDRESS_SPACE_IO, 8)
26   ADDRESS_MAP_GLOBAL_MASK(0xff)
27   AM_RANGE( BIOS_CONST,  BIOS_CONST)  AM_READWRITE( kaypro_const_r, kaypro_const_w )
28   AM_RANGE( BIOS_CONIN,  BIOS_CONIN)  AM_READWRITE( kaypro_conin_r, kaypro_conin_w )
29   AM_RANGE( BIOS_CONOUT, BIOS_CONOUT) AM_READWRITE( kaypro_conout_r, kaypro_conout_w )
30   AM_RANGE( BIOS_CMD,    BIOS_CMD)    AM_READWRITE( cpm_bios_command_r, cpm_bios_command_w )
31ADDRESS_MAP_END
32
33/*
34 * The KAYPRO keyboard has roughly the following layout:
35 *
36 *                                                                  [up] [down] [left] [right]
37 *         [ESC] [1!] [2@] [3#] [4$] [5%] [6^] [7&] [8*] [9(] [0)] [-_] [=+] [`~] [BACK SPACE]
38 *           [TAB] [qQ] [wW] [eE] [rR] [tT] [yY] [uU] [iI] [oO] [pP] [[{] []}]       [DEL]
39 *[CTRL] [CAPS LOCK] [aA] [sS] [dD] [fF] [gG] [hH] [jJ] [kK] [lL] [;:] ['"] [RETURN] [\|]
40 *            [SHIFT] [zZ] [xX] [cC] [vV] [bB] [nN] [mM] [,<] [.>] [/?] [SHIFT] [LINE FEED]
41 *                      [                 SPACE                     ]
42 *
43 * [7] [8] [9] [-]
44 * [4] [5] [6] [,]
45 * [1] [2] [3]
46 * [  0  ] [.] [ENTER]
47 *
48 * Notes on Appearance
49 * -------------------
50 * The RETURN key is shaped like a backwards "L". The keypad ENTER key is actually
51 * oriented vertically, not horizontally. The alpha keys are marked with the uppercase letters
52 * only. Other keys with two symbols have the shifted symbol printed above the unshifted symbol.
53 * The keypad is actually located to the right of the main keyboard; it is shown separately here
54 * as a convenience to users of narrow listing windows. The arrow keys are actually marked with
55 * arrow graphics pointing in the appropriate directions. The F and J keys are specially shaped,
56 * since they are the "home keys" for touch-typing. The CAPS LOCK key has a build-in red indicator
57 * which is lit when CAPS LOCK is pressed once, and extinguished when the key is pressed again.
58 *
59 * Technical Notes
60 * ---------------
61 * The keyboard interfaces to the computer using a serial protocol. Modifier keys are handled
62 * inside the keyboards, as is the CAPS LOCK key. The arrow keys and the numeric keypad send
63 * non-ASCII codes which are not affected by the modifier keys. The remaining keys send the
64 * appropriate ASCII values.
65 *
66 * The keyboard has a built-in buzzer which is activated briefly by a non-modifier keypress,
67 * producing a "clicking" sound for user feedback. Additionally, this buzzer can be activated
68 * for a longer period by sending a 0x04 byte to the keyboard. This is used by the ROM soft
69 * terminal to alert the user in case of a BEL.
70*
71 * 2008-05 FP:
72 * Small note about natural keyboard support: currently,
73 * - "Line Feed" is mapped to the 'End' key
74 * - "Keypad ," is not mapped
75 */
76
77static INPUT_PORTS_START( kaypro )
78   PORT_START("IN0") /* IN0 */ /* 2008-05: Is there any reason to keep this? */
79   PORT_BIT(0xff, 0xff, IPT_UNUSED)
80
81   PORT_START("ROW0")
82   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC)          PORT_CHAR(UCHAR_MAMEKEY(ESC))
83   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_1)          PORT_CHAR('1') PORT_CHAR('!')
84   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_2)          PORT_CHAR('2') PORT_CHAR('@')
85   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_3)          PORT_CHAR('3') PORT_CHAR('#')
86   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_4)          PORT_CHAR('4') PORT_CHAR('$')
87   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_5)          PORT_CHAR('5') PORT_CHAR('%')
88   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_6)          PORT_CHAR('6') PORT_CHAR('^')
89   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_7)          PORT_CHAR('7') PORT_CHAR('&')
90
91   PORT_START("ROW1")
92   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_8)          PORT_CHAR('8') PORT_CHAR('*')
93   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_9)          PORT_CHAR('9') PORT_CHAR('(')
94   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_0)          PORT_CHAR('0') PORT_CHAR(')')
95   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS)       PORT_CHAR('-') PORT_CHAR('_')
96   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS)       PORT_CHAR('=') PORT_CHAR('+')
97   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE)       PORT_CHAR('`') PORT_CHAR('~')
98   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("BACK SPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
99   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB)          PORT_CHAR('\t')
100
101   PORT_START("ROW2")
102   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q)          PORT_CHAR('q') PORT_CHAR('Q')
103   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_W)          PORT_CHAR('w') PORT_CHAR('W')
104   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_E)          PORT_CHAR('e') PORT_CHAR('E')
105   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_R)          PORT_CHAR('r') PORT_CHAR('R')
106   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_T)          PORT_CHAR('t') PORT_CHAR('T')
107   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y)          PORT_CHAR('y') PORT_CHAR('Y')
108   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_U)          PORT_CHAR('u') PORT_CHAR('U')
109   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_I)          PORT_CHAR('i') PORT_CHAR('I')
110
111   PORT_START("ROW3")
112   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_O)          PORT_CHAR('o') PORT_CHAR('O')
113   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_P)          PORT_CHAR('p') PORT_CHAR('P')
114   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE)      PORT_CHAR('[') PORT_CHAR('{')
115   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE)   PORT_CHAR(']') PORT_CHAR('}')
116   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
117   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL))
118   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL)      PORT_CHAR(UCHAR_SHIFT_2)
119   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
120
121   PORT_START("ROW4")
122   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_A)          PORT_CHAR('a') PORT_CHAR('A')
123   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_S)          PORT_CHAR('s') PORT_CHAR('S')
124   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_D)          PORT_CHAR('d') PORT_CHAR('D')
125   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_F)          PORT_CHAR('f') PORT_CHAR('F')
126   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_G)          PORT_CHAR('g') PORT_CHAR('G')
127   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_H)          PORT_CHAR('h') PORT_CHAR('H')
128   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_J)          PORT_CHAR('j') PORT_CHAR('J')
129   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_K)          PORT_CHAR('k') PORT_CHAR('K')
130
131   PORT_START("ROW5")
132   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_L)          PORT_CHAR('l') PORT_CHAR('L')
133   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON)         PORT_CHAR(';') PORT_CHAR(':')
134   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE)         PORT_CHAR('\'') PORT_CHAR('"')
135   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH)      PORT_CHAR('\\') PORT_CHAR('|')
136   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT)      PORT_CHAR(UCHAR_MAMEKEY(LSHIFT))
137   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z)          PORT_CHAR('z') PORT_CHAR('Z')
138   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_X)          PORT_CHAR('x') PORT_CHAR('X')
139   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_C)          PORT_CHAR('c') PORT_CHAR('C')
140
141   PORT_START("ROW6")
142   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_V)          PORT_CHAR('v') PORT_CHAR('V')
143   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_B)          PORT_CHAR('b') PORT_CHAR('B')
144   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_N)          PORT_CHAR('n') PORT_CHAR('N')
145   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_M)            PORT_CHAR('m') PORT_CHAR('M')
146   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA)         PORT_CHAR(',') PORT_CHAR('<')
147   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP)         PORT_CHAR('.') PORT_CHAR('>')
148   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH)         PORT_CHAR('/') PORT_CHAR('?')
149   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT)      PORT_CHAR(UCHAR_MAMEKEY(RSHIFT))
150
151   PORT_START("ROW7")
152   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END))
153   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE)         PORT_CHAR(' ')
154   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD)    PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD))
155   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_PLUS_PAD)
156   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD)      PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD))
157   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD)       PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))
158   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD)       PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
159   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD)       PORT_CHAR(UCHAR_MAMEKEY(1_PAD))
160
161   PORT_START("ROW8")
162   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD)       PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
163   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD)       PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
164   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD)       PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
165   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD)       PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
166   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD)       PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
167   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD)       PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
168   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD)       PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
169   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD)         PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
170
171   PORT_START("ROW9")
172   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
173   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
174   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
175   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
176   PORT_BIT(0xf0, 0x00, IPT_UNUSED)
177INPUT_PORTS_END
178
179#define FW  ((KAYPRO_FONT_W+7)/8)*8
180#define FH  KAYPRO_FONT_H
181
182static const gfx_layout charlayout =
183{
184   FW, FH,         /* 8*16 characters */
185   4 * 256,        /* 4 * 256 characters */
186   1,              /* 1 bits per pixel */
187   { 0 },          /* no bitplanes; 1 bit per pixel */
188   /* x offsets */
189   { 0, 1, 2, 3, 4, 5, 6, 7,
190      8, 9,10,11,12,13,14,15,
191      16,17,18,19,20,21,22,23,
192      24,25,26,27,28,29,30,31 },
193   /* y offsets */
194   { 0*FW, 1*FW, 2*FW, 3*FW, 4*FW, 5*FW, 6*FW, 7*FW,
195      8*FW, 9*FW,10*FW,11*FW,12*FW,13*FW,14*FW,15*FW,
196      16*FW,17*FW,18*FW,19*FW,20*FW,21*FW,22*FW,23*FW,
197      24*FW,25*FW,26*FW,27*FW,28*FW,29*FW,30*FW,31*FW },
198   FW * FH         /* every char takes 16 bytes */
199};
200
201static GFXDECODE_START( kaypro )
202   GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 4 )
203GFXDECODE_END
204
205static const unsigned char kaypro_palette[] =
206{
207      0,  0,  0,    /* black */
208      0,240,  0,    /* green */
209      0,120,  0,    /* dim green */
210      0,240,  0,    /* flashing green */
211      0,120,  0,    /* flashing dim green */
212
213    240,  0,  0,    /* just to keep the frontend happy */
214      0,  0,240,
215    120,120,120,
216    240,240,240,
217};
218
219static const unsigned short kaypro_colortable[] =
220{
221    0,  1,      /* green on black */
222    0,  2,      /* dim green on black */
223    0,  3,      /* flashing green on black */
224    0,  4,      /* flashing dim green on black */
225};
226
227
228/* Initialise the palette */
229static PALETTE_INIT( kaypro )
230{
231   int i;
232
233   for ( i = 0; i < sizeof(kaypro_palette) / 3; i++ ) {
234      palette_set_color_rgb(machine, i, kaypro_palette[i*3], kaypro_palette[i*3+1], kaypro_palette[i*3+2]);
235   }
236}
237
238static MACHINE_DRIVER_START( kaypro )
239   /* basic machine hardware */
240   MDRV_CPU_ADD("maincpu", Z80, 4000000)        /* 4 MHz */
241   MDRV_CPU_PROGRAM_MAP(kaypro_mem, 0)
242   MDRV_CPU_IO_MAP(kaypro_io, 0)
243   MDRV_CPU_VBLANK_INT("screen", kaypro_interrupt)
244   MDRV_QUANTUM_TIME(HZ(240))
245
246   MDRV_MACHINE_RESET( kaypro )
247
248    /* video hardware */
249   MDRV_SCREEN_ADD("screen", RASTER)
250   MDRV_SCREEN_REFRESH_RATE(60)
251   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
252   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
253   MDRV_SCREEN_SIZE(80*KAYPRO_FONT_W, 25*KAYPRO_FONT_H)
254   MDRV_SCREEN_VISIBLE_AREA(0*KAYPRO_FONT_W, 80*KAYPRO_FONT_W-1, 0*KAYPRO_FONT_H, 25*KAYPRO_FONT_H-1)
255   MDRV_GFXDECODE( kaypro )
256   MDRV_PALETTE_LENGTH(sizeof(kaypro_palette) / 3)
257   MDRV_PALETTE_INIT( kaypro )
258
259   MDRV_VIDEO_START( kaypro )
260   MDRV_VIDEO_UPDATE( kaypro )
261MACHINE_DRIVER_END
262
263
264ROM_START (kaypro)
265    ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* 64K for the Z80 */
266    /* totally empty :) */
267
268    ROM_REGION(0x04000,"gfx1",0)  /* 4 * 4K font ram */
269    ROM_LOAD ("kaypro2x.fnt", 0x0000, 0x1000, CRC(5f72da5b) SHA1(8a597000cce1a7e184abfb7bebcb564c6bf24fb7))
270
271    ROM_REGION(0x01600,"cpu1",0)  /* 5,5K for CCP and BDOS buffer */
272    ROM_LOAD ("cpm62k.sys",   0x0000, 0x1600, CRC(d10cd036) SHA1(68c04701711fcb5ac1586eb8f060f3f0e02ba3dd))
273ROM_END
274
275static void kaypro_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
276{
277   /* floppy */
278   switch(state)
279   {
280      /* --- the following bits of info are returned as 64-bit signed integers --- */
281      case MESS_DEVINFO_INT_COUNT:                     info->i = 4; break;
282
283      /* --- the following bits of info are returned as pointers to data or functions --- */
284      case MESS_DEVINFO_PTR_LOAD:                     info->load = DEVICE_IMAGE_LOAD_NAME(cpm_floppy); break;
285
286      /* --- the following bits of info are returned as NULL-terminated strings --- */
287      case MESS_DEVINFO_STR_FILE_EXTENSIONS:            strcpy(info->s = device_temp_str(), "dsk"); break;
288
289      default:                              legacybasicdsk_device_getinfo(devclass, state, info); break;
290   }
291}
292
293static SYSTEM_CONFIG_START(kaypro)
294   CONFIG_DEVICE(kaypro_floppy_getinfo)
295SYSTEM_CONFIG_END
296
297/*    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT     INIT      CONFIG    COMPANY   FULLNAME */
298COMP( 1982, kaypro,   0,      0,      kaypro,   kaypro,   kaypro,   kaypro,   "Non Linear Systems",  "Kaypro 2x" , 0)
src/mess/drivers/kaypro2.c
r4509r4510
1919 
2020 
2121   Things that need doing:
22   - Keyboard is a separate device and not emulated (includes a beeper)
2322   - Floppy disks (I have no knowledge of how to set these up)
2423   - Split this code to video, machine
24   - Add clones
2525 
2626 
2727**************************************************************************************************/
r4509r4510
4545static const device_config *kaypro2_printer;
4646static const device_config *kaypro2_fdc;
4747 
48INPUT_PORTS_EXTERN( kay_kbd );
4948 
5049 
5150/***********************************************************
r4509r4510
114113   return 0;
115114}
116115 
116static VIDEO_UPDATE( omni2 )
117{
118   static UINT8 framecnt=0;
119   UINT8 y,ra,chr,gfx;
120   UINT16 sy=0,ma=0,x;
121   UINT8 *FNT = memory_region(screen->machine, "gfx1");
122 
123   framecnt++;
124 
125   for (y = 0; y < 24; y++)
126   {
127      for (ra = 0; ra < 10; ra++)
128      {
129         UINT16  *p = BITMAP_ADDR16(bitmap, sy++, 0);
130 
131         for (x = ma; x < ma + 80; x++)
132         {
133            if (ra < 8)
134            {
135               chr = videoram[x];
136 
137               /* Take care of flashing characters */
138               if ((chr > 0x7f) && (framecnt & 0x08))
139                  chr |= 0x80;
140 
141               /* get pattern of pixels for that character scanline */
142               gfx = FNT[(chr<<3) | ra ];
143            }
144            else
145               gfx = 0xff;
146 
147            /* Display a scanline of a character (7 pixels) */
148            *p = ( gfx & 0x40 ) ? 0 : 1; p++;
149            *p = ( gfx & 0x20 ) ? 0 : 1; p++;
150            *p = ( gfx & 0x10 ) ? 0 : 1; p++;
151            *p = ( gfx & 0x08 ) ? 0 : 1; p++;
152            *p = ( gfx & 0x04 ) ? 0 : 1; p++;
153            *p = ( gfx & 0x02 ) ? 0 : 1; p++;
154            *p = ( gfx & 0x01 ) ? 0 : 1; p++;
155         }
156      }
157      ma+=128;
158   }
159   return 0;
160}
161 
117162static READ8_HANDLER( kaypro2_videoram_r )
118163{
119164   return videoram[offset];
r4509r4510
241286/***********************************************************
242287 
243288   SIO
289   Baud rate setup commented out until MAME includes
290   the feature.
244291 
245292************************************************************/
246293 
247static WRITE8_HANDLER( kaypro2_baud_w )
248{
249/* Set baud rate. bits 0..3 Rx and Tx are tied together. Baud Rate Generator is a AY-5-8116.
294/* Set baud rate. bits 0..3 Rx and Tx are tied together. Baud Rate Generator is a AY-5-8116, SMC8116, etc.
250295   00h    50   
251296   11h    75   
252297   22h    110   
r4509r4510
264309   EEh    9600   
265310   FFh    19200 */
266311 
267//   int baud_clock[]={ 800, 1200, 1760, 2152, 2400, 4800, 9600, 19200, 28800, 32000, 38400, 57600, 76800, 115200, 153600, 307200 };
312static const int baud_clock[]={ 800, 1200, 1760, 2152, 2400, 4800, 9600, 19200, 28800, 32000, 38400, 57600, 76800, 115200, 153600, 307200 };
268313 
314static WRITE8_HANDLER( kaypro2_baud_a_w )   /* channel A - RS232C */
315{
269316   data &= 0x0f;
270317 
271   if (offset < 4)
272   {
273   /* channel A */
274//      z80sio_set_rx_clock( kaypro2_z80sio, baud_clock[data], 0);
275//      z80sio_set_tx_clock( kaypro2_z80sio, baud_clock[data], 0);
276   }
277   else
278   {
279   /* channel B */
280//      z80sio_set_rx_clock( kaypro2_z80sio, baud_clock[data], 1);
281//      z80sio_set_tx_clock( kaypro2_z80sio, baud_clock[data], 1);
282   }
318//   z80sio_set_rx_clock( kaypro2_z80sio, baud_clock[data], 0);
319//   z80sio_set_tx_clock( kaypro2_z80sio, baud_clock[data], 0);
283320}
284321 
322static WRITE8_HANDLER( kaypro2_baud_b_w )   /* Channel B - Keyboard */
323{
324/* Only speed used is 300 baud */
325 
326   data &= 0x0f;
327 
328//   z80sio_set_rx_clock( kaypro2_z80sio, baud_clock[data], 1);
329//   z80sio_set_tx_clock( kaypro2_z80sio, baud_clock[data], 1);
330}
331 
285332/* when sio devcb'ed like pio is, change to use pio's int handler */
286333static void kaypro2_int_sio(const device_config *device, int state)
287334{
r4509r4510
367414 
368415static const wd17xx_interface kaypro2_wd1793_interface = { kaypro2_fdc_callback, NULL };
369416 
370/* I have no idea how to set up floppies - these ones have 40 tracks, 10 sectors, 512 bytes per track, single sided */
417/* I have no idea how to set up floppies - these ones have 40 tracks, 40 sectors, 128 bytes per track, single sided */
371418 
372419static void kaypro2_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
373420{
r4509r4510
403450static ADDRESS_MAP_START( kaypro2_io, ADDRESS_SPACE_IO, 8 )
404451   ADDRESS_MAP_GLOBAL_MASK(0xff)
405452   ADDRESS_MAP_UNMAP_HIGH
406   AM_RANGE(0x00, 0x03) AM_WRITE(kaypro2_baud_w)
453   AM_RANGE(0x00, 0x03) AM_WRITE(kaypro2_baud_a_w)
407454   AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("z80sio", kaypro2_sio_r, kaypro2_sio_w)
408455   AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("z80pio_g", kaypro2_pio_r, kaypro2_pio_w)
409   AM_RANGE(0x0c, 0x0f) AM_WRITE(kaypro2_baud_w)
456   AM_RANGE(0x0c, 0x0f) AM_WRITE(kaypro2_baud_b_w)
410457   AM_RANGE(0x10, 0x10) AM_DEVREADWRITE("wd1793", wd17xx_status_r, wd17xx_command_w)
411458   AM_RANGE(0x11, 0x11) AM_DEVREADWRITE("wd1793", wd17xx_track_r, wd17xx_track_w)
412459   AM_RANGE(0x12, 0x12) AM_DEVREADWRITE("wd1793", wd17xx_sector_r, wd17xx_sector_w)
r4509r4510
473520   MDRV_Z80SIO_ADD( "z80sio", 4800, kaypro2_sio_intf )   /* start at 300 baud */
474521MACHINE_DRIVER_END
475522 
523static MACHINE_DRIVER_START( omni2 )
524   MDRV_IMPORT_FROM( kaypro2 )
525   MDRV_VIDEO_UPDATE( omni2 )
526MACHINE_DRIVER_END
476527 
528 
477529/***********************************************************
478530 
479531   Game driver
480532 
481533************************************************************/
482534 
483ROM_START(kaypro2)
535/* The roms need to be renamed to their part numbers (81-xxx) when known */
536 
537ROM_START(kayproii)
484538   /* The board could take a 2716 or 2732 */
485539   ROM_REGION(0x4000, "maincpu",0)
486   ROM_LOAD("kaypro2.u47", 0x0000, 0x0800, CRC(28264bc1) SHA1(a12afb11a538fc0217e569bc29633d5270dfa51b))
487//   ROM_LOAD("kaypro2.u47", 0x0000, 0x1000, CRC(4918fb91) SHA1(cd9f45cc3546bcaad7254b92c5d501c40e2ef0b2))
540   ROM_LOAD("kayproii.u47", 0x0000, 0x0800, CRC(28264bc1) SHA1(a12afb11a538fc0217e569bc29633d5270dfa51b) )
541//   ROM_LOAD("kayproii.u47", 0x0000, 0x1000, CRC(4918fb91) SHA1(cd9f45cc3546bcaad7254b92c5d501c40e2ef0b2) )
488542 
489543   ROM_REGION(0x10000, "rambank",0)
490544   ROM_FILL( 0, 0x10000, 0xff)
491545 
492546   ROM_REGION(0x0800, "gfx1",0)
493   ROM_LOAD("kaypro2.u43", 0x00000, 0x0800, CRC(4cc7d206) SHA1(5cb880083b94bd8220aac1f87d537db7cfeb9013))
547   ROM_LOAD("kayproii.u43", 0x0000, 0x0800, CRC(4cc7d206) SHA1(5cb880083b94bd8220aac1f87d537db7cfeb9013) )
494548ROM_END
495549 
550ROM_START(omni2)
551   ROM_REGION(0x4000, "maincpu",0)
552   ROM_LOAD("omni2.u47",    0x0000, 0x1000, CRC(2883f9e0) SHA1(d98c784e62853582d298bf7ca84c75872847ac9b) )
496553 
554   ROM_REGION(0x10000, "rambank",0)
555   ROM_FILL( 0, 0x10000, 0xff)
556 
557   ROM_REGION(0x0800, "gfx1",0)
558   ROM_LOAD("omni2.u43",    0x0000, 0x0800, CRC(049b3381) SHA1(46f1d4f038747ba9048b075dc617361be088f82a) )
559ROM_END
560 
561ROM_START(kaypro2x)
562   ROM_REGION(0x4000, "maincpu",0)
563   ROM_LOAD("kaypro2.u34",  0x0000, 0x2000, CRC(5eb69aec) SHA1(525f955ca002976e2e30ac7ee37e4a54f279fe96) )
564 
565   ROM_REGION(0x10000, "rambank",0)
566   ROM_FILL( 0, 0x10000, 0xff)
567 
568   ROM_REGION(0x1000, "gfx1",0)
569   ROM_LOAD("kaypro2.u9",   0x0000, 0x1000, CRC(5f72da5b) SHA1(8a597000cce1a7e184abfb7bebcb564c6bf24fb7) )
570ROM_END
571 
572 
497573static SYSTEM_CONFIG_START(kaypro2)
498574   CONFIG_DEVICE(kaypro2_floppy_getinfo)
499575SYSTEM_CONFIG_END
500576 
501/*    YEAR  NAME      PARENT  COMPAT  MACHINE     INPUT    INIT      CONFIG       COMPANY  FULLNAME */
502COMP( 1983, kaypro2,  0,      0,      kaypro2,    kay_kbd, 0,        kaypro2,     "Non Linear Systems",  "Kaypro 2/83" , GAME_NOT_WORKING )
577/*    YEAR  NAME      PARENT   COMPAT  MACHINE     INPUT    INIT      CONFIG       COMPANY  FULLNAME */
578COMP( 1983, kayproii, 0,       0,      kaypro2,   kay_kbd, 0,        kaypro2,     "Non Linear Systems",  "Kaypro II - 2/83" , GAME_NOT_WORKING )
579COMP( 198?, omni2,    0,       0,      omni2,     kay_kbd, 0,        kaypro2,     "Non Linear Systems",  "Omni II" , GAME_NOT_WORKING )
580COMP( 198?, kaypro2x, 0,       0,      kaypro2,   kay_kbd, 0,        kaypro2,     "Non Linear Systems",  "Kaypro 2x" , GAME_NOT_WORKING )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team