diff options
author | 2016-08-12 21:10:27 +0200 | |
---|---|---|
committer | 2016-08-12 21:10:27 +0200 | |
commit | be807d81ea892d2b2f84d0a4f1909a898870d69d (patch) | |
tree | c0dc61a3cdca09fd31832728f65010b1e7612f0a /src | |
parent | 1339c06320229d178a169cabc5730351eda6ba74 (diff) | |
parent | 6dece8ff4fde97f384617d4ab431d5cc1bf157b1 (diff) |
Merge branch 'master' of https://github.com/mamedev/mame
Diffstat (limited to 'src')
-rw-r--r-- | src/devices/cpu/i86/i86.h | 2 | ||||
-rw-r--r-- | src/devices/machine/mc6852.cpp | 90 | ||||
-rw-r--r-- | src/devices/machine/mc6852.h | 51 | ||||
-rw-r--r-- | src/emu/diimage.cpp | 50 | ||||
-rw-r--r-- | src/emu/diimage.h | 1 | ||||
-rw-r--r-- | src/emu/image.cpp | 10 | ||||
-rw-r--r-- | src/emu/softlist.cpp | 72 | ||||
-rw-r--r-- | src/emu/softlist.h | 5 | ||||
-rw-r--r-- | src/mame/drivers/victor9k.cpp | 82 | ||||
-rw-r--r-- | src/mame/includes/victor9k.h | 1 |
10 files changed, 227 insertions, 137 deletions
diff --git a/src/devices/cpu/i86/i86.h b/src/devices/cpu/i86/i86.h index 978fa7d1690..f268c3c1671 100644 --- a/src/devices/cpu/i86/i86.h +++ b/src/devices/cpu/i86/i86.h @@ -130,7 +130,7 @@ protected: virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; virtual void interrupt(int int_num, int trap = 1); - bool common_op(UINT8 op); + virtual bool common_op(UINT8 op); // Accessing memory and io inline UINT8 read_byte(UINT32 addr); diff --git a/src/devices/machine/mc6852.cpp b/src/devices/machine/mc6852.cpp index b0cf1ff9ca9..957aa66413e 100644 --- a/src/devices/machine/mc6852.cpp +++ b/src/devices/machine/mc6852.cpp @@ -39,51 +39,6 @@ const device_type MC6852 = &device_creator<mc6852_device>; #define LOG 0 -#define S_RDA 0x01 -#define S_TDRA 0x02 -#define S_DCD 0x04 -#define S_CTS 0x08 -#define S_TUF 0x10 -#define S_RX_OVRN 0x20 -#define S_PE 0x40 -#define S_IRQ 0x80 - - -#define C1_RX_RS 0x01 -#define C1_TX_RS 0x02 -#define C1_STRIP_SYNC 0x04 -#define C1_CLEAR_SYNC 0x08 -#define C1_TIE 0x10 -#define C1_RIE 0x20 -#define C1_AC_MASK 0xc0 -#define C1_AC_C2 0x00 -#define C1_AC_C3 0x40 -#define C1_AC_SYNC 0x80 -#define C1_AC_TX_FIFO 0xc0 - - -#define C2_PC1 0x01 -#define C2_PC2 0x02 -#define C2_1_2_BYTE 0x04 -#define C2_WS_MASK 0x38 -#define C2_WS_6_E 0x00 -#define C2_WS_6_O 0x08 -#define C2_WS_7 0x10 -#define C2_WS_8 0x18 -#define C2_WS_7_E 0x20 -#define C2_WS_7_O 0x28 -#define C2_WS_8_E 0x30 -#define C2_WS_8_O 0x38 -#define C2_TX_SYNC 0x40 -#define C2_EIE 0x80 - - -#define C3_E_I_SYNC 0x01 -#define C3_1_2_SYNC 0x02 -#define C3_CLEAR_CTS 0x04 -#define C3_CTUF 0x08 - - //************************************************************************** // LIVE DEVICE @@ -122,6 +77,9 @@ void mc6852_device::device_start() m_write_sm_dtr.resolve_safe(); m_write_tuf.resolve_safe(); + set_rcv_rate(m_rx_clock); + set_tra_rate(m_tx_clock); + // register for state saving save_item(NAME(m_status)); save_item(NAME(m_cr)); @@ -146,17 +104,16 @@ void mc6852_device::device_reset() m_rx_fifo = std::queue<UINT8>(); m_tx_fifo = std::queue<UINT8>(); - transmit_register_reset(); receive_register_reset(); + transmit_register_reset(); - set_rcv_rate(m_rx_clock); - set_tra_rate(m_tx_clock); + /* reset and inhibit receiver/transmitter sections */ + m_cr[0] |= (C1_TX_RS | C1_RX_RS); + m_cr[1] &= ~(C2_EIE | C2_PC2 | C2_PC1); + m_status &= ~S_TDRA; /* set receiver shift register to all 1's */ m_rsr = 0xff; - - /* reset and inhibit receiver/transmitter sections */ - m_cr[0] |= (C1_TX_RS | C1_RX_RS); } @@ -235,18 +192,40 @@ WRITE8_MEMBER( mc6852_device::write ) { switch (m_cr[0] & C1_AC_MASK) { - case C1_AC_C2: + case C1_AC_C2: { /* control 2 */ + if (LOG) logerror("MC6852 '%s' Control 2 %02x\n", tag(), data); m_cr[1] = data; + + int data_bit_count; + parity_t parity; + stop_bits_t stop_bits = STOP_BITS_1; + + switch (data & C2_WS_MASK) + { + case 0: data_bit_count = 6; parity = PARITY_EVEN; break; + case 1: data_bit_count = 6; parity = PARITY_ODD; break; + case 2: data_bit_count = 7; parity = PARITY_NONE; break; + case 3: data_bit_count = 8; parity = PARITY_NONE; break; + case 4: data_bit_count = 7; parity = PARITY_EVEN; break; + case 5: data_bit_count = 7; parity = PARITY_ODD; break; + case 6: data_bit_count = 8; parity = PARITY_EVEN; break; + case 7: data_bit_count = 8; parity = PARITY_ODD; break; + } + + set_data_frame(1, data_bit_count, parity, stop_bits); + } break; case C1_AC_C3: /* control 3 */ + if (LOG) logerror("MC6852 '%s' Control 3 %02x\n", tag(), data); m_cr[2] = data; break; case C1_AC_SYNC: /* sync code */ + if (LOG) logerror("MC6852 '%s' Sync Code %02x\n", tag(), data); m_scr = data; break; @@ -254,6 +233,7 @@ WRITE8_MEMBER( mc6852_device::write ) /* transmit data FIFO */ if (m_tx_fifo.size() < 3) { + if (LOG) logerror("MC6852 '%s' Transmit FIFO %02x\n", tag(), data); m_tx_fifo.push(data); } break; @@ -261,6 +241,8 @@ WRITE8_MEMBER( mc6852_device::write ) } else { + if (LOG) logerror("MC6852 '%s' Control 1 %02x\n", tag(), data); + /* receiver reset */ if (data & C1_RX_RS) { @@ -274,6 +256,8 @@ WRITE8_MEMBER( mc6852_device::write ) m_status &= ~(S_RX_OVRN | S_PE | S_DCD | S_RDA); m_rsr = 0xff; + + receive_register_reset(); } /* transmitter reset */ @@ -289,6 +273,8 @@ WRITE8_MEMBER( mc6852_device::write ) if (LOG) logerror("MC6852 '%s' Transmitter Reset\n", tag()); m_status &= ~(S_TUF | S_CTS | S_TDRA); + + transmit_register_reset(); } if (LOG) diff --git a/src/devices/machine/mc6852.h b/src/devices/machine/mc6852.h index 68cd76f6126..4987c64729b 100644 --- a/src/devices/machine/mc6852.h +++ b/src/devices/machine/mc6852.h @@ -99,6 +99,57 @@ protected: virtual void rcv_complete() override; private: + enum + { + S_IRQ = 0x80, + S_PE = 0x40, + S_RX_OVRN = 0x20, + S_TUF = 0x10, + S_CTS = 0x08, + S_DCD = 0x04, + S_TDRA = 0x02, + S_RDA = 0x01 + }; + + enum + { + C1_AC_MASK = 0xc0, + C1_AC_C2 = 0x00, + C1_AC_C3 = 0x40, + C1_AC_SYNC = 0x80, + C1_AC_TX_FIFO = 0xc0, + C1_AC2 = 0x80, + C1_AC1 = 0x40, + C1_RIE = 0x20, + C1_TIE = 0x10, + C1_CLEAR_SYNC = 0x08, + C1_STRIP_SYNC = 0x04, + C1_TX_RS = 0x02, + C1_RX_RS = 0x01 + }; + + enum + { + C2_EIE = 0x80, + C2_TX_SYNC = 0x40, + C2_WS_MASK = 0x38, + C2_WS3 = 0x20, + C2_WS2 = 0x10, + C2_WS1 = 0x08, + C2_1_2_BYTE = 0x04, + C2_PC_MASK = 0x03, + C2_PC2 = 0x02, + C2_PC1 = 0x01 + }; + + enum + { + C3_CTUF = 0x08, + C3_CTS = 0x04, + C3_1_2_SYNC = 0x02, + C3_E_I_SYNC = 0x01 + }; + devcb_write_line m_write_tx_data; devcb_write_line m_write_irq; devcb_write_line m_write_sm_dtr; diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp index 97c9559e9a9..d4d2be3d4b5 100644 --- a/src/emu/diimage.cpp +++ b/src/emu/diimage.cpp @@ -1255,53 +1255,6 @@ void device_image_interface::update_names(const device_type device_type, const c } //------------------------------------------------- -// software_name_split - helper that splits a -// software_list:software:part string into -// separate software_list, software, and part -// strings. -// -// str1:str2:str3 => swlist_name - str1, swname - str2, swpart - str3 -// str1:str2 => swlist_name - nullptr, swname - str1, swpart - str2 -// str1 => swlist_name - nullptr, swname - str1, swpart - nullptr -// -// Notice however that we could also have been -// passed a string swlist_name:swname, and thus -// some special check has to be performed in this -// case. -//------------------------------------------------- - -void device_image_interface::software_name_split(const std::string &swlist_swname, std::string &swlist_name, std::string &swname, std::string &swpart) -{ - // reset all output parameters - swlist_name.clear(); - swname.clear(); - swpart.clear(); - - // if no colon, this is the swname by itself - auto split1 = swlist_swname.find_first_of(':'); - if (split1 == std::string::npos) - { - swname = swlist_swname; - return; - } - - // if one colon, it is the swname and swpart alone - auto split2 = swlist_swname.find_first_of(':', split1 + 1); - if (split2 == std::string::npos) - { - swname = swlist_swname.substr(0, split1); - swpart = swlist_swname.substr(split1 + 1); - return; - } - - // if two colons present, split into 3 parts - swlist_name = swlist_swname.substr(0, split1); - swname = swlist_swname.substr(split1 + 1, split2 - (split1 + 1)); - swpart = swlist_swname.substr(split2 + 1); -} - - -//------------------------------------------------- // find_software_item //------------------------------------------------- @@ -1309,7 +1262,8 @@ const software_part *device_image_interface::find_software_item(const std::strin { // split full software name into software list name and short software name std::string swlist_name, swinfo_name, swpart_name; - software_name_split(path, swlist_name, swinfo_name, swpart_name); + if (!software_name_parse(path, &swlist_name, &swinfo_name, &swpart_name)) + return nullptr; // determine interface const char *interface = nullptr; diff --git a/src/emu/diimage.h b/src/emu/diimage.h index d2ea51c47e7..aac698230b8 100644 --- a/src/emu/diimage.h +++ b/src/emu/diimage.h @@ -238,7 +238,6 @@ public: bool load_software(software_list_device &swlist, const char *swname, const rom_entry *entry); int reopen_for_write(const std::string &path); - static void software_name_split(const std::string &swlist_swname, std::string &swlist_name, std::string &swname, std::string &swpart); static void static_set_user_loadable(device_t &device, bool user_loadable) { device_image_interface *img; if (!device.interface(img)) diff --git a/src/emu/image.cpp b/src/emu/image.cpp index 5fbc5844b9d..06998ad37e6 100644 --- a/src/emu/image.cpp +++ b/src/emu/image.cpp @@ -10,19 +10,13 @@ ***************************************************************************/ #include <ctype.h> -#include <regex> #include "emu.h" #include "emuopts.h" #include "image.h" #include "config.h" #include "xmlfile.h" - -//************************************************************************** -// STATIC VARIABLES -//************************************************************************** - -static std::regex s_potenial_softlist_regex("\\w+(\\:\\w+\\:\\w+)?"); +#include "softlist.h" //************************************************************************** @@ -54,7 +48,7 @@ image_manager::image_manager(running_machine &machine) image.set_init_phase(); // try as a softlist - if (std::regex_match(image_name, s_potenial_softlist_regex)) + if (software_name_parse(image_name)) result = image.load_software(image_name); // failing that, try as an image diff --git a/src/emu/softlist.cpp b/src/emu/softlist.cpp index d7a8b8d86d8..6ae687db843 100644 --- a/src/emu/softlist.cpp +++ b/src/emu/softlist.cpp @@ -8,10 +8,20 @@ ***************************************************************************/ +#include <regex> + #include "softlist.h" #include "hash.h" #include "expat.h" + +//************************************************************************** +// STATIC VARIABLES +//************************************************************************** + +static std::regex s_potenial_softlist_regex("\\w+(\\:\\w+)*"); + + //************************************************************************** // FEATURE LIST ITEM //************************************************************************** @@ -808,3 +818,65 @@ void softlist_parser::parse_soft_end(const char *tagname) } } + +//------------------------------------------------- +// software_name_parse - helper that splits a +// software_list:software:part string into +// separate software_list, software, and part +// strings. +// +// str1:str2:str3 => swlist_name - str1, swname - str2, swpart - str3 +// str1:str2 => swlist_name - nullptr, swname - str1, swpart - str2 +// str1 => swlist_name - nullptr, swname - str1, swpart - nullptr +// +// Notice however that we could also have been +// passed a string swlist_name:swname, and thus +// some special check has to be performed in this +// case. +//------------------------------------------------- + +bool software_name_parse(const std::string &text, std::string *swlist_name, std::string *swname, std::string *swpart) +{ + // first, sanity check the arguments + if (!std::regex_match(text, s_potenial_softlist_regex)) + return false; + + // reset all output parameters (if specified of course) + if (swlist_name != nullptr) + swlist_name->clear(); + if (swname != nullptr) + swname->clear(); + if (swpart != nullptr) + swpart->clear(); + + // if no colon, this is the swname by itself + auto split1 = text.find_first_of(':'); + if (split1 == std::string::npos) + { + if (swname != nullptr) + *swname = text; + return true; + } + + // if one colon, it is the swname and swpart alone + auto split2 = text.find_first_of(':', split1 + 1); + if (split2 == std::string::npos) + { + if (swname != nullptr) + *swname = text.substr(0, split1); + if (swpart != nullptr) + *swpart = text.substr(split1 + 1); + return true; + } + + // if two colons present, split into 3 parts + if (swlist_name != nullptr) + *swlist_name = text.substr(0, split1); + if (swname != nullptr) + *swname = text.substr(split1 + 1, split2 - (split1 + 1)); + if (swpart != nullptr) + *swpart = text.substr(split2 + 1); + return true; +} + + diff --git a/src/emu/softlist.h b/src/emu/softlist.h index 6f3b69deaa7..d38779afe5d 100644 --- a/src/emu/softlist.h +++ b/src/emu/softlist.h @@ -205,5 +205,10 @@ private: }; +// ----- Helpers ----- + +// parses a software name (e.g. - 'apple2e:agentusa:flop1') into its consituent parts (returns false if cannot parse) +bool software_name_parse(const std::string &text, std::string *swlist_name = nullptr, std::string *swname = nullptr, std::string *swpart = nullptr); + #endif // __SOFTLIST_H_ diff --git a/src/mame/drivers/victor9k.cpp b/src/mame/drivers/victor9k.cpp index 7563b4a37d4..46274813740 100644 --- a/src/mame/drivers/victor9k.cpp +++ b/src/mame/drivers/victor9k.cpp @@ -16,7 +16,6 @@ - RAM cards - clock cards - floppy 8048 - - hires graphics - brightness/contrast - MC6852 - codec sound @@ -86,46 +85,75 @@ INPUT_PORTS_END // MC6845 //------------------------------------------------- -#define CODE_NON_DISPLAY 0x1000 -#define CODE_UNDERLINE 0x2000 -#define CODE_LOW_INTENSITY 0x4000 -#define CODE_REVERSE_VIDEO 0x8000 +#define DC_SECRET 0x1000 +#define DC_UNDLN 0x2000 +#define DC_LOWINT 0x4000 +#define DC_RVS 0x8000 MC6845_UPDATE_ROW( victor9k_state::crtc_update_row ) { - address_space &program = m_maincpu->space(AS_PROGRAM); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + int hires = BIT(ma, 13); + int dot_addr = BIT(ma, 12); + int width = hires ? 16 : 10; + if (hires) x_count = 0x32; - if (BIT(ma, 13)) + if (m_hires != hires) { - fatalerror("Graphics mode not supported!\n"); + m_hires = hires; + m_crtc->set_clock(XTAL_30MHz / width); + m_crtc->set_hpixels_per_column(width); } - else + + address_space &program = m_maincpu->space(AS_PROGRAM); + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + + int x = hbp; + + offs_t aa = (ma & 0x7ff) << 1; + + for (int sx = 0; sx < x_count; sx++) { - UINT16 video_ram_addr = (ma & 0xfff) << 1; + UINT16 dc = (m_video_ram[aa + 1] << 8) | m_video_ram[aa]; + offs_t ab = (dot_addr << 15) | ((dc & 0x7ff) << 4) | (ra & 0x0f); + UINT16 dd = program.read_word(ab << 1); - for (int sx = 0; sx < x_count; sx++) - { - UINT16 code = (m_video_ram[video_ram_addr + 1] << 8) | m_video_ram[video_ram_addr]; - UINT32 char_ram_addr = (BIT(ma, 12) << 16) | ((code & 0xff) << 5) | (ra << 1); - UINT16 data = program.read_word(char_ram_addr); + int cursor = (sx == cursor_x) ? 1 : 0; + int undln = !((dc & DC_UNDLN) && BIT(dd, 15)) ? 2 : 0; + int rvs = (dc & DC_RVS) ? 4 : 0; + int secret = (dc & DC_SECRET) ? 1 : 0; + int lowint = (dc & DC_LOWINT) ? 1 : 0; - if (code & CODE_REVERSE_VIDEO) data ^= 0xffff; - if (code & CODE_NON_DISPLAY) data = 0; - if (sx == cursor_x) data = 0xffff; + for (int bit = 0; bit < width; bit++) + { + int pixel; - for (int x = 0; x <= 10; x++) + switch (rvs | undln | cursor) { - int pixel = BIT(data, x); - int color = palette[pixel && de]; - if (!(code & CODE_LOW_INTENSITY) && color) color = 2; + case 0: case 5: + pixel = 1; + break; + + case 1: case 4: + pixel = 0; + break; - bitmap.pix32(vbp + y, hbp + x + sx*10) = color; + case 2: case 7: + pixel = !(!(BIT(dd, bit) && !secret)); + break; + + case 3: case 6: + pixel = !(BIT(dd, bit) && !secret); + break; } - video_ram_addr += 2; - video_ram_addr &= 0xfff; + int color = palette[pixel && de]; + if (!lowint && color) color = 2; + + bitmap.pix32(vbp + y, x++) = color; } + + aa += 2; + aa &= 0xfff; } } @@ -473,7 +501,7 @@ static MACHINE_CONFIG_START( victor9k, victor9k_state ) MCFG_PALETTE_ADD_MONOCHROME_HIGHLIGHT("palette") - MCFG_MC6845_ADD(HD46505S_TAG, HD6845, SCREEN_TAG, XTAL_30MHz/11) // HD6845 == HD46505S + MCFG_MC6845_ADD(HD46505S_TAG, HD6845, SCREEN_TAG, XTAL_30MHz/10) // HD6845 == HD46505S MCFG_MC6845_SHOW_BORDER_AREA(true) MCFG_MC6845_CHAR_WIDTH(10) MCFG_MC6845_UPDATE_ROW_CB(victor9k_state, crtc_update_row) diff --git a/src/mame/includes/victor9k.h b/src/mame/includes/victor9k.h index c37b5a78d70..ad2ea141464 100644 --- a/src/mame/includes/victor9k.h +++ b/src/mame/includes/victor9k.h @@ -138,6 +138,7 @@ public: // video state int m_brt; int m_cont; + int m_hires; // interrupts int m_via1_irq; |