Previous 15994 Revisions Next

r5226 Tuesday 14th July, 2009 at 10:52:17 UTC by Curt Coder
[V1050] Fixed interrupts, system is now working.
[src/mess/drivers]v1050.c
[src/mess/machine]i8214.c
[src/mess/video]v1050.c

src/mess/video/v1050.c
r5225r5226
22#include "includes/v1050.h"
33#include "video/mc6845.h"
44
5/*
6
7   TODO:
8
9   - bright in reverse video
10
11*/
12
513#define V1050_ATTR_BRIGHT   0x01
614#define V1050_ATTR_BLINKING   0x02
715#define V1050_ATTR_ATTEN   0x04
r5225r5226
5765   v1050_state *state = device->machine->driver_data;
5866
5967   int column, bit;
60   UINT8 data;
6168
6269   for (column = 0; column < x_count; column++)
6370   {
6471      UINT16 address = (((ra & 0x03) + 1) << 13) | ((ma & 0x1fff) + column);
72      UINT8 data = state->video_ram[address & V1050_VIDEORAM_MASK];
73      UINT8 attr = (state->attr & 0xfc) | (state->attr_ram[address] & 0x03);
6574
66      data = state->video_ram[address & V1050_VIDEORAM_MASK];
67
6875      for (bit = 0; bit < 8; bit++)
6976      {
7077         int x = (column * 8) + bit;
7178         int color = BIT(data, 7);
7279
7380         /* blinking */
74         if ((state->attr_ram[address] & V1050_ATTR_BLINKING) && !(state->attr & V1050_ATTR_BLINK)) color = 0;
81         if ((attr & V1050_ATTR_BLINKING) && !(attr & V1050_ATTR_BLINK)) color = 0;
7582
7683         /* reverse video */
77         color ^= BIT(state->attr, 4);
84         color ^= BIT(attr, 4);
7885
79         /* blank video */
80         if (state->attr & V1050_ATTR_BLANK) color = 0;
81
8286         /* bright */
83         if (color && ((state->attr & V1050_ATTR_BOLD) ^ (state->attr_ram[address] & V1050_ATTR_BRIGHT))) color = 2;
87         if (color && (!(attr & V1050_ATTR_BOLD) ^ (attr & V1050_ATTR_BRIGHT))) color = 2;
8488
89         /* display blank */
90         if (attr & V1050_ATTR_BLANK) color = 0;
91
8592         *BITMAP_ADDR16(bitmap, y, x) = color;
8693
8794         data <<= 1;
r5225r5226
9198
9299static WRITE_LINE_DEVICE_HANDLER( v1050_vsync_changed )
93100{
94   if (state)
95   {
96      cputag_set_input_line(device->machine, M6502_TAG, INPUT_LINE_IRQ0, ASSERT_LINE);
97      v1050_set_int(device->machine, INT_VSYNC, 1);
98   }
101   cputag_set_input_line(device->machine, M6502_TAG, INPUT_LINE_IRQ0, state ? ASSERT_LINE : CLEAR_LINE);
102   v1050_set_int(device->machine, INT_VSYNC, state);
99103}
100104
101105static const mc6845_interface v1050_mc6845_intf =
r5225r5226
117121static PALETTE_INIT( v1050 )
118122{
119123   palette_set_color(machine, 0, RGB_BLACK); /* black */
120   palette_set_color_rgb(machine, 1, 0x00, 0x80, 0x00); /* green */
124   palette_set_color_rgb(machine, 1, 0x00, 0xc0, 0x00); /* green */
121125   palette_set_color_rgb(machine, 2, 0x00, 0xff, 0x00); /* bright green */
122126}
123127
src/mess/machine/i8214.c
r5225r5226
3636
3737   int inte;               /* interrupt enable */
3838   int int_dis;            /* interrupt disable flip-flop */
39   int latch;               /* interrupt latch */
4039   int a;                  /* request level */
4140   int b;                  /* current status register */
42   UINT8 r;               /* interrupt requests */
41   UINT8 r;               /* interrupt request latch */
4342   int sgs;               /* status group select */
4443   int etlg;               /* enable this level group */
4544};
r5225r5226
7877
7978   for (level = 7; level >= 0; level--)
8079   {
81      if (!BIT(i8214->r, level))
80      if (!BIT(i8214->r, 7 - level))
8281      {
83         /* latch interrupt level */
84         i8214->latch = level;
85
8682         if (i8214->sgs)
8783         {
8884            if (level > i8214->b)
r5225r5226
110106{
111107   i8214_t *i8214 = get_safe_token(device);
112108
113   UINT8 a = ~i8214->a & 0x07;
109   UINT8 a = i8214->a & 0x07;
114110
115111   i8214->int_dis = 0;
116112   check_interrupt(device);
r5225r5226
124120{
125121   i8214_t *i8214 = get_safe_token(device);
126122
127   i8214->b = ~data & 0x07;
123   i8214->b = data & 0x07;
128124
129125   if (LOG) logerror("I8214 '%s' B: %01x\n", device->tag, i8214->b);
130126
r5225r5226
136132   i8214_t *i8214 = get_safe_token(device);
137133
138134   if (LOG) logerror("I8214 '%s' ELR: %u\n", device->tag, state);
139
140   if (state)
141   {
142      i8214->a = 0;
143      i8214->b = 0;
144      i8214->sgs = 0;
145
146      check_interrupt(device);
147   }
148135}
149136
150137WRITE_LINE_DEVICE_HANDLER( i8214_etlg_w )
r5225r5226
203190   /* register for state saving */
204191   state_save_register_device_item(device, 0, i8214->inte);
205192   state_save_register_device_item(device, 0, i8214->int_dis);
206   state_save_register_device_item(device, 0, i8214->latch);
207193   state_save_register_device_item(device, 0, i8214->a);
208194   state_save_register_device_item(device, 0, i8214->b);
209195   state_save_register_device_item(device, 0, i8214->r);
src/mess/drivers/v1050.c
r5225r5226
100100      Device 'u76': warning - attempt to direct-map address 00001FFE in program space
101101      Device 'u76': warning - attempt to direct-map address 00001FFF in program space
102102
103   - keyboard hack
104103   - rombank1,2 to 0-0x1fff
105   - interrupts
106104   - real keyboard w/i8049
107   - Winchester (Xebec S1410 controller)
105   - Winchester (Tandon TM501, CMI 5412 10MB drive on Xebec S1410 controller)
108106
109107*/
110108
r5225r5226
284282            {
285283               state->keydata = keydata;
286284               state->keyavail = 1;
287               /* logerror("Scanned: 0x%x %d %d %d", keydata, table, row, col); */
285               /* //logerror("Scanned: 0x%x %d %d %d", keydata, table, row, col); */
288286               v1050_set_int(machine, INT_KEYBOARD, 1);
289287               return;
290288            }
r5225r5226
326324{
327325   v1050_state *state = space->machine->driver_data;
328326
329   return 0xf0 | (i8214_a_r(state->i8214, 0) << 1);
327   return 0xf0 | (i8214_a_r(state->i8214, 0) << 1) | 0x01;
330328}
331329
332330static WRITE8_HANDLER( v1050_i8214_w )
r5225r5226
898896   /* baud select */
899897   if (baud_sel != state->baud_sel)
900898   {
901      attotime period;
899      attotime period = attotime_never;
902900
903901      switch (baud_sel)
904902      {
r5225r5226
946944   v1050_state *state = device->machine->driver_data;
947945
948946   state->int_mask = data;
949
950   logerror("Interrupt Mask: %02x\n", data);
951947}
952948
953949static READ8_DEVICE_HANDLER( rtc_8255_c_r )
r5225r5226
10681064
10691065static WD17XX_CALLBACK( v1050_mb8877_callback )
10701066{
1071   switch (state)
1067   v1050_state *driver_state = device->machine->driver_data;
1068
1069   if (driver_state->f_int_enb)
10721070   {
1073   case WD17XX_IRQ_CLR:
1074      v1050_set_int(device->machine, INT_FLOPPY, 0);
1075      break;
1071      switch (state)
1072      {
1073      case WD17XX_IRQ_CLR:
1074         v1050_set_int(device->machine, INT_FLOPPY, 0);
1075         break;
10761076
1077   case WD17XX_IRQ_SET:
1078      v1050_set_int(device->machine, INT_FLOPPY, 1);
1079      break;
1077      case WD17XX_IRQ_SET:
1078         v1050_set_int(device->machine, INT_FLOPPY, 1);
1079         break;
10801080
1081   case WD17XX_DRQ_CLR:
1082      cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_NMI, CLEAR_LINE);
1083      break;
1081      case WD17XX_DRQ_CLR:
1082         cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_NMI, CLEAR_LINE);
1083         break;
10841084
1085   case WD17XX_DRQ_SET:
1086      cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_NMI, ASSERT_LINE);
1087      break;
1085      case WD17XX_DRQ_SET:
1086         cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_NMI, ASSERT_LINE);
1087         break;
1088      }
10881089   }
1090   else
1091   {
1092      v1050_set_int(device->machine, INT_FLOPPY, 0);
1093      cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_NMI, CLEAR_LINE);
1094   }
10891095}
10901096
10911097static const wd17xx_interface v1050_wd17xx_intf =
r5225r5226
10951101
10961102/* Machine Initialization */
10971103
1104static IRQ_CALLBACK( v1050_int_ack )
1105{
1106   v1050_state *state = device->machine->driver_data;
1107
1108   UINT8 vector = 0xf0 | (i8214_a_r(state->i8214, 0) << 1);
1109
1110   //logerror("Interrupt Acknowledge Vector: %02x\n", vector);
1111
1112   cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_IRQ0, CLEAR_LINE);
1113
1114   return vector;
1115}
1116
10981117static MACHINE_START( v1050 )
10991118{
11001119   v1050_state *state = machine->driver_data;
r5225r5226
11121131   state->centronics = devtag_get_device(machine, CENTRONICS_TAG);
11131132
11141133   /* initialize I8214 */
1134   i8214_elr_w(state->i8214, 0);
11151135   i8214_etlg_w(state->i8214, 1);
11161136   i8214_inte_w(state->i8214, 1);
11171137   
11181138   /* initialize RTC */
11191139   msm58321_cs1_w(state->msm58321, 1);
11201140
1141   /* set CPU interrupt callback */
1142   cpu_set_irq_callback(cputag_get_cpu(machine, Z80_TAG), v1050_int_ack);
1143
11211144   /* setup memory banking */
11221145   memory_configure_bank(machine, 1, 0, 2, mess_ram, 0x10000);
11231146   memory_configure_bank(machine, 1, 2, 1, mess_ram + 0x1c000, 0);
r5225r5226
11691192
11701193   MDRV_MACHINE_START(v1050)
11711194
1172   /* keyboard */
1195   /* keyboard HACK */
11731196   MDRV_TIMER_ADD_PERIODIC("keyboard", v1050_keyboard_tick, HZ(60))
11741197
11751198    /* video hardware */
r5225r5226
12221245   switch (state)
12231246   {
12241247      /* --- the following bits of info are returned as 64-bit signed integers --- */
1225      case MESS_DEVINFO_INT_COUNT:               info->i = 2; break;
1248      case MESS_DEVINFO_INT_COUNT:         info->i = 2; break;
12261249
12271250      /* --- the following bits of info are returned as pointers to data or functions --- */
12281251      case MESS_DEVINFO_PTR_FLOPPY_OPTIONS:   info->p = (void *) floppyoptions_v1050; break;
r5225r5226
12391262/* System Drivers */
12401263
12411264/*    YEAR   NAME   PARENT   COMPAT   MACHINE   INPUT   INIT   CONFIG   COMPANY                        FULLNAME      FLAGS */
1242COMP( 1983, v1050,   0,      0,      v1050,   v1050,   0,      v1050,   "Visual Technology Incorporated",   "Visual 1050",   GAME_NOT_WORKING )
1265COMP( 1983, v1050,   0,      0,      v1050,   v1050,   0,      v1050,   "Visual Technology Incorporated",   "Visual 1050",   GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team