From ab1e83ee3cb4e44bb59870ad04446992dc7d34c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Larsson=20Edstr=C3=B6m?= Date: Sat, 18 May 2019 14:31:33 +0200 Subject: =?UTF-8?q?diablo1300:=20WIP=20Added=20new=20microcode,=20table=20?= =?UTF-8?q?rom=20and=20started=20looking=20at=E2=80=A6=20(#5067)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * diablo1300: WIP Added new microcode, table rom and started looking at a callback interface * diablo1300.cpp: relative reference to table rom and added carry to debugger registers --- src/devices/cpu/diablo/diablo1300.cpp | 30 ++++++++++++++++++++++++++---- src/devices/cpu/diablo/diablo1300.h | 21 +++++++++++++++++---- src/mame/drivers/diablo1300.cpp | 15 ++++++++++++--- 3 files changed, 55 insertions(+), 11 deletions(-) diff --git a/src/devices/cpu/diablo/diablo1300.cpp b/src/devices/cpu/diablo/diablo1300.cpp index 5c809be344d..841dc544172 100644 --- a/src/devices/cpu/diablo/diablo1300.cpp +++ b/src/devices/cpu/diablo/diablo1300.cpp @@ -15,13 +15,15 @@ // CONFIGURABLE LOGGING //************************************************************************** #define LOG_OP (1U << 1) +#define LOG_TABLE (1U << 2) -#define VERBOSE (LOG_GENERAL | LOG_OP) +#define VERBOSE (LOG_GENERAL | LOG_OP | LOG_TABLE) //#define LOG_OUTPUT_FUNC printf #include "logmacro.h" -#define LOGOP(...) LOGMASKED(LOG_OP, __VA_ARGS__) +#define LOGOP(...) LOGMASKED(LOG_OP, __VA_ARGS__) +#define LOGTABLE(...) LOGMASKED(LOG_TABLE, __VA_ARGS__) /*****************************************************************************/ @@ -62,6 +64,23 @@ inline void diablo1300_cpu_device::write_reg(uint16_t reg, uint8_t data) data_write8(reg, data); } +inline void diablo1300_cpu_device::write_port(uint16_t port, uint16_t data) +{ + // TODO: interact with mechanics/layout engine +} + +inline uint8_t diablo1300_cpu_device::read_table(uint16_t offset) +{ + LOGTABLE("Read %02x from table ROM offset %04x[%04x]\n", m_table->base()[offset & 0x1ff], offset & 0x1ff, offset); + return m_table->base()[offset & 0x1ff]; +} + +inline uint16_t diablo1300_cpu_device::read_ibus() +{ + // TODO: get signals from other boards + return 0; +} + /*****************************************************************************/ DEFINE_DEVICE_TYPE(DIABLO1300, diablo1300_cpu_device, "diablo1300", "DIABLO 1300") @@ -82,7 +101,7 @@ diablo1300_cpu_device::diablo1300_cpu_device(const machine_config &mconfig, cons , m_program(nullptr) , m_data(nullptr) , m_cache(nullptr) - + , m_table(nullptr) { // Allocate & setup } @@ -92,7 +111,8 @@ void diablo1300_cpu_device::device_start() { m_program = &space(AS_PROGRAM); m_data = &space(AS_DATA); - m_cache = m_program->cache<1, -1, ENDIANNESS_LITTLE>(); + m_cache = m_program->cache<1, -1, ENDIANNESS_LITTLE>(); + m_table = memregion("trom"); // register our state for the debugger state_add(STATE_GENPC, "GENPC", m_pc).noshow(); @@ -101,11 +121,13 @@ void diablo1300_cpu_device::device_start() state_add(DIABLO_PC, "PC", m_pc).mask(0x1ff); state_add(DIABLO_A, "A", m_a).mask(0xff); state_add(DIABLO_B, "B", m_b).mask(0xff); + state_add(DIABLO_CARRY, "CARRY", m_carry).formatstr("%1u"); /* setup regtable */ save_item(NAME(m_pc)); save_item(NAME(m_a)); save_item(NAME(m_b)); + save_item(NAME(m_carry)); save_item(NAME(m_power_on)); // set our instruction counter diff --git a/src/devices/cpu/diablo/diablo1300.h b/src/devices/cpu/diablo/diablo1300.h index 4919448c081..00328a28007 100644 --- a/src/devices/cpu/diablo/diablo1300.h +++ b/src/devices/cpu/diablo/diablo1300.h @@ -56,10 +56,10 @@ protected: inline uint8_t read_reg(uint16_t reg); inline uint16_t read_port(uint16_t port){ return 0;} - inline uint16_t read_table(uint16_t offset){ return 0;} + inline uint8_t read_table(uint16_t offset);// { return 0;} inline void write_reg(uint16_t reg, uint8_t data); - inline void write_port(uint16_t port, uint16_t data){} - inline uint16_t read_ibus(){ return 0; } + inline void write_port(uint16_t port, uint16_t data); + inline uint16_t read_ibus(); // { return 0; } // CPU registers uint16_t m_pc; @@ -75,6 +75,18 @@ protected: address_space *m_program; address_space *m_data; memory_access_cache<1, -1, ENDIANNESS_LITTLE> *m_cache; + + // rom regions + memory_region *m_table; + +#if 0 + // Callbacks and set methods + write_line_delegate m_xxx_cb; // Called when xxx happens in CPU + void call_xxx_cb(int state){ if (!m_xxx.cb.isnull()) (m_xxx_cb)(state); +public: + void set_xxx_callback( write_line_delegate callback ){ m_xxx_cb = callback; } + void set_line_yyy(int state){ m_yyy = state; } +#endif }; // device type definition @@ -88,7 +100,8 @@ enum { DIABLO_PC = 1, DIABLO_A, - DIABLO_B + DIABLO_B, + DIABLO_CARRY }; #endif // MAME_CPU_DIABLO_DIABLO1300_H diff --git a/src/mame/drivers/diablo1300.cpp b/src/mame/drivers/diablo1300.cpp index 692ad0730c5..a5b123b8311 100644 --- a/src/mame/drivers/diablo1300.cpp +++ b/src/mame/drivers/diablo1300.cpp @@ -156,12 +156,12 @@ private: }; void diablo1300_state::diablo1300_map(address_map &map) -{ //, AS_PROGRAM, 16, diablo1300_state ) +{ map(0x0000, 0x01ff).rom(); } void diablo1300_state::diablo1300_data_map(address_map &map) -{ // , AS_DATA, 8, diablo1300_state ) +{ map(0x00, 0x1f).ram(); } @@ -188,9 +188,18 @@ ROM_START( diablo ) ROM_REGION( 0x10000, "maincpu", ROMREGION_16BIT ) ROM_DEFAULT_BIOS("diablo1300") - ROM_SYSTEM_BIOS(0, "diablo1300", "Diablo Printer Series 1300 14510-xx CPU microcode") + ROM_SYSTEM_BIOS(0, "diablo1300", "Diablo Printer Series 1300 14510-xx CPU microcode") // Recreated 82S115 binaries using Jeffs documentation ROMX_LOAD ("diablo1300.odd", 0x0001, 0x200, CRC (5e295350) SHA1 (6ea9a22b23b8bab93ae57671541d65dba698c722), ROM_SKIP(1) | ROM_BIOS(0)) ROMX_LOAD ("diablo1300.even", 0x0000, 0x200, CRC (85562eb1) SHA1 (9335eeeabdd37255d6ffee153a027944a4519126), ROM_SKIP(1) | ROM_BIOS(0)) + + ROM_SYSTEM_BIOS(1, "diablo1355", "Diablo Printer 1355WP 14510-xx CPU microcode") // Dumped 82S115 using Arduino + ROMX_LOAD ("13067-36.bin", 0x0001, 0x200, CRC (b8bf070f) SHA1 (c51f9f4009a771b1d0e9c948592c988b1f4e840f), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD ("13066-35.bin", 0x0000, 0x200, CRC (73698143) SHA1 (5d2b3e956ae0d2b606d081a242fc64928e68687d), ROM_SKIP(1) | ROM_BIOS(1)) + + ROM_REGION(0x1000, "trom", 0) + /* Table ROM, holds data for specific mechnical configuration of the printer engine, such as the number of characters and hammer energy for each character */ + ROM_LOAD( "55wp92ch.bin", 0x0000, 0x200, CRC(58ba7913) SHA1(968e87318b49ad05a66a8148e9048bfbeba2a97f) ) // Dumped 82S115 using Arduino + ROM_END // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME -- cgit v1.2.3