trunk/src/mame/drivers/didact.cpp
| r252954 | r252955 | |
| 1 | 1 | // license:BSD-3-Clause |
| 2 | 2 | // copyright-holders:Joakim Larsson Edstrom |
| 3 | 3 | /* |
| 4 | | * The Didact Esselte 100 CPU board |
| 5 | 4 | *__________________________________________________________________________________________________________ |
| 6 | | * | |
| 5 | * The Didact Esselte 100 CPU board | |
| 7 | 6 | *__________________________________________________________________________________________________________| |
| 8 | 7 | * |
| 9 | | * The Didact Mikrodator 6802 CPU board by lars Björklund 1983 |
| 10 | | *__________________________________________________________________________________________________________ |
| 11 | | * | |
| 12 | | *__________________________________________________________________________________________________________| |
| 8 | * ___________________________________________________________________________________________________________ _____________________________________________________ |
| 9 | * | The Didact Mp68A CPU board, by Anders Andersson 1979 | |The Didact Mp68A keypad/display PB6 +oooo+ | |
| 10 | * | +------+ +-------+ +--+ | | by Anders Andersson 1979 +-------+ |cass| | |
| 11 | * | | 7402 | | 74490 | | | +-------+ +--+ | | +--+ | 9368 | +----+ +--+| |
| 12 | * | +-------+ +------+ +-------+ | | | | | | | |+-------+ 2x5082-|B | +-------+ | || |
| 13 | * | | | 2112 2112 | | | EXP | | | | || 74132 | 7433|CD| 145 PA0-PA3 |E || |
| 14 | * | | ROM | +--+ +--+ +--+ | ANS | |P | | |+-------+ |DI| +--+ 132 |X || |
| 15 | * | | 7641 | | | | | | ION | |I | | |+------+------+ | S| | | +--+ |P || |
| 16 | * | | | |A | |B | +-----+ | BUSES | |A | | || |SHIFT | | P| | | PA4-PA6 | | |A || |
| 17 | * | | 512x8 | | | | | | | | (2 x) | | | | || RES |(led) | +--+ | | | | |N || |
| 18 | * | | | +--+ +--+ | | | FOR | |A | | || | * | +--+ | | |S || |
| 19 | * | +-------+ RAMS 4x256x4 | | | | | | | |+------+------+------+------+ +--+ |I || |
| 20 | * | ROMS 2x512x8 2112 2112 | | | KEY | |E | | || | | | | |O || |
| 21 | * | +-------+ +--+ +--+ |CPU | | BOARD | +------+ |X | | || ADR | RUN | SST | REG | |N || |
| 22 | * | | | | | | | |6800 | | | | | |P | | || 0 | 4 | 8 | C | | || |
| 23 | * | | ROM | |A | |B | | | | AND | | | |A | | |+------+------+------+------+ |C || |
| 24 | * | | 7641 | | | | | | | | | | | |N | | || | | | | |O || |
| 25 | * | | | +--+ +--+ | | | I/O | | 6820 | |S | | || STA | STO | BPR | BPS | |N || |
| 26 | * | | 512x8 | 512 bytes RAM | | | BOARDS| | PIA | |I | | || 1 | 5 | 9 | D | |N || |
| 27 | * | +-------+ | | | | | #1 | |O | +-----+ |+------+------+------+------+ +------+ |E || |
| 28 | * | 1024 bytes ROM | | | | | | |N | | | || | | | | | | |C || |
| 29 | * | +-----+ | | | | | | PIA A | | || EXF | EXB | MOV | PRM | | | |T || |
| 30 | * | 7402 7412 | | | | |B | EXPANSION| | || 2 | 6 | A | E | | | |O || |
| 31 | * | +--+ +--+ | | | | |U | CONNECTOR| | |+------+------+------+------+ | 6820 | |R || |
| 32 | * | | | | | | | | | |S | | _| || | | | | | PIA | | || |
| 33 | * | | | | | | | | | | | J4 | | || CLR | REL | REC | PLA | | #2 | | || |
| 34 | * | | | | | | | +------+ | | | |_ || 3 | 7 | B | F | | | | || |
| 35 | * | +--+ +--+ +--------+ | | | | | | |+------+------+------+------+ | | | || |
| 36 | * | +-+ | 96LS02 | | | | | | | | +-------+ +-------+ +------+ | | | || |
| 37 | * | R * * * R |T| +--------+ | | | | | | | | 74148 | | 74148 | | 7400 | | | | || |
| 38 | * | O X A |R| | | | | | | | +-------+ +-------+ +------+ | | +--+| |
| 39 | * | M * * * M |M| Oscillator circuits +-------+ +--+ | | | PB3 PB0-PB2 | | | |
| 40 | * | |_| J1 J2 J3 +-----+ | +---------+ +------+ J1 | |
| 41 | * |____________________________________________________________________________________________________________| |______ | _|||_ |___________________________________| |
| 13 | 42 | * |
| 14 | | * The Didact Mp68A CPU board, by Anders Andersson 1979 |
| 15 | | *__________________________________________________________________________________________________________ |
| 16 | | * 74138 | |
| 17 | | * +------+ +-------+ +--+ | |
| 18 | | * | 7402 | | 74490 | | | +-------+ +--+ | |
| 19 | | * +-------+ +------+ +-------+ | | | | | | | |
| 20 | | * | | 2112 2112 | | | EXP | | | | |
| 21 | | * | ROM | +--+ +--+ +--+ | ANS | |P | | |
| 22 | | * | 7641 | | | | | | ION | |I | | |
| 23 | | * | | |A | |B | +-----+ | BUSES | |A | | |
| 24 | | * | 512x8 | | | | | | | | (2 x) | | | | |
| 25 | | * | | +--+ +--+ | | | FOR | |A | | |
| 26 | | * +-------+ RAMS 4x256x4 | | | | | | | |
| 27 | | * ROMS 2x512x8 2112 2112 | | | KEY | |E | | |
| 28 | | * +-------+ +--+ +--+ |CPU | | BOARD | +------+ |X | | |
| 29 | | * | | | | | | |6800 | | | | | |P | | |
| 30 | | * | ROM | |A | |B | | | | AND | | | |A | | |
| 31 | | * | 7641 | | | | | | | | | | | |N | | |
| 32 | | * | | +--+ +--+ | | | I/O | | 6820 | |S | | |
| 33 | | * | 512x8 | 512 bytes RAM | | | BOARDS| | PIA | |I | | |
| 34 | | * +-------+ | | | | | #1 | |O | +-----+ |
| 35 | | * 1024 bytes ROM | | | | | | |N | | | |
| 36 | | * +-----+ | | | | | | PIA A | | |
| 37 | | * 7402 7412 | | | | |B | EXPANSION| | |
| 38 | | * +--+ +--+ | | | | |U | CONNECTOR| | |
| 39 | | * | | | | | | | | |S | | _| |
| 40 | | * | | | | | | | | | | J4 | | |
| 41 | | * | | | | | | +------+ | | | |_ |
| 42 | | * +--+ +--+ +--------+ | | | | | | |
| 43 | | * +-+ | 96LS02 | | | | | | | |
| 44 | | * R * * * R |T| +--------+ | | | | | | |
| 45 | | * O X A |R| | | | | | | |
| 46 | | * M * * * M |M| Oscillator circuits +-------+ +--+ | | |
| 47 | | * |_| J1 J2 J3 +-----+ |
| 48 | | *__________________________________________________________________________________________________________| |
| 43 | * _____________________________________________________________________________________________ ___________________________________________________________________________ |
| 44 | * |The Didact Mikrodator 6802 CPU board by Lars Björklund 1983 ( ) | |The Didact Mikrodator 6802 TB16 board by Lars Björklund 1983 | |
| 45 | * | +----= | | +-|||||||-+ ______ | |
| 46 | * | | = | | CA2 Tx |terminal | | () | | |
| 47 | * | | = | | PA7 Rx +---------+ +----------+ C1nF,<=R18k| | | |
| 48 | * | Photo of CPU board mainly covered by TB16 Keypad/Display board +--- = | | CA1 DTR +-----------+ | | CB2->CB1 | E | | |
| 49 | * | | | PA4-PA6 | | 1 | BCD | +----+ | X | | |
| 50 | * | | | ------->| 74LS145 | | digit 5 | |LS | | P | | |
| 51 | * | | | +-----------+ |----------| | 122| | A | | |
| 52 | * | +-----=| | | | | | | | N | | |
| 53 | * | +-------+ | =| |------ +--------+ | 2 | BCD | | | | S | | |
| 54 | * | | | | =| | RES* | SHIFT | LED( ) | | digit 4 | | | | I | | |
| 55 | * | | | | =| | | '*' | CA2 v |----------| +----+ | O | | |
| 56 | * | | 6821 | | =| | PA3 |PA7 PA2 | PA1 PA0 | | +----| N | | |
| 57 | * | | PIA | | =| |----|--+-----|--+--|-----+--|---+ 3 | | PB0-|LS | | | |
| 58 | * | | | | =| | v | v | v | v | | BCD | PB7| 244| C | | |
| 59 | * | | | | =| | ADR | RUN | SST | CON | 1 | digit 3 | --->| | O | | |
| 60 | * | | | | =| | 0 | 4 | 8 | C | |----------| | | N | | |
| 61 | * | | | | =| |-------+--------+--------+------+ | |<-------| | N | | |
| 62 | * | | | | =| | | | | | 4 | | +----| E | | |
| 63 | * | | | | =| | STA | BPS | USERV | | 2 | BCD | | C | | |
| 64 | * | | | | =| | 1 | 5 | 9 | D | | digit 2 | | T | | |
| 65 | * | | | | =| |-------+--------+--------+------+ |----------| | O | | |
| 66 | * | | | | =| | | | | | | | | R | | |
| 67 | * | | | | =| | EXF | EXB | MOV | LOAD | 3 5 | BCD | | | | |
| 68 | * | | | | =| | 2 | 6 | A | E | | digit 1 | | | | |
| 69 | * | +-------+ | =| |-------+--------+--------+------+ |----------| | | | |
| 70 | * | | =| | | | | | | | | | | |
| 71 | * | +-----=| | CLR | SP | USERJ | FLAG | 4 6 | BCD | | | | |
| 72 | * | | | 3 | 7 | B | F | | digit 0 | | () | | |
| 73 | * | | |-------+--------+--------+------+ +----------+ +------+ | |
| 74 | * | | | | |
| 75 | * | | | | |
| 76 | * |____________________________________________________________________________________________| |___________________________________________________________________________| |
| 49 | 77 | * |
| 50 | | * The Didact Mp68A Keypad and Display board, tb16a, Anders Andersson 1979 |
| 51 | | *______________________________________________________ |
| 52 | | * +oooo+ | |
| 53 | | * 6064 +-------+ |cass| | |
| 54 | | * +--+ | 9368 | +----+ +--+| |
| 55 | | * +-------+ |B | +-------+ | || |
| 56 | | * | 74132 | |CD| 145 |E || |
| 57 | | * +-------+ |DI| +--+ 132 |X || |
| 58 | | * +------+------+ | S| | | +--+ |P || |
| 59 | | * | | | | P| | | | | |A || |
| 60 | | * | RES |(led) | +--+ | | | | |N || |
| 61 | | * | | * | +--+ | | |S || |
| 62 | | * +------+------+------+------+ +--+ |I || |
| 63 | | * | | | | | |O || |
| 64 | | * | ADR | RUN | SST | REG | |N || |
| 65 | | * | 0 | 4 | 8 | C | | || |
| 66 | | * +------+------+------+------+ |C || |
| 67 | | * | | | | | |O || |
| 68 | | * | STA | STO | BPR | BPS | |N || |
| 69 | | * | 1 | 5 | 9 | D | |N || |
| 70 | | * +------+------+------+------+ +------+ |E || |
| 71 | | * | | | | | | | |C || |
| 72 | | * | EXF | EXB | MOV | PRM | | | |T || |
| 73 | | * | 2 | 6 | A | E | | | |O || |
| 74 | | * +------+------+------+------+ | 6820 | |R || |
| 75 | | * | | | | | | PIA | | || |
| 76 | | * | CLR | REL | REC | PLA | | #2 | | || |
| 77 | | * | 3 | 7 | B | F | | | | || |
| 78 | | * +------+------+------+------+ | | | || |
| 79 | | * +-------+ +-------+ +------+ | | | || |
| 80 | | * | 74148 | | 74148 | | 7400 | | | | || |
| 81 | | * +-------+ +-------+ +------+ | | +--+| |
| 82 | | * | | | |
| 83 | | * +---------+ +------+ J1 | |
| 84 | | *________| ___ |___________________________________| |
| 85 | | * | _|||_ | |
| 86 | | * /|_| |_|\ |
| 87 | | * |
| 88 | | * |
| 89 | 78 | * History of Didact |
| 90 | 79 | *------------------ |
| 91 | 80 | * Didact Läromedelsproduktion was started in Linköping in Sweden by Anders Andersson, Arne Kullbjer and |
| r252954 | r252955 | |
| 98 | 87 | * |
| 99 | 88 | * Misc links about the boards supported by this driver. |
| 100 | 89 | *----------------------------------------------------- |
| 101 | | * http://www.elektronikforumet.com/forum/viewtopic.php?f=11&t=51424 |
| 90 | * http://elektronikforumet.com/forum/viewtopic.php?f=11&t=51424 |
| 102 | 91 | * http://kilroy71.fastmail.fm/gallery/Miscellaneous/20120729_019.jpg |
| 103 | 92 | * http://elektronikforumet.com/forum/download/file.php?id=63988&mode=view |
| 104 | 93 | * http://elektronikforumet.com/forum/viewtopic.php?f=2&t=79576&start=150#p1203915 |
| 105 | 94 | * |
| 106 | | * TODO: |
| 107 | | * Didact designs: mp68a, md6802, Esselte 100, Candela |
| 95 | * TODO: |
| 96 | * Didact designs: mp68a, md6802, md6802v3, Esselte 100, Candela |
| 108 | 97 | * -------------------------------------------------------------------------- |
| 109 | | * - Add PCB layouts OK |
| 98 | * - Add PCB layouts OK OK |
| 110 | 99 | * - Dump ROM:s, OK OK |
| 111 | | * - Keyboard OK |
| 112 | | * - Display/CRT OK |
| 113 | | * - Clickable Artwork RQ |
| 114 | | * - Sound NA |
| 100 | * - Keyboard OK OK |
| 101 | * - Display/CRT OK OK |
| 102 | * - Clickable Artwork RQ RQ |
| 103 | * - Sound NA NA |
| 115 | 104 | * - Cassette i/f |
| 116 | 105 | * - Expansion bus |
| 117 | 106 | * - Expansion overlay |
| 118 | 107 | * |
| 108 | * - The md6802 has a strange delay in keyboard input that needs to be investigated |
| 109 | * |
| 119 | 110 | ****************************************************************************/ |
| 120 | 111 | |
| 121 | 112 | #include "emu.h" |
| 122 | 113 | #include "cpu/m6800/m6800.h" |
| 123 | 114 | #include "machine/6821pia.h" // For all boards |
| 124 | 115 | #include "video/dm9368.h" // For the mp68a |
| 116 | #include "machine/74145.h" // For the md6802 |
| 117 | // Generated artwork includes |
| 118 | #include "mp68a.lh" |
| 119 | #include "md6802.lh" |
| 125 | 120 | |
| 126 | 121 | #define VERBOSE 0 |
| 127 | 122 | |
| 128 | 123 | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) |
| 129 | | #if VERBOSE == 2 |
| 124 | #if VERBOSE >= 2 |
| 130 | 125 | #define logerror printf |
| 131 | 126 | #endif |
| 132 | 127 | |
| r252954 | r252955 | |
| 136 | 131 | #define FUNCNAME __PRETTY_FUNCTION__ |
| 137 | 132 | #endif |
| 138 | 133 | |
| 134 | /* Didact base class */ |
| 135 | class didact_state : public driver_device |
| 136 | { |
| 137 | public: |
| 138 | didact_state(const machine_config &mconfig, device_type type, const char * tag) |
| 139 | : driver_device(mconfig, type, tag) |
| 140 | ,m_io_line0(*this, "LINE0") |
| 141 | ,m_io_line1(*this, "LINE1") |
| 142 | ,m_io_line2(*this, "LINE2") |
| 143 | ,m_io_line3(*this, "LINE3") |
| 144 | ,m_io_line4(*this, "LINE4") |
| 145 | ,m_line0(0) |
| 146 | ,m_line1(0) |
| 147 | ,m_line2(0) |
| 148 | ,m_line3(0) |
| 149 | ,m_reset(0) |
| 150 | ,m_shift(0) |
| 151 | ,m_led(0) |
| 152 | { } |
| 153 | required_ioport m_io_line0; |
| 154 | required_ioport m_io_line1; |
| 155 | required_ioport m_io_line2; |
| 156 | required_ioport m_io_line3; |
| 157 | required_ioport m_io_line4; |
| 158 | UINT8 m_line0; |
| 159 | UINT8 m_line1; |
| 160 | UINT8 m_line2; |
| 161 | UINT8 m_line3; |
| 162 | UINT8 m_reset; |
| 163 | UINT8 m_shift; |
| 164 | UINT8 m_led; |
| 165 | TIMER_DEVICE_CALLBACK_MEMBER(scan_artwork); |
| 166 | }; |
| 167 | |
| 139 | 168 | /* Esselte 100 driver class */ |
| 140 | | class e100_state : public driver_device |
| 169 | class e100_state : public didact_state |
| 141 | 170 | { |
| 142 | 171 | public: |
| 143 | | e100_state(const machine_config &mconfig, device_type type, const char *tag) |
| 144 | | : driver_device(mconfig, type, tag), |
| 172 | e100_state(const machine_config &mconfig, device_type type, const char * tag) |
| 173 | : didact_state(mconfig, type, tag), |
| 145 | 174 | m_maincpu(*this, "maincpu"), |
| 146 | 175 | m_pia1(*this, "pia1"), |
| 147 | 176 | m_pia2(*this, "pia2") |
| 148 | 177 | { } |
| 149 | 178 | required_device<m6802_cpu_device> m_maincpu; |
| 150 | | |
| 179 | virtual void machine_reset() override { m_maincpu->reset(); LOG(("--->%s()\n", FUNCNAME)); }; |
| 151 | 180 | protected: |
| 152 | 181 | required_device<pia6821_device> m_pia1; |
| 153 | 182 | required_device<pia6821_device> m_pia2; |
| 154 | 183 | }; |
| 155 | 184 | |
| 156 | 185 | /* Mikrodator 6802 driver class */ |
| 157 | | class md6802_state : public driver_device |
| 186 | class md6802_state : public didact_state |
| 158 | 187 | { |
| 159 | 188 | public: |
| 160 | | md6802_state(const machine_config &mconfig, device_type type, const char *tag) |
| 161 | | : driver_device(mconfig, type, tag), |
| 162 | | m_maincpu(*this, "maincpu"), |
| 163 | | m_pia1(*this, "pia1"), |
| 164 | | m_pia2(*this, "pia2") |
| 189 | md6802_state(const machine_config &mconfig, device_type type, const char * tag) |
| 190 | : didact_state(mconfig, type, tag) |
| 191 | ,m_maincpu(*this, "maincpu") |
| 192 | ,m_tb16_74145(*this, "tb16_74145") |
| 193 | ,m_segments(0) |
| 194 | ,m_pia1(*this, "pia1") |
| 195 | ,m_pia2(*this, "pia2") |
| 165 | 196 | { } |
| 166 | 197 | required_device<m6802_cpu_device> m_maincpu; |
| 198 | required_device<ttl74145_device> m_tb16_74145; |
| 199 | UINT8 m_segments; |
| 200 | DECLARE_READ8_MEMBER( pia2_kbA_r ); |
| 201 | DECLARE_WRITE8_MEMBER( pia2_kbA_w ); |
| 202 | DECLARE_READ8_MEMBER( pia2_kbB_r ); |
| 203 | DECLARE_WRITE8_MEMBER( pia2_kbB_w ); |
| 204 | DECLARE_WRITE_LINE_MEMBER( pia2_ca2_w); |
| 167 | 205 | |
| 206 | virtual void machine_reset() override; |
| 207 | virtual void machine_start() override; |
| 168 | 208 | protected: |
| 169 | 209 | required_device<pia6821_device> m_pia1; |
| 170 | 210 | required_device<pia6821_device> m_pia2; |
| 171 | 211 | }; |
| 172 | 212 | |
| 213 | /* Keyboard */ |
| 214 | READ8_MEMBER( md6802_state::pia2_kbA_r ) |
| 215 | { |
| 216 | UINT8 ls145; |
| 217 | UINT8 pa = 0xff; |
| 173 | 218 | |
| 219 | // Read out the selected column |
| 220 | ls145 = m_tb16_74145->read() & 0x0f; |
| 221 | |
| 222 | // read out the artwork, line04 is handled by the timer |
| 223 | m_line0 = m_io_line0->read(); |
| 224 | m_line1 = m_io_line1->read(); |
| 225 | m_line2 = m_io_line2->read(); |
| 226 | m_line3 = m_io_line3->read(); |
| 227 | |
| 228 | #if VERBOSE > 2 |
| 229 | if ((m_line0 | m_line1 | m_line2 | m_line3) != 0) |
| 230 | LOG(("%s()-->%02x %02x %02x %02x modified by %02x displaying %02x\n", FUNCNAME, m_line0, m_line1, m_line2, m_line3, m_shift, ls145)); |
| 231 | #endif |
| 232 | |
| 233 | // Mask out those rows that has a button pressed |
| 234 | pa &= ~(((~m_line0 & ls145 ) != 0) ? 1 : 0); |
| 235 | pa &= ~(((~m_line1 & ls145 ) != 0) ? 2 : 0); |
| 236 | pa &= ~(((~m_line2 & ls145 ) != 0) ? 4 : 0); |
| 237 | pa &= ~(((~m_line3 & ls145 ) != 0) ? 8 : 0); |
| 238 | |
| 239 | if (m_shift) |
| 240 | { |
| 241 | pa &= 0x7f; // Clear shift bit if button being pressed (PA7) to ground (internal pullup) |
| 242 | LOG( ("SHIFT is pressed\n") ); |
| 243 | } |
| 244 | |
| 245 | #if VERBOSE > 2 |
| 246 | if ((m_line0 | m_line1 | m_line2 | m_line3) != 0) |
| 247 | LOG(("%s()-->LINE: 0:%02x 1:%02x 2:%02x 3:%02x SHIFT:%02x LS145:%02x PA:%02x\n", FUNCNAME, m_line0, m_line1, m_line2, m_line3, m_shift, ls145, pa)); |
| 248 | #endif |
| 249 | |
| 250 | return pa; |
| 251 | } |
| 252 | |
| 253 | /* Pull the cathodes low enabling the correct digit and lit the segments held by port B */ |
| 254 | WRITE8_MEMBER( md6802_state::pia2_kbA_w ) |
| 255 | { |
| 256 | UINT8 digit_nbr; |
| 257 | |
| 258 | // LOG(("--->%s(%02x)\n", FUNCNAME, data)); |
| 259 | |
| 260 | digit_nbr = (data >> 4) & 0x07; |
| 261 | m_tb16_74145->write( digit_nbr ); |
| 262 | if (digit_nbr < 6) |
| 263 | { |
| 264 | output().set_digit_value( digit_nbr, m_segments); |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | /* PIA 2 Port B is all outputs to drive the display so it is very unlikelly that this function is called */ |
| 269 | READ8_MEMBER( md6802_state::pia2_kbB_r ) |
| 270 | { |
| 271 | LOG( ("Warning, trying to read from Port B designated to drive the display, please check why\n") ); |
| 272 | logerror("Warning, trying to read from Port B designated to drive the display, please check why\n"); |
| 273 | return 0; |
| 274 | } |
| 275 | |
| 276 | /* Port B is fully used ouputting the segment pattern to the display */ |
| 277 | WRITE8_MEMBER( md6802_state::pia2_kbB_w ) |
| 278 | { |
| 279 | // LOG(("--->%s(%02x)\n", FUNCNAME, data)); |
| 280 | |
| 281 | /* Store the segment pattern but do not lit up the digit here, done by pulling the correct cathode low on Port A */ |
| 282 | m_segments = BITSWAP8(data, 0, 4, 5, 3, 2, 1, 7, 6); |
| 283 | } |
| 284 | |
| 285 | WRITE_LINE_MEMBER( md6802_state::pia2_ca2_w ) |
| 286 | { |
| 287 | LOG(("--->%s(%02x) LED is connected through resisitor to +5v so logical 0 will lit it\n", FUNCNAME, state)); |
| 288 | output().set_led_value(m_led, !state); |
| 289 | m_shift = !state; |
| 290 | } |
| 291 | |
| 292 | void md6802_state::machine_start() |
| 293 | { |
| 294 | LOG(("--->%s()\n", FUNCNAME)); |
| 295 | save_item(NAME(m_shift)); |
| 296 | save_item(NAME(m_led)); |
| 297 | save_item(NAME(m_reset)); |
| 298 | } |
| 299 | |
| 300 | void md6802_state::machine_reset() |
| 301 | { |
| 302 | LOG(("--->%s()\n", FUNCNAME)); |
| 303 | m_led = 1; |
| 304 | m_maincpu->reset(); |
| 305 | } |
| 306 | |
| 174 | 307 | /* Didact mp68a driver class */ |
| 308 | |
| 175 | 309 | // Just a statement that the real mp68a hardware was designed with 6820 and not 6821 |
| 176 | 310 | // They are functional equivalents BUT has different electrical characteristics. |
| 177 | 311 | #define pia6820_device pia6821_device |
| 178 | 312 | #define PIA6820 PIA6821 |
| 179 | | class mp68a_state : public driver_device |
| 313 | class mp68a_state : public didact_state |
| 180 | 314 | { |
| 181 | 315 | public: |
| 182 | | mp68a_state(const machine_config &mconfig, device_type type, const char *tag) |
| 183 | | : driver_device(mconfig, type, tag) |
| 184 | | ,m_maincpu(*this, "maincpu") |
| 185 | | ,m_io_line0(*this, "LINE0") |
| 186 | | ,m_io_line1(*this, "LINE1") |
| 187 | | ,m_io_line2(*this, "LINE2") |
| 188 | | ,m_io_line3(*this, "LINE3") |
| 189 | | ,m_io_line4(*this, "LINE4") |
| 190 | | ,m_line0(0) |
| 191 | | ,m_line1(0) |
| 192 | | ,m_line2(0) |
| 193 | | ,m_line3(0) |
| 194 | | ,m_shift(0) |
| 316 | mp68a_state(const machine_config &mconfig, device_type type, const char * tag) |
| 317 | : didact_state(mconfig, type, tag) |
| 318 | ,m_maincpu(*this, "maincpu") |
| 195 | 319 | ,m_digit0(*this, "digit0") |
| 196 | 320 | ,m_digit1(*this, "digit1") |
| 197 | 321 | ,m_digit2(*this, "digit2") |
| r252954 | r252955 | |
| 204 | 328 | |
| 205 | 329 | required_device<m6800_cpu_device> m_maincpu; |
| 206 | 330 | |
| 207 | | required_ioport m_io_line0; |
| 208 | | required_ioport m_io_line1; |
| 209 | | required_ioport m_io_line2; |
| 210 | | required_ioport m_io_line3; |
| 211 | | required_ioport m_io_line4; |
| 212 | | UINT8 m_line0; |
| 213 | | UINT8 m_line1; |
| 214 | | UINT8 m_line2; |
| 215 | | UINT8 m_line3; |
| 216 | | UINT8 m_shift; |
| 217 | | |
| 218 | | // The display segment driver device |
| 331 | // The display segment driver device (there is actually just one, needs rewrite to be correct) |
| 219 | 332 | required_device<dm9368_device> m_digit0; |
| 220 | 333 | required_device<dm9368_device> m_digit1; |
| 221 | 334 | required_device<dm9368_device> m_digit2; |
| r252954 | r252955 | |
| 229 | 342 | DECLARE_WRITE8_MEMBER( pia2_kbB_w ); |
| 230 | 343 | DECLARE_READ_LINE_MEMBER( pia2_cb1_r ); |
| 231 | 344 | |
| 345 | virtual void machine_reset() override; |
| 232 | 346 | virtual void machine_start() override; |
| 233 | | TIMER_DEVICE_CALLBACK_MEMBER(scan_artwork); |
| 234 | 347 | protected: |
| 235 | 348 | required_device<pia6820_device> m_pia1; |
| 236 | 349 | required_device<pia6820_device> m_pia2; |
| r252954 | r252955 | |
| 245 | 358 | |
| 246 | 359 | WRITE8_MEMBER( mp68a_state::pia2_kbA_w ) |
| 247 | 360 | { |
| 248 | | UINT8 m_lednum; |
| 361 | UINT8 digit_nbr; |
| 249 | 362 | |
| 250 | 363 | #if VERBOSE > 1 |
| 251 | 364 | static UINT8 display[] = {' ',' ',' ',' ',' ',' ',' ',' ','\0'}; |
| r252954 | r252955 | |
| 254 | 367 | |
| 255 | 368 | /* Display memory is at $702 to $708 in AAAADD format (A=address digit, D=Data digit) |
| 256 | 369 | but we are using data read from the port. */ |
| 257 | | m_lednum = (data >> 4) & 0x07; |
| 370 | digit_nbr = (data >> 4) & 0x07; |
| 258 | 371 | |
| 259 | | switch (m_lednum) |
| 372 | /* There is actually only one 9368 and a 74145 to drive the cathode of the right digit low */ |
| 373 | /* This can be emulated by prentending there are one 9368 per digit, at least for now */ |
| 374 | switch (digit_nbr) |
| 260 | 375 | { |
| 261 | 376 | case 0: m_digit0->a_w(data & 0x0f); break; |
| 262 | 377 | case 1: m_digit1->a_w(data & 0x0f); break; |
| r252954 | r252955 | |
| 265 | 380 | case 4: m_digit4->a_w(data & 0x0f); break; |
| 266 | 381 | case 5: m_digit5->a_w(data & 0x0f); break; |
| 267 | 382 | case 7: break; // used as an 'unselect' by the ROM between digit accesses. |
| 268 | | default: logerror("Wrong digit index %d\n", m_lednum); |
| 383 | default: logerror("Invalid digit index %d\n", digit_nbr); |
| 269 | 384 | } |
| 270 | 385 | |
| 271 | 386 | #if VERBOSE > 1 |
| r252954 | r252955 | |
| 277 | 392 | READ8_MEMBER( mp68a_state::pia2_kbB_r ) |
| 278 | 393 | { |
| 279 | 394 | UINT8 a012, line, pb; |
| 280 | | |
| 395 | |
| 281 | 396 | LOG(("--->%s %02x %02x %02x %02x %02x => ", FUNCNAME, m_line0, m_line1, m_line2, m_line3, m_shift)); |
| 282 | 397 | |
| 283 | 398 | a012 = 0; |
| r252954 | r252955 | |
| 294 | 409 | } |
| 295 | 410 | |
| 296 | 411 | pb = a012; // A0-A2 -> PB0-PB3 |
| 412 | |
| 297 | 413 | if (m_shift) |
| 298 | 414 | { |
| 299 | 415 | pb |= 0x80; // Set shift bit (PB7) |
| 300 | 416 | m_shift = 0; // Reset flip flop |
| 301 | | output().set_led_value(0, m_shift); |
| 417 | output().set_led_value(m_led, m_shift); |
| 302 | 418 | LOG( ("SHIFT is released\n") ); |
| 303 | 419 | } |
| 304 | 420 | |
| r252954 | r252955 | |
| 327 | 443 | return (m_line0 | m_line1 | m_line2 | m_line3) != 0 ? 0 : 1; |
| 328 | 444 | } |
| 329 | 445 | |
| 446 | void mp68a_state::machine_reset() |
| 447 | { |
| 448 | LOG(("--->%s()\n", FUNCNAME)); |
| 449 | m_maincpu->reset(); |
| 450 | } |
| 451 | |
| 330 | 452 | void mp68a_state::machine_start() |
| 331 | 453 | { |
| 332 | 454 | LOG(("--->%s()\n", FUNCNAME)); |
| 333 | 455 | |
| 334 | 456 | /* register for state saving */ |
| 335 | 457 | save_item(NAME(m_shift)); |
| 458 | save_item(NAME(m_led)); |
| 459 | save_item(NAME(m_reset)); |
| 336 | 460 | } |
| 337 | 461 | |
| 338 | 462 | // This map is derived from info in "TEMAL 100 - teknisk manual Esselte 100" |
| r252954 | r252955 | |
| 341 | 465 | AM_RANGE(0xc000, 0xc3ff) AM_RAM AM_SHARE("videoram") |
| 342 | 466 | AM_RANGE(0xc808, 0xc80b) AM_DEVREADWRITE("pia1", pia6821_device, read, write) |
| 343 | 467 | AM_RANGE(0xc810, 0xc813) AM_DEVREADWRITE("pia2", pia6821_device, read, write) |
| 344 | | AM_RANGE(0xd000, 0xffff) AM_ROM AM_REGION("maincpu", 0xd0000) |
| 468 | AM_RANGE(0xd000, 0xffff) AM_ROM AM_REGION("maincpu", 0xd000) |
| 345 | 469 | ADDRESS_MAP_END |
| 346 | 470 | |
| 347 | 471 | // This address map is traced from schema |
| r252954 | r252955 | |
| 366 | 490 | INPUT_PORTS_END |
| 367 | 491 | |
| 368 | 492 | static INPUT_PORTS_START( md6802 ) |
| 493 | PORT_START("LINE0") /* KEY ROW 0 */ |
| 494 | PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
| 495 | PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') |
| 496 | PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') |
| 497 | PORT_BIT(0x08, 0x08, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') |
| 498 | PORT_BIT(0xf0, 0x00, IPT_UNUSED ) |
| 499 | |
| 500 | PORT_START("LINE1") /* KEY ROW 1 */ |
| 501 | PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') |
| 502 | PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') |
| 503 | PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') |
| 504 | PORT_BIT(0x08, 0x08, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') |
| 505 | PORT_BIT(0xf0, 0x00, IPT_UNUSED ) |
| 506 | |
| 507 | PORT_START("LINE2") /* KEY ROW 2 */ |
| 508 | PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') |
| 509 | PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') |
| 510 | PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') |
| 511 | PORT_BIT(0x08, 0x08, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') |
| 512 | PORT_BIT(0xf0, 0x00, IPT_UNUSED ) |
| 513 | |
| 514 | PORT_START("LINE3") /* KEY ROW 3 */ |
| 515 | PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') |
| 516 | PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') |
| 517 | PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') |
| 518 | PORT_BIT(0x08, 0x08, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') |
| 519 | PORT_BIT(0xf0, 0x00, IPT_UNUSED ) |
| 520 | |
| 521 | PORT_START("LINE4") /* Special KEY ROW for reset and Shift/'*' keys */ |
| 522 | PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR('*') |
| 523 | PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_F12) |
| 524 | PORT_BIT(0xf3, 0x00, IPT_UNUSED ) |
| 369 | 525 | INPUT_PORTS_END |
| 370 | 526 | |
| 371 | 527 | static INPUT_PORTS_START( mp68a ) |
| r252954 | r252955 | |
| 403 | 559 | PORT_BIT(0xf3, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 404 | 560 | INPUT_PORTS_END |
| 405 | 561 | |
| 406 | | TIMER_DEVICE_CALLBACK_MEMBER(mp68a_state::scan_artwork) |
| 562 | TIMER_DEVICE_CALLBACK_MEMBER(didact_state::scan_artwork) |
| 407 | 563 | { |
| 408 | 564 | // LOG(("--->%s()\n", FUNCNAME)); |
| 409 | 565 | |
| r252954 | r252955 | |
| 412 | 568 | { |
| 413 | 569 | LOG( ("RESET is pressed, resetting the CPU\n") ); |
| 414 | 570 | m_shift = 0; |
| 415 | | output().set_led_value(0, m_shift); |
| 416 | | m_maincpu->reset(); |
| 417 | | |
| 571 | output().set_led_value(m_led, m_shift); // For mp68a only |
| 572 | if (m_reset == 0) |
| 573 | { |
| 574 | machine_reset(); |
| 575 | } |
| 576 | m_reset = 1; // Inhibit multiple resets |
| 418 | 577 | } |
| 419 | 578 | |
| 420 | 579 | // Poll the artwork SHIFT/* key |
| 421 | 580 | else if ( (m_io_line4->read() & 0x08) ) |
| 422 | 581 | { |
| 423 | | LOG( ("SHIFT is set\n") ); |
| 582 | LOG( ("%s", !m_shift ? "SHIFT is set\n" : "") ); |
| 424 | 583 | m_shift = 1; |
| 425 | | output().set_led_value(0, m_shift); |
| 584 | output().set_led_value(m_led, m_shift); // For mp68a only |
| 426 | 585 | } |
| 586 | else |
| 587 | { |
| 588 | if (m_reset == 1) |
| 589 | { |
| 590 | m_reset = 0; // Enable reset again |
| 591 | } |
| 592 | } |
| 427 | 593 | } |
| 428 | 594 | |
| 429 | 595 | static MACHINE_CONFIG_START( e100, e100_state ) |
| r252954 | r252955 | |
| 438 | 604 | static MACHINE_CONFIG_START( md6802, md6802_state ) |
| 439 | 605 | MCFG_CPU_ADD("maincpu", M6802, XTAL_4MHz/4) |
| 440 | 606 | MCFG_CPU_PROGRAM_MAP(md6802_map) |
| 607 | MCFG_DEFAULT_LAYOUT(layout_md6802) |
| 441 | 608 | |
| 442 | | /* devices */ |
| 609 | /* Devices */ |
| 610 | MCFG_DEVICE_ADD("tb16_74145", TTL74145, 0) |
| 611 | /* PIA #1 0xA000-0xA003 - used differently by laborations and loaded software */ |
| 443 | 612 | MCFG_DEVICE_ADD("pia1", PIA6821, 0) |
| 613 | |
| 614 | /* PIA #2 Keyboard & Display 0xC000-0xC003 */ |
| 444 | 615 | MCFG_DEVICE_ADD("pia2", PIA6821, 0) |
| 616 | /* --init----------------------- */ |
| 617 | /* 0xE007 0xC002 (DDR B) = 0xFF - Port B all outputs and set to 0 (zero) */ |
| 618 | /* 0xE00B 0xC000 (DDR A) = 0x70 - Port A three outputs and set to 0 (zero) */ |
| 619 | /* 0xE00F 0xC001 (Control A) = 0x3C - */ |
| 620 | /* 0xE013 0xC003 (Control B) = 0x3C - */ |
| 621 | /* --execution-wait for key loop-- */ |
| 622 | /* 0xE026 0xC000 = (Reading Port A) */ |
| 623 | /* 0xE033 0xC000 = (Reading Port A) */ |
| 624 | /* 0xE068 0xC000 (Port A) = 0x60 */ |
| 625 | /* 0xE08A 0xC002 (Port B) = 0xEE - updating display */ |
| 626 | /* 0xE090 0xC000 (Port A) = 0x00 - looping in 0x10,0x20,0x30,0x40,0x50 */ |
| 627 | MCFG_PIA_WRITEPA_HANDLER(WRITE8(md6802_state, pia2_kbA_w)) |
| 628 | MCFG_PIA_READPA_HANDLER(READ8(md6802_state, pia2_kbA_r)) |
| 629 | MCFG_PIA_WRITEPB_HANDLER(WRITE8(md6802_state, pia2_kbB_w)) |
| 630 | MCFG_PIA_READPB_HANDLER(READ8(md6802_state, pia2_kbB_r)) |
| 631 | MCFG_PIA_CA2_HANDLER(WRITELINE(md6802_state, pia2_ca2_w)) |
| 632 | MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", md6802_state, scan_artwork, attotime::from_hz(10)) |
| 445 | 633 | MACHINE_CONFIG_END |
| 446 | 634 | |
| 447 | 635 | static MACHINE_CONFIG_START( mp68a, mp68a_state ) |
| 448 | | MCFG_CPU_ADD("maincpu", M6800, XTAL_4MHz/4) |
| 636 | // Clock source is based on a N9602N Dual Retriggerable Resettable Monostable Multivibrator oscillator at aprox 505KHz. |
| 637 | // Trimpot seems broken/stuck at 5K Ohm thu. ROM code 1Ms delay loops suggest 1MHz+ |
| 638 | MCFG_CPU_ADD("maincpu", M6800, 505000) |
| 449 | 639 | MCFG_CPU_PROGRAM_MAP(mp68a_map) |
| 640 | MCFG_DEFAULT_LAYOUT(layout_mp68a) |
| 450 | 641 | |
| 451 | 642 | /* Devices */ |
| 452 | 643 | /* PIA #1 0x500-0x503 - used differently by laborations and loaded software */ |
| r252954 | r252955 | |
| 458 | 649 | /* 0x0BAF 0x601 (Control A) = 0x30 - CA2 is low and enable DDRA */ |
| 459 | 650 | /* 0x0BB1 0x603 (Control B) = 0x30 - CB2 is low and enable DDRB */ |
| 460 | 651 | /* 0x0BB5 0x600 (DDR A) = 0xFF - Port A all outputs and set to 0 (zero) */ |
| 461 | | /* 0x0BB9 0x602 (DDR B) = 0x50 - Port B two outputs and set to 0 (zero9 */ |
| 652 | /* 0x0BB9 0x602 (DDR B) = 0x50 - Port B two outputs and set to 0 (zero) */ |
| 462 | 653 | /* 0x0BBD 0x601 (Control A) = 0x34 - CA2 is low and lock DDRA */ |
| 463 | 654 | /* 0x0BBF 0x603 (Control B) = 0x34 - CB2 is low and lock DDRB */ |
| 464 | 655 | /* 0x0BC3 0x602 (Port B) = 0x40 - Turn on display via RBI* on */ |
| r252954 | r252955 | |
| 500 | 691 | MCFG_OUTPUT_INDEX(5) |
| 501 | 692 | |
| 502 | 693 | MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", mp68a_state, scan_artwork, attotime::from_hz(10)) |
| 503 | | |
| 504 | 694 | MACHINE_CONFIG_END |
| 505 | 695 | |
| 506 | 696 | // TODO: Get a ROM set |
| r252954 | r252955 | |
| 518 | 708 | ROM_START( md6802 ) // ROM image from http://elektronikforumet.com/forum/viewtopic.php?f=2&t=79576&start=135#p1203640 |
| 519 | 709 | ROM_REGION(0x10000, "maincpu", 0) |
| 520 | 710 | ROM_LOAD( "DIDACT.bin", 0xe000, 0x0800, CRC(50430b1d) SHA1(8e2172a9ae95b04f20aa14177df2463a286c8465) ) |
| 521 | | // ROM_LOAD( "md6802-1.bin", 0xf800, 0xf9ff, CRC(0ff53e1f) SHA1(52002ee22c032775dac383d408c44abe9244724f) ) |
| 522 | | // ROM_LOAD( "md6802-2.bin", 0xfa00, 0xfbff, CRC(0ff53e1f) SHA1(52002ee22c032775dac383d408c44abe9244724f) ) |
| 523 | | // ROM_LOAD( "md6802-3.bin", 0xfc00, 0xfdff, CRC(0ff53e1f) SHA1(52002ee22c032775dac383d408c44abe9244724f) ) |
| 524 | | // ROM_LOAD( "md6802-4.bin", 0xfe00, 0xffff, CRC(0ff53e1f) SHA1(52002ee22c032775dac383d408c44abe9244724f) ) |
| 525 | 711 | ROM_END |
| 526 | 712 | |
| 527 | 713 | ROM_START( mp68a ) // ROM image from http://elektronikforumet.com/forum/viewtopic.php?f=2&t=79576&start=135#p1203640 |
| r252954 | r252955 | |
| 533 | 719 | // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS |
| 534 | 720 | COMP( 1979, mp68a, 0, 0, mp68a, mp68a, driver_device, 0, "Didact AB", "mp68a", MACHINE_NO_SOUND_HW ) |
| 535 | 721 | COMP( 1982, e100, 0, 0, e100, e100, driver_device, 0, "Didact AB", "Esselte 100", MACHINE_IS_SKELETON ) |
| 536 | | COMP( 1983, md6802, 0, 0, md6802, md6802, driver_device, 0, "Didact AB", "Mikrodator 6802", MACHINE_IS_SKELETON ) |
| 722 | COMP( 1983, md6802, 0, 0, md6802, md6802, driver_device, 0, "Didact AB", "Mikrodator 6802", MACHINE_NO_SOUND_HW ) |