src/mess/video/v1050.c
| r5225 | r5226 | |
| 2 | 2 | #include "includes/v1050.h" |
| 3 | 3 | #include "video/mc6845.h" |
| 4 | 4 | |
| 5 | /* |
| 6 | |
| 7 | TODO: |
| 8 | |
| 9 | - bright in reverse video |
| 10 | |
| 11 | */ |
| 12 | |
| 5 | 13 | #define V1050_ATTR_BRIGHT 0x01 |
| 6 | 14 | #define V1050_ATTR_BLINKING 0x02 |
| 7 | 15 | #define V1050_ATTR_ATTEN 0x04 |
| r5225 | r5226 | |
| 57 | 65 | v1050_state *state = device->machine->driver_data; |
| 58 | 66 | |
| 59 | 67 | int column, bit; |
| 60 | | UINT8 data; |
| 61 | 68 | |
| 62 | 69 | for (column = 0; column < x_count; column++) |
| 63 | 70 | { |
| 64 | 71 | 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); |
| 65 | 74 | |
| 66 | | data = state->video_ram[address & V1050_VIDEORAM_MASK]; |
| 67 | | |
| 68 | 75 | for (bit = 0; bit < 8; bit++) |
| 69 | 76 | { |
| 70 | 77 | int x = (column * 8) + bit; |
| 71 | 78 | int color = BIT(data, 7); |
| 72 | 79 | |
| 73 | 80 | /* 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; |
| 75 | 82 | |
| 76 | 83 | /* reverse video */ |
| 77 | | color ^= BIT(state->attr, 4); |
| 84 | color ^= BIT(attr, 4); |
| 78 | 85 | |
| 79 | | /* blank video */ |
| 80 | | if (state->attr & V1050_ATTR_BLANK) color = 0; |
| 81 | | |
| 82 | 86 | /* 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; |
| 84 | 88 | |
| 89 | /* display blank */ |
| 90 | if (attr & V1050_ATTR_BLANK) color = 0; |
| 91 | |
| 85 | 92 | *BITMAP_ADDR16(bitmap, y, x) = color; |
| 86 | 93 | |
| 87 | 94 | data <<= 1; |
| r5225 | r5226 | |
| 91 | 98 | |
| 92 | 99 | static WRITE_LINE_DEVICE_HANDLER( v1050_vsync_changed ) |
| 93 | 100 | { |
| 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); |
| 99 | 103 | } |
| 100 | 104 | |
| 101 | 105 | static const mc6845_interface v1050_mc6845_intf = |
| r5225 | r5226 | |
| 117 | 121 | static PALETTE_INIT( v1050 ) |
| 118 | 122 | { |
| 119 | 123 | 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 */ |
| 121 | 125 | palette_set_color_rgb(machine, 2, 0x00, 0xff, 0x00); /* bright green */ |
| 122 | 126 | } |
| 123 | 127 | |
src/mess/machine/i8214.c
| r5225 | r5226 | |
| 36 | 36 | |
| 37 | 37 | int inte; /* interrupt enable */ |
| 38 | 38 | int int_dis; /* interrupt disable flip-flop */ |
| 39 | | int latch; /* interrupt latch */ |
| 40 | 39 | int a; /* request level */ |
| 41 | 40 | int b; /* current status register */ |
| 42 | | UINT8 r; /* interrupt requests */ |
| 41 | UINT8 r; /* interrupt request latch */ |
| 43 | 42 | int sgs; /* status group select */ |
| 44 | 43 | int etlg; /* enable this level group */ |
| 45 | 44 | }; |
| r5225 | r5226 | |
| 78 | 77 | |
| 79 | 78 | for (level = 7; level >= 0; level--) |
| 80 | 79 | { |
| 81 | | if (!BIT(i8214->r, level)) |
| 80 | if (!BIT(i8214->r, 7 - level)) |
| 82 | 81 | { |
| 83 | | /* latch interrupt level */ |
| 84 | | i8214->latch = level; |
| 85 | | |
| 86 | 82 | if (i8214->sgs) |
| 87 | 83 | { |
| 88 | 84 | if (level > i8214->b) |
| r5225 | r5226 | |
| 110 | 106 | { |
| 111 | 107 | i8214_t *i8214 = get_safe_token(device); |
| 112 | 108 | |
| 113 | | UINT8 a = ~i8214->a & 0x07; |
| 109 | UINT8 a = i8214->a & 0x07; |
| 114 | 110 | |
| 115 | 111 | i8214->int_dis = 0; |
| 116 | 112 | check_interrupt(device); |
| r5225 | r5226 | |
| 124 | 120 | { |
| 125 | 121 | i8214_t *i8214 = get_safe_token(device); |
| 126 | 122 | |
| 127 | | i8214->b = ~data & 0x07; |
| 123 | i8214->b = data & 0x07; |
| 128 | 124 | |
| 129 | 125 | if (LOG) logerror("I8214 '%s' B: %01x\n", device->tag, i8214->b); |
| 130 | 126 | |
| r5225 | r5226 | |
| 136 | 132 | i8214_t *i8214 = get_safe_token(device); |
| 137 | 133 | |
| 138 | 134 | 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 | | } |
| 148 | 135 | } |
| 149 | 136 | |
| 150 | 137 | WRITE_LINE_DEVICE_HANDLER( i8214_etlg_w ) |
| r5225 | r5226 | |
| 203 | 190 | /* register for state saving */ |
| 204 | 191 | state_save_register_device_item(device, 0, i8214->inte); |
| 205 | 192 | state_save_register_device_item(device, 0, i8214->int_dis); |
| 206 | | state_save_register_device_item(device, 0, i8214->latch); |
| 207 | 193 | state_save_register_device_item(device, 0, i8214->a); |
| 208 | 194 | state_save_register_device_item(device, 0, i8214->b); |
| 209 | 195 | state_save_register_device_item(device, 0, i8214->r); |
src/mess/drivers/v1050.c
| r5225 | r5226 | |
| 100 | 100 | Device 'u76': warning - attempt to direct-map address 00001FFE in program space |
| 101 | 101 | Device 'u76': warning - attempt to direct-map address 00001FFF in program space |
| 102 | 102 | |
| 103 | | - keyboard hack |
| 104 | 103 | - rombank1,2 to 0-0x1fff |
| 105 | | - interrupts |
| 106 | 104 | - real keyboard w/i8049 |
| 107 | | - Winchester (Xebec S1410 controller) |
| 105 | - Winchester (Tandon TM501, CMI 5412 10MB drive on Xebec S1410 controller) |
| 108 | 106 | |
| 109 | 107 | */ |
| 110 | 108 | |
| r5225 | r5226 | |
| 284 | 282 | { |
| 285 | 283 | state->keydata = keydata; |
| 286 | 284 | 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); */ |
| 288 | 286 | v1050_set_int(machine, INT_KEYBOARD, 1); |
| 289 | 287 | return; |
| 290 | 288 | } |
| r5225 | r5226 | |
| 326 | 324 | { |
| 327 | 325 | v1050_state *state = space->machine->driver_data; |
| 328 | 326 | |
| 329 | | return 0xf0 | (i8214_a_r(state->i8214, 0) << 1); |
| 327 | return 0xf0 | (i8214_a_r(state->i8214, 0) << 1) | 0x01; |
| 330 | 328 | } |
| 331 | 329 | |
| 332 | 330 | static WRITE8_HANDLER( v1050_i8214_w ) |
| r5225 | r5226 | |
| 898 | 896 | /* baud select */ |
| 899 | 897 | if (baud_sel != state->baud_sel) |
| 900 | 898 | { |
| 901 | | attotime period; |
| 899 | attotime period = attotime_never; |
| 902 | 900 | |
| 903 | 901 | switch (baud_sel) |
| 904 | 902 | { |
| r5225 | r5226 | |
| 946 | 944 | v1050_state *state = device->machine->driver_data; |
| 947 | 945 | |
| 948 | 946 | state->int_mask = data; |
| 949 | | |
| 950 | | logerror("Interrupt Mask: %02x\n", data); |
| 951 | 947 | } |
| 952 | 948 | |
| 953 | 949 | static READ8_DEVICE_HANDLER( rtc_8255_c_r ) |
| r5225 | r5226 | |
| 1068 | 1064 | |
| 1069 | 1065 | static WD17XX_CALLBACK( v1050_mb8877_callback ) |
| 1070 | 1066 | { |
| 1071 | | switch (state) |
| 1067 | v1050_state *driver_state = device->machine->driver_data; |
| 1068 | |
| 1069 | if (driver_state->f_int_enb) |
| 1072 | 1070 | { |
| 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; |
| 1076 | 1076 | |
| 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; |
| 1080 | 1080 | |
| 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; |
| 1084 | 1084 | |
| 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 | } |
| 1088 | 1089 | } |
| 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 | } |
| 1089 | 1095 | } |
| 1090 | 1096 | |
| 1091 | 1097 | static const wd17xx_interface v1050_wd17xx_intf = |
| r5225 | r5226 | |
| 1095 | 1101 | |
| 1096 | 1102 | /* Machine Initialization */ |
| 1097 | 1103 | |
| 1104 | static 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 | |
| 1098 | 1117 | static MACHINE_START( v1050 ) |
| 1099 | 1118 | { |
| 1100 | 1119 | v1050_state *state = machine->driver_data; |
| r5225 | r5226 | |
| 1112 | 1131 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); |
| 1113 | 1132 | |
| 1114 | 1133 | /* initialize I8214 */ |
| 1134 | i8214_elr_w(state->i8214, 0); |
| 1115 | 1135 | i8214_etlg_w(state->i8214, 1); |
| 1116 | 1136 | i8214_inte_w(state->i8214, 1); |
| 1117 | 1137 | |
| 1118 | 1138 | /* initialize RTC */ |
| 1119 | 1139 | msm58321_cs1_w(state->msm58321, 1); |
| 1120 | 1140 | |
| 1141 | /* set CPU interrupt callback */ |
| 1142 | cpu_set_irq_callback(cputag_get_cpu(machine, Z80_TAG), v1050_int_ack); |
| 1143 | |
| 1121 | 1144 | /* setup memory banking */ |
| 1122 | 1145 | memory_configure_bank(machine, 1, 0, 2, mess_ram, 0x10000); |
| 1123 | 1146 | memory_configure_bank(machine, 1, 2, 1, mess_ram + 0x1c000, 0); |
| r5225 | r5226 | |
| 1169 | 1192 | |
| 1170 | 1193 | MDRV_MACHINE_START(v1050) |
| 1171 | 1194 | |
| 1172 | | /* keyboard */ |
| 1195 | /* keyboard HACK */ |
| 1173 | 1196 | MDRV_TIMER_ADD_PERIODIC("keyboard", v1050_keyboard_tick, HZ(60)) |
| 1174 | 1197 | |
| 1175 | 1198 | /* video hardware */ |
| r5225 | r5226 | |
| 1222 | 1245 | switch (state) |
| 1223 | 1246 | { |
| 1224 | 1247 | /* --- 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; |
| 1226 | 1249 | |
| 1227 | 1250 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 1228 | 1251 | case MESS_DEVINFO_PTR_FLOPPY_OPTIONS: info->p = (void *) floppyoptions_v1050; break; |
| r5225 | r5226 | |
| 1239 | 1262 | /* System Drivers */ |
| 1240 | 1263 | |
| 1241 | 1264 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 1242 | | COMP( 1983, v1050, 0, 0, v1050, v1050, 0, v1050, "Visual Technology Incorporated", "Visual 1050", GAME_NOT_WORKING ) |
| 1265 | COMP( 1983, v1050, 0, 0, v1050, v1050, 0, v1050, "Visual Technology Incorporated", "Visual 1050", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) |