Previous 15994 Revisions Next

r4610 Saturday 2nd May, 2009 at 19:59:56 UTC by Miodrag Milanović
[VT100] New driver for DEC VT100 terminal
[docs]messnew.txt
[src/mess]mess.mak messdriv.c
[src/mess/drivers]vt100.c*
[src/mess/layout]vt100.lay*
[src/mess/video]vtvideo.c* vtvideo.h*

src/mess/video/vtvideo.c
r0r4610
1/**********************************************************************
2
3    DEC VT Terminal video emulation
4    [ DC012 and DC011 emulation ]
5
6    01/05/2009 Initial implementation [Miodrag Milanovic]
7
8    Copyright MESS Team.
9    Visit http://mamedev.org for licensing and usage restrictions.
10
11**********************************************************************/
12
13#include "driver.h"
14#include "vtvideo.h"
15
16/***************************************************************************
17    PARAMETERS
18***************************************************************************/
19
20#define   VERBOSE         0
21
22#define   LOG(x)      do { if (VERBOSE) logerror x; } while (0)
23   
24/***************************************************************************
25    TYPE DEFINITIONS
26***************************************************************************/
27
28typedef struct _vt_video_t vt_video_t;
29struct _vt_video_t
30{
31   devcb_resolved_read8      in_ram_func;
32
33   const device_config *screen;   /* screen */
34   UINT8 *gfx;      /* content of char rom */
35   
36    int skip_lines;   
37    int height;
38    int width;
39    int lba7;
40};
41
42/***************************************************************************
43    INLINE FUNCTIONS
44***************************************************************************/
45
46INLINE vt_video_t *get_safe_token(const device_config *device)
47{
48   assert(device != NULL);
49   assert(device->token != NULL);
50
51   return (vt_video_t *)device->token;
52}
53
54INLINE const vt_video_interface *get_interface(const device_config *device)
55{
56   assert(device != NULL);
57   assert((device->type == dc012));
58   return (const vt_video_interface *) device->static_config;
59}
60
61/***************************************************************************
62    IMPLEMENTATION
63***************************************************************************/
64READ8_DEVICE_HANDLER( lba7_r )
65{
66   vt_video_t *vt = get_safe_token(device);
67   return vt->lba7;
68}
69
70
71WRITE8_DEVICE_HANDLER( dc012_w )
72{
73//   vt_video_t *vt = get_safe_token(device);
74}
75
76
77WRITE8_DEVICE_HANDLER( dc011_w )
78{
79//   vt_video_t *vt = get_safe_token(device);
80}
81
82WRITE8_DEVICE_HANDLER( vt_video_brightness_w )
83{
84   palette_set_color_rgb(device->machine, 1, data, data, data);
85}
86
87void vt_video_display_char(const device_config *device,bitmap_t *bitmap, UINT8 code,
88   int x, int y,UINT8 scroll_region,UINT8 display_type)
89{               
90   UINT8 line;
91      int i,b,bit;
92    int double_width = (display_type==2) ? 1 : 0;
93    vt_video_t *vt = get_safe_token(device);
94
95   for (i = 0; i < 10; i++)
96   {
97      switch(display_type) {
98         case 0 : // bottom half, double height
99                line = vt->gfx[(code & 0x7f)*16 + (i >> 1)+5]; break;
100         case 1 : // top half, double height
101                 line = vt->gfx[(code & 0x7f)*16 + (i >> 1)]; break;
102         case 2 : // double width           
103         case 3 : // normal
104                line = vt->gfx[(code & 0x7f)*16 + i]; break;
105      }
106     
107      for (b = 0; b < 8; b++)
108      {
109         bit = ((line << b) & 0x80) ? 1 : 0;
110         if (double_width) {
111            *BITMAP_ADDR16(bitmap, y*10+i, x*20+b*2)   =  bit;
112            *BITMAP_ADDR16(bitmap, y*10+i, x*20+b*2+1) =  bit;
113         } else {
114            *BITMAP_ADDR16(bitmap, y*10+i, x*10+b) =  bit;
115         }
116      }
117      // char interleave is filled with last bit
118      if (double_width) {
119         *BITMAP_ADDR16(bitmap, y*10+i, x*20+16) =  bit;
120         *BITMAP_ADDR16(bitmap, y*10+i, x*20+17) =  bit;
121         *BITMAP_ADDR16(bitmap, y*10+i, x*20+18) =  bit;
122         *BITMAP_ADDR16(bitmap, y*10+i, x*20+19) =  bit;
123      } else {
124         *BITMAP_ADDR16(bitmap, y*10+i, x*10+8) =  bit;
125         *BITMAP_ADDR16(bitmap, y*10+i, x*10+9) =  bit;
126      }
127   }
128}
129
130void vt_video_update(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect)
131{
132   vt_video_t *vt = get_safe_token(device);
133
134   UINT16 addr = 0;
135    int line = 0;
136    int xpos = 0;
137    int ypos = 0;
138    UINT8 code;
139    int x = 0;
140    UINT8 scroll_region = 1; // binary 1
141    UINT8 display_type = 3;  // binary 11
142    UINT16 temp =0;
143   
144   if (devcb_call_read8(&vt->in_ram_func, 0) !=0x7f) return;
145     
146    while(line < (vt->height + vt->skip_lines)) {
147       code =  devcb_call_read8(&vt->in_ram_func, addr + xpos);
148       if (code == 0x7f) {
149          // end of line, fill empty till end of line
150          if (line >= vt->skip_lines) {
151             for(x = xpos; x < ((display_type==2) ? (vt->width / 2) : vt->width); x++ )
152            {
153               vt_video_display_char(device,bitmap,code,x,ypos,scroll_region,display_type);
154            }
155          }   
156          // move to new data   
157          temp = devcb_call_read8(&vt->in_ram_func, addr+xpos+1)*256 + devcb_call_read8(&vt->in_ram_func, addr+xpos+2);
158          addr = (temp) & 0x1fff;
159          // if A12 is 1 then it is 0x2000 block, if 0 then 0x4000 (AVO)
160          if (addr & 0x1000) addr &= 0xfff; else addr |= 0x2000;
161          scroll_region = (temp >> 15) & 1;
162          display_type  = (temp >> 13) & 3;
163          if (line >= vt->skip_lines) {
164             ypos++;
165          }
166          xpos=0;
167          line++;             
168       } else {
169          // display regular char
170          if (line >= vt->skip_lines) {
171            vt_video_display_char(device,bitmap,code,xpos,ypos,scroll_region,display_type);
172         }               
173         xpos++;
174         if (xpos > vt->width) {
175            line++;           
176            xpos=0;
177         }
178       }
179   }
180   
181}
182
183/*-------------------------------------------------
184    DEVICE_START( vt_video )
185-------------------------------------------------*/
186
187static DEVICE_START( vt_video )
188{
189   vt_video_t *vt = get_safe_token(device);
190   const vt_video_interface *intf = get_interface(device);
191
192   /* resolve callbacks */
193   devcb_resolve_read8(&vt->in_ram_func, &intf->in_ram_func, device);
194
195   /* get the screen device */
196   vt->screen = devtag_get_device(device->machine, intf->screen_tag);
197   assert(vt->screen != NULL);
198   
199     vt->gfx = memory_region(device->machine, intf->char_rom_region_tag);
200   assert(vt->gfx != NULL);
201   
202}
203
204static TIMER_CALLBACK(lba7_change)
205{
206   const device_config *device = ptr;
207   vt_video_t *vt = get_safe_token(device);
208
209   vt->lba7 = (vt->lba7) ? 0 : 1;
210}
211
212/*-------------------------------------------------
213    DEVICE_RESET( vt_video )
214-------------------------------------------------*/
215
216static DEVICE_RESET( vt_video )
217{
218   vt_video_t *vt = get_safe_token(device);
219   palette_set_color_rgb(device->machine, 0, 0x00, 0x00, 0x00); // black
220   palette_set_color_rgb(device->machine, 1, 0xff, 0xff, 0xff); // white
221
222   vt->skip_lines = 2; // for 60Hz
223   vt->width = 80;
224   vt->height = 24;
225   vt->lba7 = 0;
226
227   // LBA7 is scan line frequency update
228   timer_pulse(device->machine, ATTOTIME_IN_NSEC(31778), (void *) device, 0, lba7_change);   
229}
230
231/*-------------------------------------------------
232    DEVICE_GET_INFO( dc012 )
233-------------------------------------------------*/
234
235DEVICE_GET_INFO( vt100_video )
236{
237   switch (state)
238   {
239      /* --- the following bits of info are returned as 64-bit signed integers --- */
240      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(vt_video_t);               break;
241      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                           break;
242      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;            break;
243
244      /* --- the following bits of info are returned as pointers to data or functions --- */
245      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(vt_video);      break;
246      case DEVINFO_FCT_STOP:                     /* Nothing */                           break;
247      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(vt_video);      break;
248
249      /* --- the following bits of info are returned as NULL-terminated strings --- */
250      case DEVINFO_STR_NAME:                     strcpy(info->s, "VT100 Video");               break;
251      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "VTxxx Video");               break;
252      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
253      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                  break;
254      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");         break;
255   }
256}
src/mess/video/vtvideo.h
r0r4610
1/**********************************************************************
2
3    DEC VT Terminal video emulation
4    [ DC012 and DC011 emulation ]
5
6    01/05/2009 Initial implementation [Miodrag Milanovic]
7   
8    Copyright MESS Team.
9    Visit http://mamedev.org for licensing and usage restrictions.
10
11**********************************************************************/
12
13#ifndef __VT_VIDEO__
14#define __VT_VIDEO__
15
16#include "driver.h"
17#include "devcb.h"
18
19/***************************************************************************
20    MACROS / CONSTANTS
21***************************************************************************/
22
23#define VT100_VIDEO DEVICE_GET_INFO_NAME( vt100_video )
24
25#define MDRV_VT100_VIDEO_ADD(_tag, _intrf) \
26   MDRV_DEVICE_ADD(_tag, VT100_VIDEO, 0) \
27   MDRV_DEVICE_CONFIG(_intrf)
28/***************************************************************************
29    TYPE DEFINITIONS
30***************************************************************************/
31
32typedef struct _vt_video_interface vt_video_interface;
33struct _vt_video_interface
34{
35   const char *screen_tag;      /* screen we are acting on */
36   const char *char_rom_region_tag; /* character rom region */
37
38   /* this gets called for every memory read */
39   devcb_read8         in_ram_func;
40};
41
42/***************************************************************************
43    PROTOTYPES
44***************************************************************************/
45
46/* device interface */
47DEVICE_GET_INFO( vt100_video );
48
49/* register access */
50READ8_DEVICE_HANDLER  ( lba7_r );
51WRITE8_DEVICE_HANDLER ( dc012_w );
52WRITE8_DEVICE_HANDLER ( dc011_w );
53WRITE8_DEVICE_HANDLER ( vt_video_brightness_w );
54
55
56/* palette initialization */
57PALETTE_INIT( vt_video );
58
59/* screen update */
60void vt_video_update(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect);
61
62#endif
src/mess/messdriv.c
r4609r4610
11031103   DRIVER(ac1)    /* 1984 Amateurcomputer AC1            */
11041104   DRIVER(ac1_32)    /* 1984 Amateurcomputer AC1 (32 lines)   */
11051105
1106   /* DEC VT100 */
1107   DRIVER(vt100)
1108   
11061109   /* Ei Nis */
11071110   DRIVER(pecom64)
11081111
src/mess/mess.mak
r4609r4610
267267   $(MESSOBJ)/cpschngr.a \
268268   $(MESSOBJ)/cybiko.a \
269269   $(MESSOBJ)/dai.a \
270   $(MESSOBJ)/dec.a \
270271   $(MESSOBJ)/dgn_beta.a \
271272   $(MESSOBJ)/einis.a \
272273   $(MESSOBJ)/enterp.a \
r4609r4610
12811282   $(MESS_MACHINE)/ac1.o \
12821283   $(MESS_VIDEO)/ac1.o \
12831284
1285$(MESSOBJ)/dec.a:      \
1286   $(MESS_DRIVERS)/vt100.o \
1287   $(MESS_VIDEO)/vtvideo.o \
1288
12841289$(MESSOBJ)/grundy.a: \
12851290   $(MESS_DRIVERS)/newbrain.o \
12861291   $(MESS_VIDEO)/newbrain.o \
r4609r4610
13481353$(MESS_DRIVERS)/tec1.o:      $(MESS_LAYOUT)/tec1.lh
13491354$(MESS_DRIVERS)/ut88.o:      $(MESS_LAYOUT)/ut88mini.lh
13501355$(MESS_DRIVERS)/votrpss.o:   $(MESS_LAYOUT)/votrpss.lh
1356$(MESS_DRIVERS)/vt100.o:   $(MESS_LAYOUT)/vt100.lh
13511357$(MESS_DRIVERS)/x68k.o:      $(MESS_LAYOUT)/x68000.lh
13521358$(MESS_DRIVERS)/z80ne.o:   $(MESS_LAYOUT)/z80ne.lh   \
13531359                     $(MESS_LAYOUT)/z80net.lh  \
src/mess/layout/vt100.lay
r0r4610
1<!-- Basic display of LEDs for the DEC VT100 -->
2
3<mamelayout version="2">
4
5   <element name="red_led">
6      <disk>
7         <color red="1.0" green="0.0" blue="0.0" />
8      </disk>
9   </element>
10   
11   <element name="ON_LINE">
12      <text string="ON LINE">
13         <color red="1.0" green="1.0" blue="1.0" />
14      </text>
15   </element>
16   <element name="LOCAL">
17      <text string="LOCAL">
18         <color red="1.0" green="1.0" blue="1.0" />
19      </text>
20   </element>
21   <element name="KBDLOCKED">
22      <text string="KBDLOCKED">
23         <color red="1.0" green="1.0" blue="1.0" />
24      </text>
25   </element>
26   <element name="L1">
27      <text string="L1">
28         <color red="1.0" green="1.0" blue="1.0" />
29      </text>
30   </element>
31   <element name="L2">
32      <text string="L2">
33         <color red="1.0" green="1.0" blue="1.0" />
34      </text>
35   </element>
36   <element name="L3">
37      <text string="L3">
38         <color red="1.0" green="1.0" blue="1.0" />
39      </text>
40   </element>
41   <element name="L4">
42      <text string="L4">
43         <color red="1.0" green="1.0" blue="1.0" />
44      </text>
45   </element>
46   <element name="background">
47      <rect>
48         <bounds left="0" top="0" right="1" bottom="1" />
49         <color red="0.0" green="0.0" blue="0.0" />
50      </rect>
51   </element>
52   
53   <view name="Keyboard LED's">
54      <bezel name="online_txt" element="ON_LINE">
55         <bounds left="0" right="100" top="800" bottom="820" />
56      </bezel>
57      <bezel name="online_led" element="red_led">
58         <bounds left="40" right="60" top="830" bottom="850" />
59      </bezel>
60
61      <bezel name="local_txt" element="LOCAL">
62         <bounds left="100" right="200" top="800" bottom="820" />
63      </bezel>
64      <bezel name="local_led" element="red_led">
65         <bounds left="140" right="160" top="830" bottom="850" />
66      </bezel>
67
68      <bezel name="locked_txt" element="KBDLOCKED">
69         <bounds left="200" right="300" top="800" bottom="820" />
70      </bezel>
71      <bezel name="locked_led" element="red_led">
72         <bounds left="240" right="260" top="830" bottom="850" />
73      </bezel>
74
75      <bezel name="l1_txt" element="L1">
76         <bounds left="300" right="400" top="800" bottom="820" />
77      </bezel>
78      <bezel name="l1_led" element="red_led">
79         <bounds left="340" right="360" top="830" bottom="850" />
80      </bezel>
81
82      <bezel name="l2_txt" element="L2">
83         <bounds left="400" right="500" top="800" bottom="820" />
84      </bezel>
85      <bezel name="l2_led" element="red_led">
86         <bounds left="440" right="460" top="830" bottom="850" />
87      </bezel>
88
89      <bezel name="l3_txt" element="L3">
90         <bounds left="500" right="600" top="800" bottom="820" />
91      </bezel>
92      <bezel name="l3_led" element="red_led">
93         <bounds left="540" right="560" top="830" bottom="850" />
94      </bezel>
95
96      <bezel name="l4_txt" element="L4">
97         <bounds left="600" right="700" top="800" bottom="820" />
98      </bezel>
99      <bezel name="l4_led" element="red_led">
100         <bounds left="640" right="660" top="830" bottom="850" />
101      </bezel>
102      <bezel element="background">
103         <bounds left="0" top="850" right="1024" bottom="870" />
104      </bezel>
105      <screen index="0">
106         <bounds x="0" y="0" width="1024" height="768" />
107      </screen>
108   </view>
109
110</mamelayout>
src/mess/drivers/vt100.c
r0r4610
1/***************************************************************************
2
3        DEC VT100 driver by Miodrag Milanovic
4
5        29/04/2009 Preliminary driver.
6
7****************************************************************************/
8
9
10#include "driver.h"
11#include "cpu/i8085/i8085.h"
12#include "sound/speaker.h"
13#include "video/vtvideo.h"
14#include "vt100.lh"
15
16UINT8 *vt100_ram;
17UINT8 vt100_keyboard_int;
18UINT8 vt100_receiver_int;
19UINT8 vt100_vertical_int;
20
21double vt100_send_baud_rate;
22double vt100_recv_baud_rate;
23
24static ADDRESS_MAP_START(vt100_mem, ADDRESS_SPACE_PROGRAM, 8)
25   ADDRESS_MAP_UNMAP_HIGH
26    AM_RANGE( 0x0000, 0x1fff ) AM_ROM  // ROM ( 4 * 2K)
27    AM_RANGE( 0x2000, 0x2bff ) AM_RAM AM_BASE(&vt100_ram) // Screen and scratch RAM
28    AM_RANGE( 0x2c00, 0x2fff ) AM_RAM  // AVO Screen RAM
29    AM_RANGE( 0x3000, 0x3fff ) AM_RAM  // AVO Attribute RAM (4 bits wide)
30    // 0x4000, 0x7fff is unassigned
31    AM_RANGE( 0x8000, 0x9fff ) AM_ROM  // Program memory expansion ROM (4 * 2K)
32    AM_RANGE( 0xa000, 0xbfff ) AM_ROM  // Program memory expansion ROM (1 * 8K)
33    // 0xc000, 0xffff is unassigned
34ADDRESS_MAP_END
35
36// 0 - XMIT flag H
37// 1 - Advance Video L
38// 2 - Graphics Flag L
39// 3 - Option present H
40// 4 - Even field L
41// 5 - NVR data H
42// 6 - LBA 7 H
43// 7 - Keyboard TBMT H
44static READ8_HANDLER(vt100_flags_r)
45{
46   UINT8 retVal = 0;   
47   retVal |=  lba7_r(devtag_get_device(space->machine, "vt100_video"),0) * 0x40;   
48   return retVal;
49}
50
51UINT8 vt100_key_scan = 0;
52
53static TIMER_CALLBACK(keyboard_callback)
54{
55   int i;
56   static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3",
57                                 "LINE4", "LINE5", "LINE6", "LINE7",
58                                 "LINE8", "LINE9", "LINEA", "LINEB",
59                                 "LINEC", "LINED", "LINEE", "LINEF" };
60   UINT8 code;
61   if (vt100_key_scan == 1) {
62      for(i = 0; i < 16; i++)
63      {
64         code =    input_port_read(machine, keynames[i]);
65         if (code!=0xff) {
66            vt100_keyboard_int = 1;
67            cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
68         }
69      }
70   }
71}
72
73
74static WRITE8_HANDLER(vt100_keyboard_w)
75{
76   
77   const device_config *speaker = devtag_get_device(space->machine, "speaker");
78   
79   output_set_value("online_led",BIT(data,5) ? 0 : 1);
80   output_set_value("local_led", BIT(data,5));
81   output_set_value("locked_led",BIT(data,4) ? 0 : 1);
82   output_set_value("l1_led",      BIT(data,3) ? 0 : 1);
83   output_set_value("l2_led",      BIT(data,2) ? 0 : 1);
84   output_set_value("l3_led",      BIT(data,1) ? 0 : 1);
85   output_set_value("l4_led",      BIT(data,0) ? 0 : 1);   
86   vt100_key_scan = BIT(data,6);
87   speaker_level_w(speaker, BIT(data,7));
88}
89
90static READ8_HANDLER(vt100_keyboard_r)
91{
92   return 0xff;
93}
94static WRITE8_HANDLER(vt100_baud_rate_w)
95{
96   double baud_rate[] = { 50, 75, 110, 134.5, 150, 200, 300, 600, 1200,
97      1800, 2000, 2400, 3600, 4800, 9600, 19200 };
98   
99   vt100_send_baud_rate = baud_rate[(data >>4) & 0x0f];
100   vt100_recv_baud_rate = baud_rate[data & 0x0f];
101}
102
103static ADDRESS_MAP_START( vt100_io , ADDRESS_SPACE_IO, 8)
104   ADDRESS_MAP_UNMAP_HIGH
105   // 0x00, 0x01 PUSART  (Intel 8251)   
106   // AM_RANGE (0x00, 0x01)
107   // 0x02 Baud rate generator   
108   AM_RANGE (0x02, 0x02) AM_WRITE(vt100_baud_rate_w)
109   // 0x22 Modem buffer
110   // AM_RANGE (0x22, 0x22)
111   // 0x42 Flags buffer
112   AM_RANGE (0x42, 0x42) AM_READ(vt100_flags_r)
113   // 0x42 Brightness D/A latch
114   AM_RANGE (0x42, 0x42) AM_DEVWRITE("vt100_video", vt_video_brightness_w)
115   // 0x62 NVR latch
116   // AM_RANGE (0x62, 0x62)
117   // 0x82 Keyboard UART data output
118   AM_RANGE (0x82, 0x82) AM_READ(vt100_keyboard_r)
119   // 0x82 Keyboard UART data input
120   AM_RANGE (0x82, 0x82) AM_WRITE(vt100_keyboard_w)
121   // 0xA2 Video processor DC012
122   AM_RANGE (0xa2, 0xa2) AM_DEVWRITE("vt100_video", dc012_w)
123   // 0xC2 Video processor DC011
124   AM_RANGE (0xc2, 0xc2) AM_DEVWRITE("vt100_video", dc011_w)
125   // 0xE2 Graphics port
126   // AM_RANGE (0xe2, 0xe2)
127ADDRESS_MAP_END
128
129/* Input ports */
130INPUT_PORTS_START( vt100 )
131   PORT_START("LINE0")
132      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
133      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT)
134      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT)
135      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP)
136      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 7") PORT_CODE(KEYCODE_7_PAD)
137      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 8") PORT_CODE(KEYCODE_8_PAD)
138      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num .") PORT_CODE(KEYCODE_DEL_PAD)
139      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 9") PORT_CODE(KEYCODE_9_PAD)
140   PORT_START("LINE1")
141      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
142      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
143      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
144      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF3") PORT_CODE(KEYCODE_F3)
145      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF4") PORT_CODE(KEYCODE_F4)
146      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num Enter") PORT_CODE(KEYCODE_ENTER_PAD)
147      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num ,") PORT_CODE(KEYCODE_PLUS_PAD)
148      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 3") PORT_CODE(KEYCODE_3_PAD)
149   PORT_START("LINE2")
150      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
151      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
152      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN)
153      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF1") PORT_CODE(KEYCODE_F1)
154      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2)
155      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 2") PORT_CODE(KEYCODE_2_PAD)
156      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 5") PORT_CODE(KEYCODE_5_PAD)
157      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 6") PORT_CODE(KEYCODE_6_PAD)
158   PORT_START("LINE3")
159      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL)
160      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
161      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_F6)
162      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE)
163      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 0") PORT_CODE(KEYCODE_0_PAD)
164      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 1") PORT_CODE(KEYCODE_1_PAD)
165      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 4") PORT_CODE(KEYCODE_4_PAD)
166      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num -") PORT_CODE(KEYCODE_MINUS_PAD)
167   PORT_START("LINE4")
168      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER)
169      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE)
170      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("~") PORT_CODE(KEYCODE_TILDE)
171      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS)
172      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Line feed") PORT_CODE(KEYCODE_RALT)
173      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
174      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER)
175      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
176   PORT_START("LINE5")
177      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P)
178      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE)
179      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS)
180      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0)
181      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH)
182      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA)
183      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP)
184      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH)
185   PORT_START("LINE6")
186      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O)
187      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I)
188      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9)
189      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8)
190      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L)
191      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON)
192      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE)
193      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M)
194   PORT_START("LINE7")
195      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V)
196      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U)
197      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7)
198      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6)
199      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K)
200      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J)
201      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N)
202      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE)
203   PORT_START("LINE8")
204      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T)
205      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R)
206      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4)
207      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5)
208      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G)
209      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H)
210      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B)
211      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V)
212   PORT_START("LINE9")
213      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W)
214      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E)
215      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3)
216      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2)
217      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F)
218      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D)
219      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X)
220      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C)
221   PORT_START("LINEA")
222      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q)
223      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1)
224      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC)
225      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB)
226      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A)
227      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S)
228      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("No scroll") PORT_CODE(KEYCODE_LALT)
229      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z)
230   PORT_START("LINEB")
231      PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED)
232      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Setup") PORT_CODE(KEYCODE_F5)
233   PORT_START("LINEC")
234      PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED)
235      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL)
236   PORT_START("LINED")
237      PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED)
238      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT)
239   PORT_START("LINEE")
240      PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED)
241      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps lock") PORT_CODE(KEYCODE_CAPSLOCK)
242   PORT_START("LINEF")
243      PORT_BIT(0x7F, IP_ACTIVE_LOW,  IPT_UNUSED)
244      PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) // Always return 0x7f on last scan line
245INPUT_PORTS_END
246
247VIDEO_UPDATE( vt100 )
248{
249   const device_config   *devconf = devtag_get_device(screen->machine, "vt100_video");
250   vt_video_update( devconf, bitmap, cliprect);
251   return 0;
252}
253
254
255//Interrupts
256// in latch A3 - keyboard
257//          A4 - receiver
258//          A5 - vertical fequency
259//          all other set to 1
260static IRQ_CALLBACK(vt100_irq_callback)
261{   
262   UINT8 retVal = 0xc7 | (0x08 * vt100_keyboard_int) | (0x10 * vt100_receiver_int) | (0x20 * vt100_vertical_int);
263   vt100_keyboard_int = 0;
264   vt100_receiver_int = 0;
265   vt100_vertical_int = 0;
266
267   return retVal;
268}
269
270static MACHINE_RESET(vt100)
271{
272   vt100_keyboard_int = 0;
273   vt100_receiver_int = 0;
274   vt100_vertical_int = 0;
275   output_set_value("online_led",1);
276   output_set_value("local_led", 1);
277   output_set_value("locked_led",1);
278   output_set_value("l1_led",      1);
279   output_set_value("l2_led",      1);
280   output_set_value("l3_led",      1);
281   output_set_value("l4_led",      1);   
282   
283   vt100_key_scan = 0;
284   timer_pulse(machine, ATTOTIME_IN_HZ(24), NULL, 0, keyboard_callback);   
285   
286   cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), vt100_irq_callback);   
287}
288
289static READ8_DEVICE_HANDLER (vt100_read_video_ram_r )
290{
291   return vt100_ram[offset];
292}
293
294const vt_video_interface vt100_video_interface = {
295   "screen",
296   "gfx1",
297   DEVCB_HANDLER(vt100_read_video_ram_r)
298};
299
300INTERRUPT_GEN( vt100_vertical_interrupt )
301{
302   vt100_vertical_int = 1;
303   cpu_set_input_line(device, 0, HOLD_LINE);
304}
305
306#define XTAL_24_8832MHz    24883200
307
308static MACHINE_DRIVER_START( vt100 )
309   /* basic machine hardware */
310   MDRV_CPU_ADD("maincpu",8080, XTAL_24_8832MHz / 9)
311   MDRV_CPU_PROGRAM_MAP(vt100_mem, 0)
312   MDRV_CPU_IO_MAP(vt100_io, 0)   
313   MDRV_CPU_VBLANK_INT("screen", vt100_vertical_interrupt)
314
315   MDRV_MACHINE_RESET(vt100)
316   
317    /* video hardware */
318   MDRV_SCREEN_ADD("screen", RASTER)
319   MDRV_SCREEN_REFRESH_RATE(60)
320   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
321   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
322   MDRV_SCREEN_SIZE(80*10, 24*10)
323   MDRV_SCREEN_VISIBLE_AREA(0, 80*10-1, 0, 24*10-1)
324   MDRV_PALETTE_LENGTH(2)
325   MDRV_PALETTE_INIT(black_and_white)
326
327   MDRV_DEFAULT_LAYOUT( layout_vt100 )
328   MDRV_VIDEO_START(generic_bitmapped)
329   MDRV_VIDEO_UPDATE(vt100)
330   
331   MDRV_VT100_VIDEO_ADD("vt100_video", vt100_video_interface)
332   
333   /* audio hardware */
334   MDRV_SPEAKER_STANDARD_MONO("mono")
335   MDRV_SOUND_ADD("speaker", SPEAKER, 0)
336   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
337MACHINE_DRIVER_END
338
339/* ROM definition */
340ROM_START( vt100 )
341   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
342   ROM_LOAD( "23-061e2.bin", 0x0000, 0x0800, CRC(3dae97ff) SHA1(e3437850c33565751b86af6c2fe270a491246d15)) // bug fixed version
343   ROM_LOAD( "23-032e2.bin", 0x0800, 0x0800, CRC(3d86db99) SHA1(cdd8bdecdc643442f6e7d2c83cf002baf8101867))
344   ROM_LOAD( "23-033e2.bin", 0x1000, 0x0800, CRC(384dac0a) SHA1(22aaf5ab5f9555a61ec43f91d4dea3029f613e64))
345   ROM_LOAD( "23-034e2.bin", 0x1800, 0x0800, CRC(4643184d) SHA1(27e6c19d9932bf13fdb70305ef4d806e90d60833))
346   ROM_REGION(0x0800, "gfx1",0)
347   ROM_LOAD ("23-018e2.bin", 0x0000, 0x0800, CRC(0e41f551) SHA1(d6762aaa2c8090ac4c0726ef8aeaea1afdc66281)) // needs redump
348ROM_END
349
350/* Driver */
351
352/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    CONFIG COMPANY   FULLNAME       FLAGS */
353COMP( 1979, vt100,  0,       0,    vt100,       vt100,     0,       0,      "DEC",   "VT100",      GAME_NOT_WORKING)
docs/messnew.txt
r4609r4610
1313  Gerhardt, Wilbert Pol]
1414- Dick Smith Wizzard [Curt Coder]
1515- Dick Smith VZ 2000 [Curt Coder]
16- DEC VT100 (not working) [Miodrag Milanovic]
1617- Hanimex Rameses [Curt Coder]
1718- Kaypro II (Model 2/83) (not working)  [Robbbert]
1819- Kaypro 4 (Model 4/83) (not working)  [Robbbert]

Previous 15994 Revisions Next


© 1998-2018 The MESS Team