src/mess/machine/oric.c
| r15077 | r15078 | |
| 17 | 17 | *********************************************************************/ |
| 18 | 18 | |
| 19 | 19 | |
| 20 | | #include <stdio.h> |
| 21 | | #include "emu.h" |
| 22 | 20 | #include "includes/oric.h" |
| 23 | | #include "machine/wd17xx.h" |
| 24 | | #include "machine/6522via.h" |
| 25 | | #include "machine/applefdc.h" |
| 26 | | #include "machine/6551acia.h" |
| 27 | | #include "machine/ctronics.h" |
| 28 | | #include "imagedev/cassette.h" |
| 29 | | #include "sound/ay8910.h" |
| 30 | | #include "imagedev/flopdrv.h" |
| 31 | 21 | |
| 32 | 22 | |
| 33 | 23 | |
| 34 | | static const int enable_logging = 1; |
| 35 | 24 | |
| 36 | | |
| 37 | 25 | /* ==0 if oric1 or oric atmos, !=0 if telestrat */ |
| 38 | 26 | |
| 39 | 27 | /* This does not exist in the real hardware. I have used it to |
| 40 | 28 | know which sources are interrupting */ |
| 41 | | /* bit 2 = telestrat 2nd via interrupt, 1 = microdisc interface, |
| 29 | /* bit 2 = telestrat 2nd via interrupt, |
| 30 | 1 = microdisc interface, |
| 42 | 31 | 0 = oric 1st via interrupt */ |
| 43 | 32 | |
| 44 | 33 | enum |
| r15077 | r15078 | |
| 70 | 59 | |
| 71 | 60 | /* if floppy disc hardware is disabled, do not allow interrupts from it */ |
| 72 | 61 | if ((input_port_read(machine, "FLOPPY") & 0x07) == ORIC_FLOPPY_INTERFACE_NONE) |
| 73 | | { |
| 74 | 62 | state->m_irqs &=~(1<<1); |
| 75 | | } |
| 76 | 63 | } |
| 77 | 64 | |
| 78 | 65 | /* any irq set? */ |
| 79 | | if ((state->m_irqs & 0x0f)!=0) |
| 80 | | { |
| 66 | if (state->m_irqs & 0x0f) |
| 81 | 67 | cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE); |
| 82 | | } |
| 83 | 68 | else |
| 84 | | { |
| 85 | 69 | cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE); |
| 86 | | } |
| 87 | 70 | } |
| 88 | 71 | |
| 89 | 72 | |
| r15077 | r15078 | |
| 100 | 83 | static void oric_keyboard_sense_refresh(running_machine &machine) |
| 101 | 84 | { |
| 102 | 85 | oric_state *state = machine.driver_data<oric_state>(); |
| 103 | | /* The following assumes that if a 0 is written, it can be used to detect if any key |
| 104 | | has been pressed.. */ |
| 86 | /* The following assumes that if a 0 is written, it can be used to detect if any key has been pressed.. */ |
| 105 | 87 | /* for each bit that is 0, it combines it's pressed state with the pressed state so far */ |
| 106 | 88 | |
| 107 | 89 | int i; |
| r15077 | r15078 | |
| 130 | 112 | |
| 131 | 113 | /* clear sense result */ |
| 132 | 114 | state->m_key_sense_bit = 0; |
| 115 | |
| 133 | 116 | /* any keys pressed on this line? */ |
| 134 | 117 | if (key_bit!=0) |
| 135 | 118 | { |
| r15077 | r15078 | |
| 163 | 146 | { |
| 164 | 147 | /* if psg is in read register state return reg data */ |
| 165 | 148 | if (state->m_psg_control==0x01) |
| 166 | | { |
| 167 | 149 | return ay8910_r(space->machine().device("ay8912"), 0); |
| 168 | | } |
| 169 | 150 | |
| 170 | 151 | /* return high-impedance */ |
| 171 | 152 | return 0x0ff; |
| r15077 | r15078 | |
| 311 | 292 | |
| 312 | 293 | /* CASSETTE */ |
| 313 | 294 | /* cassette motor control */ |
| 314 | | if ((state->m_previous_portb_data^data) & (1<<6)) |
| 315 | | { |
| 316 | | if (data & (1<<6)) |
| 317 | | { |
| 318 | | //enable_logging = 1; |
| 319 | | } |
| 320 | | } |
| 321 | | |
| 322 | | |
| 323 | | cassette_device_image(device->machine())->change_state( |
| 295 | cassette_device_image(device->machine())->change_state( |
| 324 | 296 | (data & 0x40) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, |
| 325 | 297 | CASSETTE_MOTOR_DISABLED); |
| 326 | 298 | |
| r15077 | r15078 | |
| 353 | 325 | state->m_psg_control &=~1; |
| 354 | 326 | |
| 355 | 327 | if (data) |
| 356 | | { |
| 357 | 328 | state->m_psg_control |=1; |
| 358 | | } |
| 359 | 329 | |
| 360 | 330 | oric_psg_connection_refresh(device->machine()); |
| 361 | 331 | } |
| r15077 | r15078 | |
| 366 | 336 | state->m_psg_control &=~2; |
| 367 | 337 | |
| 368 | 338 | if (data) |
| 369 | | { |
| 370 | 339 | state->m_psg_control |=2; |
| 371 | | } |
| 372 | 340 | |
| 373 | 341 | oric_psg_connection_refresh(device->machine()); |
| 374 | 342 | } |
| r15077 | r15078 | |
| 380 | 348 | drvstate->m_irqs &= ~(1<<0); |
| 381 | 349 | |
| 382 | 350 | if (state) |
| 383 | | { |
| 384 | | if (enable_logging) |
| 385 | | { |
| 386 | | //logerror("oric via1 interrupt\r\n"); |
| 387 | | } |
| 388 | | |
| 389 | 351 | drvstate->m_irqs |=(1<<0); |
| 390 | | } |
| 391 | 352 | |
| 392 | 353 | oric_refresh_ints(device->machine()); |
| 393 | 354 | } |
| r15077 | r15078 | |
| 1076 | 1037 | /* clear all irqs */ |
| 1077 | 1038 | state->m_irqs = 0; |
| 1078 | 1039 | state->m_ram_0x0c000 = NULL; |
| 1079 | | |
| 1040 | state->m_keyboard_line = 0; |
| 1041 | state->m_key_sense_bit = 0; |
| 1042 | state->m_keyboard_mask = 0; |
| 1043 | state->m_via_port_a_data = 0; |
| 1044 | state->m_psg_control = 0; |
| 1045 | state->m_previous_portb_data = 0; |
| 1046 | state->m_port_3fa_w = 0; |
| 1047 | state->m_port_3fb_w = 0; |
| 1048 | state->m_wd179x_int_state = 0; |
| 1049 | state->m_port_314_r = 0; |
| 1050 | state->m_port_318_r = 0; |
| 1051 | state->m_port_314_w = 0; |
| 1080 | 1052 | machine.scheduler().timer_pulse(attotime::from_hz(4800), FUNC(oric_refresh_tape)); |
| 1081 | 1053 | } |
| 1082 | 1054 | |
| r15077 | r15078 | |
| 1087 | 1059 | |
| 1088 | 1060 | state->m_is_telestrat = 0; |
| 1089 | 1061 | |
| 1090 | | state->m_ram_0x0c000 = auto_alloc_array(machine, char, 16384); |
| 1062 | state->m_ram_0x0c000 = auto_alloc_array(machine, UINT8, 16384); |
| 1091 | 1063 | } |
| 1092 | 1064 | |
| 1093 | 1065 | |
| r15077 | r15078 | |
| 1182 | 1154 | } |
| 1183 | 1155 | break; |
| 1184 | 1156 | } |
| 1185 | | if (enable_logging) |
| 1186 | | { |
| 1187 | | if ((offset & 0x0f)!=0x0d) |
| 1188 | | { |
| 1189 | | //logerror("via 0 r: %04x %04x\n",offset, (unsigned) cpu_get_reg(machine().device("maincpu"), STATE_GENPC)); |
| 1190 | | } |
| 1191 | | } |
| 1157 | |
| 1192 | 1158 | /* it is repeated */ |
| 1193 | 1159 | return via_0->read(space, offset & 0x0f); |
| 1194 | 1160 | } |
| r15077 | r15078 | |
| 1223 | 1189 | } |
| 1224 | 1190 | break; |
| 1225 | 1191 | } |
| 1226 | | if (enable_logging) |
| 1227 | | { |
| 1228 | | //logerror("via 0 w: %04x %02x %04x\n", offset, data,(unsigned) cpu_get_reg(machine().device("maincpu"), STATE_GENPC)); |
| 1229 | | } |
| 1230 | 1192 | |
| 1231 | 1193 | via_0->write(space, offset & 0x0f, data); |
| 1232 | 1194 | } |
| r15077 | r15078 | |
| 1426 | 1388 | |
| 1427 | 1389 | oric_common_init_machine(machine); |
| 1428 | 1390 | |
| 1391 | state->m_telestrat_via2_port_a_data = 0; |
| 1392 | state->m_telestrat_via2_port_b_data = 0; |
| 1429 | 1393 | state->m_is_telestrat = 1; |
| 1430 | 1394 | |
| 1431 | 1395 | /* initialise overlay ram */ |
| 1432 | 1396 | state->m_telestrat_blocks[0].MemType = TELESTRAT_MEM_BLOCK_RAM; |
| 1433 | | state->m_telestrat_blocks[0].ptr = auto_alloc_array(machine, UINT8, 16384); |
| 1397 | state->m_telestrat_blocks[0].ptr = mem+0x020000; //auto_alloc_array(machine, UINT8, 16384); |
| 1434 | 1398 | |
| 1435 | 1399 | state->m_telestrat_blocks[1].MemType = TELESTRAT_MEM_BLOCK_RAM; |
| 1436 | | state->m_telestrat_blocks[1].ptr = auto_alloc_array(machine, UINT8, 16384); |
| 1400 | state->m_telestrat_blocks[1].ptr = mem+0x024000; //auto_alloc_array(machine, UINT8, 16384); |
| 1401 | |
| 1437 | 1402 | state->m_telestrat_blocks[2].MemType = TELESTRAT_MEM_BLOCK_RAM; |
| 1438 | | state->m_telestrat_blocks[2].ptr = auto_alloc_array(machine, UINT8, 16384); |
| 1403 | state->m_telestrat_blocks[2].ptr = mem+0x028000; //auto_alloc_array(machine, UINT8, 16384); |
| 1439 | 1404 | |
| 1440 | 1405 | /* initialise default cartridge */ |
| 1441 | 1406 | state->m_telestrat_blocks[3].MemType = TELESTRAT_MEM_BLOCK_ROM; |
| 1442 | | state->m_telestrat_blocks[3].ptr = mem+0x010000; |
| 1407 | state->m_telestrat_blocks[3].ptr = mem+0x010000; // telmatic.rom |
| 1443 | 1408 | |
| 1444 | 1409 | state->m_telestrat_blocks[4].MemType = TELESTRAT_MEM_BLOCK_RAM; |
| 1445 | | state->m_telestrat_blocks[4].ptr = auto_alloc_array(machine, UINT8, 16384); |
| 1410 | state->m_telestrat_blocks[4].ptr = mem+0x02c000; //auto_alloc_array(machine, UINT8, 16384); |
| 1446 | 1411 | |
| 1447 | 1412 | /* initialise default cartridge */ |
| 1448 | 1413 | state->m_telestrat_blocks[5].MemType = TELESTRAT_MEM_BLOCK_ROM; |
| 1449 | | state->m_telestrat_blocks[5].ptr = mem+0x014000; |
| 1414 | state->m_telestrat_blocks[5].ptr = mem+0x014000; // teleass.rom |
| 1450 | 1415 | |
| 1451 | 1416 | /* initialise default cartridge */ |
| 1452 | 1417 | state->m_telestrat_blocks[6].MemType = TELESTRAT_MEM_BLOCK_ROM; |
| 1453 | | state->m_telestrat_blocks[6].ptr = mem+0x018000; |
| 1418 | state->m_telestrat_blocks[6].ptr = mem+0x018000; // hyperbas.rom |
| 1454 | 1419 | |
| 1455 | 1420 | /* initialise default cartridge */ |
| 1456 | 1421 | state->m_telestrat_blocks[7].MemType = TELESTRAT_MEM_BLOCK_ROM; |
| 1457 | | state->m_telestrat_blocks[7].ptr = mem+0x01c000; |
| 1422 | state->m_telestrat_blocks[7].ptr = mem+0x01c000; // telmon24.rom |
| 1458 | 1423 | |
| 1459 | 1424 | state->m_telestrat_bank_selection = 7; |
| 1460 | 1425 | telestrat_refresh_mem(machine); |
src/mess/includes/oric.h
| r15077 | r15078 | |
| 7 | 7 | #ifndef ORIC_H_ |
| 8 | 8 | #define ORIC_H_ |
| 9 | 9 | |
| 10 | #include "emu.h" |
| 11 | #include "cpu/m6502/m6502.h" |
| 12 | #include "sound/ay8910.h" |
| 13 | #include "sound/wave.h" |
| 10 | 14 | #include "machine/6522via.h" |
| 15 | #include "machine/6551acia.h" |
| 16 | #include "machine/ctronics.h" |
| 11 | 17 | #include "machine/wd17xx.h" |
| 18 | //#include <stdio.h> |
| 19 | #include "machine/applefdc.h" |
| 20 | #include "imagedev/flopdrv.h" |
| 21 | #include "imagedev/cassette.h" |
| 22 | #include "formats/oric_dsk.h" |
| 23 | #include "formats/ap2_dsk.h" |
| 24 | #include "formats/oric_tap.h" |
| 12 | 25 | |
| 13 | 26 | enum |
| 14 | 27 | { |
| r15077 | r15078 | |
| 23 | 36 | unsigned char *ptr; |
| 24 | 37 | } telestrat_mem_block; |
| 25 | 38 | |
| 39 | |
| 26 | 40 | /* current state of the display */ |
| 27 | 41 | /* some attributes persist until they are turned off. |
| 28 | 42 | This structure holds this persistant information */ |
| 29 | 43 | typedef struct |
| 30 | 44 | { |
| 31 | 45 | /* foreground and background colour used for rendering */ |
| 32 | | /* if flash attribute is set, these two will both be equal |
| 33 | | to background colour */ |
| 34 | | int active_foreground_colour; |
| 35 | | int active_background_colour; |
| 46 | /* if flash attribute is set, these two will both be equal to background colour */ |
| 47 | UINT8 active_foreground_colour; |
| 48 | UINT8 active_background_colour; |
| 36 | 49 | /* current foreground and background colour */ |
| 37 | | int foreground_colour; |
| 38 | | int background_colour; |
| 39 | | int mode; |
| 50 | UINT8 foreground_colour; |
| 51 | UINT8 background_colour; |
| 52 | UINT8 mode; |
| 40 | 53 | /* text attributes */ |
| 41 | | int text_attributes; |
| 54 | UINT8 text_attributes; |
| 42 | 55 | |
| 43 | | unsigned long read_addr; |
| 56 | offs_t read_addr; |
| 44 | 57 | |
| 45 | 58 | /* current addr to fetch data */ |
| 46 | | unsigned char *char_data; |
| 59 | UINT8 *char_data; |
| 47 | 60 | /* base of char data */ |
| 48 | | unsigned char *char_base; |
| 61 | UINT8 *char_base; |
| 49 | 62 | |
| 50 | 63 | /* if (1<<3), display graphics, if 0, hide graphics */ |
| 51 | | int flash_state; |
| 52 | 64 | /* current count */ |
| 53 | | int flash_count; |
| 65 | UINT8 flash_count; |
| 54 | 66 | } oric_vh_state; |
| 55 | 67 | |
| 56 | 68 | |
| r15077 | r15078 | |
| 62 | 74 | m_ram(*this, "ram") { } |
| 63 | 75 | |
| 64 | 76 | optional_shared_ptr<UINT8> m_ram; |
| 65 | | int m_is_telestrat; |
| 66 | | unsigned char m_irqs; |
| 67 | | char *m_ram_0x0c000; |
| 68 | | int m_keyboard_line; |
| 69 | | char m_key_sense_bit; |
| 70 | | char m_keyboard_mask; |
| 71 | | unsigned char m_via_port_a_data; |
| 72 | | char m_psg_control; |
| 73 | | unsigned char m_previous_portb_data; |
| 74 | | unsigned char m_port_3fa_w; |
| 75 | | unsigned char m_port_3fb_w; |
| 76 | | unsigned char m_wd179x_int_state; |
| 77 | | unsigned char m_port_314_r; |
| 78 | | unsigned char m_port_318_r; |
| 79 | | unsigned char m_port_314_w; |
| 80 | | unsigned char m_telestrat_bank_selection; |
| 81 | | unsigned char m_telestrat_via2_port_a_data; |
| 82 | | unsigned char m_telestrat_via2_port_b_data; |
| 77 | bool m_is_telestrat; |
| 78 | UINT8 m_irqs; |
| 79 | UINT8 *m_ram_0x0c000; |
| 80 | UINT8 m_keyboard_line; |
| 81 | UINT8 m_key_sense_bit; |
| 82 | UINT8 m_keyboard_mask; |
| 83 | UINT8 m_via_port_a_data; |
| 84 | UINT8 m_psg_control; |
| 85 | UINT8 m_previous_portb_data; |
| 86 | UINT8 m_port_3fa_w; |
| 87 | UINT8 m_port_3fb_w; |
| 88 | UINT8 m_wd179x_int_state; |
| 89 | UINT8 m_port_314_r; |
| 90 | UINT8 m_port_318_r; |
| 91 | UINT8 m_port_314_w; |
| 92 | UINT8 m_telestrat_bank_selection; |
| 93 | UINT8 m_telestrat_via2_port_a_data; |
| 94 | UINT8 m_telestrat_via2_port_b_data; |
| 83 | 95 | telestrat_mem_block m_telestrat_blocks[8]; |
| 84 | 96 | oric_vh_state m_vh_state; |
| 85 | 97 | DECLARE_WRITE8_MEMBER(oric_psg_porta_write); |
src/mess/video/oric.c
| r15077 | r15078 | |
| 10 | 10 | |
| 11 | 11 | ***************************************************************************/ |
| 12 | 12 | |
| 13 | | #include "emu.h" |
| 14 | 13 | #include "includes/oric.h" |
| 15 | 14 | |
| 16 | | static void oric_vh_update_flash(oric_state *state); |
| 17 | | static void oric_vh_update_attribute(running_machine &machine,int c); |
| 18 | | static void oric_refresh_charset(oric_state *state); |
| 19 | | |
| 20 | | |
| 21 | 15 | static TIMER_CALLBACK(oric_vh_timer_callback) |
| 22 | 16 | { |
| 23 | 17 | oric_state *state = machine.driver_data<oric_state>(); |
| 24 | 18 | /* update flash count */ |
| 25 | 19 | state->m_vh_state.flash_count++; |
| 26 | | if (state->m_vh_state.flash_count == 16) |
| 27 | | { |
| 28 | | state->m_vh_state.flash_count = 0; |
| 29 | | state->m_vh_state.flash_state ^=(1<<3); |
| 30 | | oric_vh_update_flash(state); |
| 31 | | } |
| 32 | 20 | } |
| 33 | 21 | |
| 34 | | VIDEO_START( oric ) |
| 35 | | { |
| 36 | | oric_state *state = machine.driver_data<oric_state>(); |
| 37 | | /* initialise flash timer */ |
| 38 | | state->m_vh_state.flash_count = 0; |
| 39 | | state->m_vh_state.flash_state = 0; |
| 40 | | machine.scheduler().timer_pulse(attotime::from_hz(50), FUNC(oric_vh_timer_callback)); |
| 41 | | /* mode */ |
| 42 | | oric_vh_update_attribute(machine,(1<<3)|(1<<4)); |
| 43 | | } |
| 44 | | |
| 45 | | |
| 46 | 22 | static void oric_vh_update_flash(oric_state *state) |
| 47 | 23 | { |
| 48 | 24 | /* flash active? */ |
| 49 | | if (state->m_vh_state.text_attributes & (1<<2)) |
| 25 | if (BIT(state->m_vh_state.text_attributes, 2)) |
| 50 | 26 | { |
| 51 | 27 | /* yes */ |
| 52 | 28 | |
| 53 | 29 | /* show or hide text? */ |
| 54 | | if (state->m_vh_state.flash_state) |
| 30 | if (BIT(state->m_vh_state.flash_count, 4)) |
| 55 | 31 | { |
| 56 | 32 | /* hide */ |
| 57 | 33 | /* set foreground and background to be the same */ |
| r15077 | r15078 | |
| 74 | 50 | static void oric_refresh_charset(oric_state *state) |
| 75 | 51 | { |
| 76 | 52 | /* alternate char set? */ |
| 77 | | if ((state->m_vh_state.text_attributes & (1<<0))==0) |
| 53 | if (BIT(state->m_vh_state.text_attributes, 0)) |
| 78 | 54 | { |
| 79 | | /* no */ |
| 80 | | state->m_vh_state.char_data = state->m_vh_state.char_base; |
| 55 | /* yes */ |
| 56 | state->m_vh_state.char_data = state->m_vh_state.char_base + (128*8); |
| 81 | 57 | } |
| 82 | 58 | else |
| 83 | 59 | { |
| 84 | | /* yes */ |
| 85 | | state->m_vh_state.char_data = state->m_vh_state.char_base + (128*8); |
| 60 | /* no */ |
| 61 | state->m_vh_state.char_data = state->m_vh_state.char_base; |
| 86 | 62 | } |
| 87 | 63 | } |
| 88 | 64 | |
| 89 | 65 | /* update video hardware state depending on the new attribute */ |
| 90 | | static void oric_vh_update_attribute(running_machine &machine,int c) |
| 66 | static void oric_vh_update_attribute(running_machine &machine, UINT8 c) |
| 91 | 67 | { |
| 92 | 68 | oric_state *state = machine.driver_data<oric_state>(); |
| 93 | 69 | /* attribute */ |
| 94 | | int attribute = c & 0x03f; |
| 70 | UINT8 attribute = c & 0x03f; |
| 95 | 71 | address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM); |
| 96 | 72 | |
| 97 | 73 | switch ((attribute>>3) & 0x03) |
| 98 | 74 | { |
| 99 | 75 | case 0: |
| 100 | 76 | { |
| 101 | | /* set foreground colour */ |
| 77 | /* set foreground colour 00-07 = black,red,green,yellow,blue,magenta,cyan,white */ |
| 102 | 78 | state->m_vh_state.foreground_colour = attribute & 0x07; |
| 103 | 79 | oric_vh_update_flash(state); |
| 104 | 80 | } |
| r15077 | r15078 | |
| 128 | 104 | /* set video mode */ |
| 129 | 105 | state->m_vh_state.mode = attribute & 0x07; |
| 130 | 106 | |
| 131 | | /* a different charset base is used depending on the video mode */ |
| 132 | | /* hires takes all the data from 0x0a000 through to about 0x0bf68, |
| 133 | | so the charset is moved to 0x09800 */ |
| 134 | | /* text mode starts at 0x0bb80 and so the charset is in a different location */ |
| 135 | | if (state->m_vh_state.mode & (1<<2)) |
| 107 | // a different charset base is used depending on the video mode |
| 108 | // hires takes all the data from 0x0a000 through to about 0x0bf68, |
| 109 | // so the charset is moved to 0x09800 */ |
| 110 | // text mode starts at 0x0bb80 and so the charset is in a different location |
| 111 | if (BIT(state->m_vh_state.mode, 2)) |
| 136 | 112 | { |
| 137 | 113 | /* set screen memory base and standard charset location for this mode */ |
| 138 | 114 | state->m_vh_state.read_addr = 0x0a000; |
| 139 | 115 | if (state->m_ram) |
| 140 | | state->m_vh_state.char_base = state->m_ram + (unsigned long)0x09800; |
| 116 | state->m_vh_state.char_base = state->m_ram + (offs_t)0x09800; |
| 141 | 117 | else |
| 142 | | state->m_vh_state.char_base = (unsigned char *)space->get_read_ptr(0x09800); |
| 143 | | |
| 144 | | /* changing the mode also changes the position of the standard charset |
| 145 | | and alternative charset */ |
| 146 | | oric_refresh_charset(state); |
| 118 | state->m_vh_state.char_base = (UINT8 *)space->get_read_ptr(0x09800); |
| 147 | 119 | } |
| 148 | 120 | else |
| 149 | 121 | { |
| 150 | 122 | /* set screen memory base and standard charset location for this mode */ |
| 151 | 123 | state->m_vh_state.read_addr = 0x0bb80; |
| 152 | 124 | if (state->m_ram) |
| 153 | | state->m_vh_state.char_base = state->m_ram + (unsigned long)0x0b400; |
| 125 | state->m_vh_state.char_base = state->m_ram + (offs_t)0x0b400; |
| 154 | 126 | else |
| 155 | | state->m_vh_state.char_base = (unsigned char *)space->get_read_ptr(0x0b400); |
| 156 | | |
| 157 | | /* changing the mode also changes the position of the standard charset |
| 158 | | and alternative charset */ |
| 159 | | oric_refresh_charset(state); |
| 127 | state->m_vh_state.char_base = (UINT8 *)space->get_read_ptr(0x0b400); |
| 160 | 128 | } |
| 129 | /* changing the mode also changes the position of the standard charset and alternative charset */ |
| 130 | oric_refresh_charset(state); |
| 161 | 131 | } |
| 162 | 132 | break; |
| 163 | 133 | |
| r15077 | r15078 | |
| 169 | 139 | |
| 170 | 140 | /* render 6-pixels using foreground and background colours specified */ |
| 171 | 141 | /* used in hires and text mode */ |
| 172 | | static void oric_vh_render_6pixels(bitmap_ind16 &bitmap,int x,int y, int fg, int bg,int data, int invert_flag) |
| 142 | static void oric_vh_render_6pixels(bitmap_ind16 &bitmap, int x, UINT8 y, UINT8 fg, UINT8 bg, UINT8 data, bool invert_flag) |
| 173 | 143 | { |
| 174 | | int i; |
| 175 | | int pens[2]; |
| 176 | | int px; |
| 177 | | |
| 178 | 144 | /* invert? */ |
| 179 | 145 | if (invert_flag) |
| 180 | 146 | { |
| r15077 | r15078 | |
| 182 | 148 | bg ^=0x07; |
| 183 | 149 | } |
| 184 | 150 | |
| 185 | | pens[1] = fg; |
| 186 | | pens[0] = bg; |
| 187 | | |
| 188 | | px = x; |
| 189 | | for (i=0; i<6; i++) |
| 190 | | { |
| 191 | | int col; |
| 192 | | |
| 193 | | col = pens[(data>>5) & 0x01]; |
| 194 | | bitmap.pix16(y, px) = col; |
| 195 | | px++; |
| 196 | | data = data<<1; |
| 197 | | } |
| 151 | bitmap.pix16(y, x++) = BIT(data, 5) ? fg : bg; |
| 152 | bitmap.pix16(y, x++) = BIT(data, 4) ? fg : bg; |
| 153 | bitmap.pix16(y, x++) = BIT(data, 3) ? fg : bg; |
| 154 | bitmap.pix16(y, x++) = BIT(data, 2) ? fg : bg; |
| 155 | bitmap.pix16(y, x++) = BIT(data, 1) ? fg : bg; |
| 156 | bitmap.pix16(y, x++) = BIT(data, 0) ? fg : bg; |
| 198 | 157 | } |
| 199 | 158 | |
| 200 | 159 | |
| r15077 | r15078 | |
| 207 | 166 | SCREEN_UPDATE_IND16( oric ) |
| 208 | 167 | { |
| 209 | 168 | oric_state *state = screen.machine().driver_data<oric_state>(); |
| 210 | | unsigned char *RAM; |
| 211 | | int byte_offset; |
| 212 | | int y; |
| 213 | | unsigned long read_addr_base; |
| 214 | | int hires_active; |
| 169 | UINT8 *RAM, y; |
| 170 | offs_t byte_offset, read_addr_base; |
| 171 | bool hires_active; |
| 215 | 172 | |
| 216 | 173 | RAM = state->m_ram; |
| 217 | 174 | |
| r15077 | r15078 | |
| 219 | 176 | read_addr_base = state->m_vh_state.read_addr; |
| 220 | 177 | |
| 221 | 178 | /* is hires active? */ |
| 222 | | if (state->m_vh_state.mode & (1<<2)) |
| 223 | | { |
| 224 | | hires_active = 1; |
| 225 | | } |
| 226 | | else |
| 227 | | { |
| 228 | | hires_active = 0; |
| 229 | | } |
| 179 | hires_active = BIT(state->m_vh_state.mode, 2); |
| 230 | 180 | |
| 231 | | |
| 232 | 181 | for (y = 0; y < 224; y++) |
| 233 | 182 | { |
| 234 | 183 | int x = 0; |
| r15077 | r15078 | |
| 237 | 186 | oric_vh_update_attribute(screen.machine(),7); |
| 238 | 187 | /* background colour black */ |
| 239 | 188 | oric_vh_update_attribute(screen.machine(),(1<<3)); |
| 240 | | |
| 241 | 189 | oric_vh_update_attribute(screen.machine(),(1<<4)); |
| 242 | 190 | |
| 243 | 191 | for (byte_offset=0; byte_offset<40; byte_offset++) |
| 244 | 192 | { |
| 245 | | int c; |
| 246 | | unsigned long read_addr; |
| 193 | UINT8 c; |
| 194 | offs_t read_addr; |
| 247 | 195 | |
| 248 | 196 | /* after line 200 all rendering is done in text mode */ |
| 249 | 197 | if (y<200) |
| 250 | 198 | { |
| 251 | | /* calculate fetch address based on current line and |
| 252 | | current mode */ |
| 199 | /* calculate fetch address based on current line and current mode */ |
| 253 | 200 | if (hires_active) |
| 254 | 201 | { |
| 255 | | read_addr = (unsigned long)read_addr_base + (unsigned long)byte_offset + (unsigned long)(y*40); |
| 202 | read_addr = read_addr_base + byte_offset + (offs_t)(y*40); |
| 256 | 203 | } |
| 257 | 204 | else |
| 258 | 205 | { |
| 259 | | int char_line; |
| 260 | | |
| 261 | | char_line = (y>>3); |
| 262 | | read_addr = (unsigned long)read_addr_base + (unsigned long)byte_offset + (unsigned long)(char_line*40); |
| 206 | UINT8 char_line = y>>3; |
| 207 | read_addr = read_addr_base + byte_offset + (offs_t)(char_line*40); |
| 263 | 208 | } |
| 264 | 209 | } |
| 265 | 210 | else |
| 266 | 211 | { |
| 267 | | int char_line; |
| 268 | | |
| 269 | | char_line = ((y-200)>>3); |
| 270 | | read_addr = (unsigned long)read_addr_base + (unsigned long)byte_offset + (unsigned long)(char_line*40); |
| 212 | UINT8 char_line = (y-200)>>3; |
| 213 | read_addr = read_addr_base + byte_offset + (offs_t)(char_line*40); |
| 271 | 214 | } |
| 272 | 215 | |
| 273 | 216 | /* fetch data */ |
| r15077 | r15078 | |
| 284 | 227 | if (y < 200) |
| 285 | 228 | { |
| 286 | 229 | /* is hires active? */ |
| 287 | | if (state->m_vh_state.mode & (1 << 2)) |
| 288 | | { |
| 289 | | hires_active = 1; |
| 290 | | } |
| 291 | | else |
| 292 | | { |
| 293 | | hires_active = 0; |
| 294 | | } |
| 295 | | |
| 230 | hires_active = BIT(state->m_vh_state.mode, 2); |
| 296 | 231 | read_addr_base = state->m_vh_state.read_addr; |
| 297 | 232 | } |
| 298 | 233 | } |
| r15077 | r15078 | |
| 301 | 236 | /* hires? */ |
| 302 | 237 | if (hires_active) |
| 303 | 238 | { |
| 304 | | int pixel_data = c & 0x03f; |
| 239 | UINT8 pixel_data = c & 0x03f; |
| 305 | 240 | /* plot hires pixels */ |
| 306 | | oric_vh_render_6pixels(bitmap,x,y,state->m_vh_state.active_foreground_colour, state->m_vh_state.active_background_colour, pixel_data,(c & 0x080)); |
| 241 | oric_vh_render_6pixels(bitmap,x,y,state->m_vh_state.active_foreground_colour, state->m_vh_state.active_background_colour, pixel_data, BIT(c, 7)); |
| 307 | 242 | } |
| 308 | 243 | else |
| 309 | 244 | { |
| 310 | | int char_index; |
| 311 | | int char_data; |
| 312 | | int ch_line; |
| 245 | UINT8 char_index, char_data, ch_line; |
| 313 | 246 | |
| 314 | 247 | char_index = (c & 0x07f); |
| 315 | 248 | |
| 316 | 249 | ch_line = y & 7; |
| 317 | 250 | |
| 318 | 251 | /* is double height set? */ |
| 319 | | if (state->m_vh_state.text_attributes & (1<<1)) |
| 252 | if (BIT(state->m_vh_state.text_attributes, 1)) |
| 320 | 253 | { |
| 321 | | /* if char line is even, top half of character is displayed, |
| 322 | | if char line is odd, bottom half of character is displayed */ |
| 323 | | int double_height_flag = ((y>>3) & 0x01); |
| 254 | /* if char line is even, top half of character is displayed else bottom half */ |
| 255 | UINT8 double_height_flag = BIT(y, 3); |
| 324 | 256 | |
| 325 | 257 | /* calculate line to fetch */ |
| 326 | 258 | ch_line = (ch_line>>1) + (double_height_flag<<2); |
| r15077 | r15078 | |
| 332 | 264 | /* draw! */ |
| 333 | 265 | oric_vh_render_6pixels(bitmap,x,y, |
| 334 | 266 | state->m_vh_state.active_foreground_colour, |
| 335 | | state->m_vh_state.active_background_colour, char_data, (c & 0x080)); |
| 267 | state->m_vh_state.active_background_colour, char_data, BIT(c, 7)); |
| 336 | 268 | } |
| 337 | 269 | |
| 338 | 270 | } |
| 339 | 271 | |
| 340 | | x=x+6; |
| 272 | x+=6; |
| 341 | 273 | } |
| 342 | 274 | |
| 343 | 275 | /* after 200 lines have been drawn, force a change of the read address */ |
| r15077 | r15078 | |
| 346 | 278 | if (y==199) |
| 347 | 279 | { |
| 348 | 280 | /* mode */ |
| 349 | | read_addr_base = (unsigned long)0x0bf68; |
| 281 | read_addr_base = (offs_t)0x0bf68; |
| 350 | 282 | hires_active = 0; |
| 351 | 283 | } |
| 352 | 284 | } |
| r15077 | r15078 | |
| 354 | 286 | } |
| 355 | 287 | |
| 356 | 288 | |
| 289 | VIDEO_START( oric ) |
| 290 | { |
| 291 | oric_state *state = machine.driver_data<oric_state>(); |
| 292 | // initialise variables |
| 293 | state->m_vh_state.active_foreground_colour = 0; |
| 294 | state->m_vh_state.active_background_colour = 0; |
| 295 | state->m_vh_state.foreground_colour = 0; |
| 296 | state->m_vh_state.background_colour = 0; |
| 297 | state->m_vh_state.mode = 0; |
| 298 | state->m_vh_state.text_attributes = 0; |
| 299 | state->m_vh_state.read_addr = 0; |
| 300 | state->m_vh_state.char_data = 0; |
| 301 | state->m_vh_state.char_base = 0; |
| 302 | /* initialise flash timer */ |
| 303 | state->m_vh_state.flash_count = 0; |
| 304 | machine.scheduler().timer_pulse(attotime::from_hz(50), FUNC(oric_vh_timer_callback)); |
| 305 | /* mode */ |
| 306 | oric_vh_update_attribute(machine,(1<<3)|(1<<4)); |
| 307 | } |
| 308 | |
src/mess/drivers/oric.c
| r15077 | r15078 | |
| 16 | 16 | |
| 17 | 17 | *********************************************************************/ |
| 18 | 18 | |
| 19 | | #include "emu.h" |
| 20 | | #include "cpu/m6502/m6502.h" |
| 21 | | #include "sound/wave.h" |
| 22 | 19 | #include "includes/oric.h" |
| 23 | | #include "machine/ctronics.h" |
| 24 | | #include "imagedev/flopdrv.h" |
| 25 | | #include "imagedev/cassette.h" |
| 26 | | #include "formats/oric_dsk.h" |
| 27 | | #include "formats/ap2_dsk.h" |
| 28 | | #include "formats/oric_tap.h" |
| 29 | | #include "sound/ay8910.h" |
| 30 | | #include "machine/6522via.h" |
| 31 | | #include "machine/6551acia.h" |
| 32 | | #include "machine/wd17xx.h" |
| 33 | 20 | |
| 34 | 21 | /* |
| 35 | 22 | Explanation of memory regions: |
| r15077 | r15078 | |
| 57 | 44 | |
| 58 | 45 | |
| 59 | 46 | static ADDRESS_MAP_START(oric_mem, AS_PROGRAM, 8, oric_state ) |
| 60 | | AM_RANGE( 0x0000, 0xbfff) AM_RAM AM_SHARE("ram") |
| 61 | | AM_RANGE( 0xc000, 0xdfff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank5") |
| 47 | AM_RANGE( 0x0000, 0xbfff) AM_RAM AM_SHARE("ram") |
| 48 | AM_RANGE( 0xc000, 0xdfff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank5") |
| 62 | 49 | AM_RANGE( 0xe000, 0xf7ff) AM_READ_BANK("bank2") AM_WRITE_BANK("bank6") |
| 63 | 50 | AM_RANGE( 0xf800, 0xffff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank7") |
| 64 | 51 | ADDRESS_MAP_END |
| r15077 | r15078 | |
| 70 | 57 | AM_RANGE( 0x0000, 0x02ff) AM_RAM |
| 71 | 58 | AM_RANGE( 0x0300, 0x030f) AM_DEVREADWRITE("via6522_0", via6522_device, read, write) |
| 72 | 59 | AM_RANGE( 0x0310, 0x031b) AM_READWRITE(oric_microdisc_r, oric_microdisc_w ) |
| 73 | | AM_RANGE( 0x031c, 0x031f) AM_DEVREADWRITE("acia", acia6551_device, read, write) |
| 60 | AM_RANGE( 0x031c, 0x031f) AM_DEVREADWRITE("acia", acia6551_device, read, write) |
| 74 | 61 | AM_RANGE( 0x0320, 0x032f) AM_DEVREADWRITE("via6522_1", via6522_device, read, write) |
| 75 | 62 | AM_RANGE( 0x0400, 0xbfff) AM_RAM |
| 76 | 63 | AM_RANGE( 0xc000, 0xffff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") |
| r15077 | r15078 | |
| 78 | 65 | |
| 79 | 66 | |
| 80 | 67 | static INPUT_PORTS_START(oric) |
| 81 | | PORT_START("ROW0") |
| 68 | PORT_START("ROW0") |
| 82 | 69 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| 83 | 70 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') |
| 84 | 71 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| r15077 | r15078 | |
| 184 | 171 | INPUT_PORTS_END |
| 185 | 172 | |
| 186 | 173 | static INPUT_PORTS_START(prav8d) |
| 187 | | PORT_START("ROW0") |
| 174 | PORT_START("ROW0") |
| 188 | 175 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| 189 | 176 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X \xd0\xac") PORT_CODE(KEYCODE_X) PORT_CHAR('X') |
| 190 | 177 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| r15077 | r15078 | |
| 395 | 382 | MCFG_MACHINE_START( oric ) |
| 396 | 383 | MCFG_MACHINE_RESET( oric ) |
| 397 | 384 | |
| 398 | | /* video hardware */ |
| 385 | /* video hardware */ |
| 399 | 386 | MCFG_SCREEN_ADD("screen", RASTER) |
| 400 | 387 | MCFG_SCREEN_REFRESH_RATE(60) |
| 401 | 388 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| r15077 | r15078 | |
| 512 | 499 | ROM_END |
| 513 | 500 | |
| 514 | 501 | ROM_START(telstrat) |
| 515 | | ROM_REGION(0x20000, "maincpu", 0) /* 0x10000 + (0x04000 * 4) */ |
| 502 | ROM_REGION(0x30000, "maincpu", 0) /* 0x10000 + (0x04000 * 4) */ |
| 516 | 503 | ROM_LOAD ("telmatic.rom", 0x010000, 0x02000, CRC(94358dc6) SHA1(35f92a0477a88f5cf564971125047ffcfa02ec10) ) |
| 517 | 504 | ROM_LOAD ("teleass.rom", 0x014000, 0x04000, CRC(68b0fde6) SHA1(9e9af51dae3199cccf49ab3f0d47e2b9be4ba97d) ) |
| 518 | 505 | ROM_LOAD ("hyperbas.rom", 0x018000, 0x04000, CRC(1d96ab50) SHA1(f5f70a0eb59f8cd6c261e179ae78ef906f68ed63) ) |
| r15077 | r15078 | |
| 521 | 508 | |
| 522 | 509 | ROM_START(prav8d) |
| 523 | 510 | ROM_REGION(0x14300, "maincpu", 0) /* 0x10000 + 0x04000 + 0x00100 + 0x00200 */ |
| 524 | | ROM_LOAD( "pravetzt.rom", 0x10000, 0x4000, CRC(58079502) SHA1(7afc276cb118adff72e4f16698f94bf3b2c64146) ) |
| 511 | ROM_LOAD( "pravetzt.rom", 0x10000, 0x4000, CRC(58079502) SHA1(7afc276cb118adff72e4f16698f94bf3b2c64146) ) |
| 525 | 512 | ROM_LOAD_OPTIONAL( "8ddoslo.rom", 0x014000, 0x0100, CRC(0c82f636) SHA1(b29d151a0dfa3c7cd50439b51d0a8f95559bc2b6) ) |
| 526 | | ROM_LOAD_OPTIONAL( "8ddoshi.rom", 0x014100, 0x0200, CRC(66309641) SHA1(9c2e82b3c4d385ade6215fcb89f8b92e6fd2bf4b) ) |
| 513 | ROM_LOAD_OPTIONAL( "8ddoshi.rom", 0x014100, 0x0200, CRC(66309641) SHA1(9c2e82b3c4d385ade6215fcb89f8b92e6fd2bf4b) ) |
| 527 | 514 | ROM_END |
| 528 | 515 | |
| 529 | 516 | ROM_START(prav8dd) |
| r15077 | r15078 | |
| 532 | 519 | ROMX_LOAD( "8d.rom", 0x10000, 0x4000, CRC(b48973ef) SHA1(fd47c977fc215a3b577596a7483df53e8a1e9c83), ROM_BIOS(1) ) |
| 533 | 520 | ROM_SYSTEM_BIOS( 1, "radosoft", "RadoSoft Disk ROM, 1992") |
| 534 | 521 | ROMX_LOAD( "pravetzd.rom", 0x10000, 0x4000, CRC(f8d23821) SHA1(f87ad3c5832773b6e0614905552a80c98dc8e2a5), ROM_BIOS(2) ) |
| 535 | | ROM_LOAD_OPTIONAL( "8ddoslo.rom", 0x014000, 0x0100, CRC(0c82f636) SHA1(b29d151a0dfa3c7cd50439b51d0a8f95559bc2b6) ) |
| 536 | | ROM_LOAD_OPTIONAL( "8ddoshi.rom", 0x014100, 0x0200, CRC(66309641) SHA1(9c2e82b3c4d385ade6215fcb89f8b92e6fd2bf4b) ) |
| 522 | ROM_LOAD_OPTIONAL( "8ddoslo.rom", 0x014000, 0x0100, CRC(0c82f636) SHA1(b29d151a0dfa3c7cd50439b51d0a8f95559bc2b6) ) |
| 523 | ROM_LOAD_OPTIONAL( "8ddoshi.rom", 0x014100, 0x0200, CRC(66309641) SHA1(9c2e82b3c4d385ade6215fcb89f8b92e6fd2bf4b) ) |
| 537 | 524 | ROM_END |
| 538 | 525 | |
| 539 | 526 | |
| 540 | 527 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ |
| 541 | | COMP( 1983, oric1, 0, 0, oric, oric, 0, "Tangerine", "Oric 1" , 0) |
| 542 | | COMP( 1984, orica, oric1, 0, oric, orica, 0, "Tangerine", "Oric Atmos" , 0) |
| 543 | | COMP( 1985, prav8d, oric1, 0, prav8d, prav8d, 0, "Pravetz", "Pravetz 8D", 0) |
| 544 | | COMP( 1989, prav8dd, oric1, 0, prav8d, prav8d, 0, "Pravetz", "Pravetz 8D (Disk ROM)", GAME_UNOFFICIAL) |
| 545 | | COMP( 1986, telstrat, oric1, 0, telstrat, telstrat, 0, "Tangerine", "Oric Telestrat", GAME_NOT_WORKING ) |
| 528 | COMP( 1983, oric1, 0, 0, oric, oric, 0, "Tangerine", "Oric 1" , 0) |
| 529 | COMP( 1984, orica, oric1, 0, oric, orica, 0, "Tangerine", "Oric Atmos" , 0) |
| 530 | COMP( 1985, prav8d, oric1, 0, prav8d, prav8d, 0, "Pravetz", "Pravetz 8D", 0) |
| 531 | COMP( 1989, prav8dd, oric1, 0, prav8d, prav8d, 0, "Pravetz", "Pravetz 8D (Disk ROM)", GAME_UNOFFICIAL) |
| 532 | COMP( 1986, telstrat, oric1, 0, telstrat, telstrat, 0, "Tangerine", "Oric Telestrat", GAME_NOT_WORKING ) |