trunk/src/mess/drivers/instruct.c
r22558 | r22559 | |
43 | 43 | not in the matrix, but are connected to hardware directly. This needs |
44 | 44 | to be emulated. (SENS key done) |
45 | 45 | - Connect 10 toggle switches and 10 round red leds. |
| 46 | - Hook up the Interrupt Block unit (no info available). |
46 | 47 | |
47 | 48 | ****************************************************************************/ |
48 | 49 | |
r22558 | r22559 | |
59 | 60 | instruct_state(const machine_config &mconfig, device_type type, const char *tag) |
60 | 61 | : driver_device(mconfig, type, tag), |
61 | 62 | m_maincpu(*this, "maincpu"), |
62 | | m_p_ram(*this, "p_ram"), |
| 63 | m_p_loram(*this, "loram"), |
| 64 | m_p_hiram(*this, "hiram"), |
63 | 65 | m_cass(*this, "cassette") |
64 | 66 | { } |
65 | 67 | |
r22558 | r22559 | |
71 | 73 | DECLARE_WRITE8_MEMBER(portf9_w); |
72 | 74 | DECLARE_WRITE8_MEMBER(portfa_w); |
73 | 75 | DECLARE_QUICKLOAD_LOAD_MEMBER( instruct ); |
| 76 | INTERRUPT_GEN_MEMBER(t2l_int); |
74 | 77 | virtual void machine_reset(); |
75 | 78 | UINT8 m_digit; |
76 | 79 | bool m_valid_digit; |
77 | 80 | required_device<cpu_device> m_maincpu; |
78 | | required_shared_ptr<UINT8> m_p_ram; |
| 81 | required_shared_ptr<UINT8> m_p_loram; |
| 82 | required_shared_ptr<UINT8> m_p_hiram; |
79 | 83 | required_device<cassette_image_device> m_cass; |
80 | 84 | }; |
81 | 85 | |
r22558 | r22559 | |
139 | 143 | return ( (m_cass->input() > 0.03) ? 1 : 0) | (ioport("HW")->read() & 1); |
140 | 144 | } |
141 | 145 | |
| 146 | INTERRUPT_GEN_MEMBER( instruct_state::t2l_int ) |
| 147 | { |
| 148 | device.execute().set_input_line_and_vector(0, HOLD_LINE, 0x2e); // unknown vector, guess |
| 149 | } |
| 150 | |
142 | 151 | static ADDRESS_MAP_START( instruct_mem, AS_PROGRAM, 8, instruct_state ) |
143 | 152 | ADDRESS_MAP_UNMAP_HIGH |
144 | | AM_RANGE(0x0000, 0x01ff) AM_RAM AM_SHARE("p_ram") // 512 bytes onboard ram |
| 153 | AM_RANGE(0x0000, 0x01ff) AM_RAM AM_SHARE("loram") // 512 bytes onboard ram |
145 | 154 | AM_RANGE(0x0200, 0x177f) AM_RAM // expansion ram needed by quickloads |
146 | 155 | AM_RANGE(0x1780, 0x17ff) AM_RAM // 128 bytes in s2656 chip |
147 | | AM_RANGE(0x1800, 0x1fff) AM_ROM |
| 156 | AM_RANGE(0x1800, 0x1fff) AM_RAM AM_SHARE("hiram") |
148 | 157 | ADDRESS_MAP_END |
149 | 158 | |
150 | 159 | static ADDRESS_MAP_START( instruct_io, AS_IO, 8, instruct_state ) |
r22558 | r22559 | |
212 | 221 | |
213 | 222 | void instruct_state::machine_reset() |
214 | 223 | { |
215 | | // copy the roms into ram so it can boot |
216 | | UINT8* ROM = memregion("maincpu")->base(); |
217 | | memcpy(m_p_ram, ROM+0x1800, 0x0200); |
| 224 | UINT8* rom = memregion("user1")->base(); |
| 225 | memcpy(m_p_loram, rom, 0x200); |
| 226 | memcpy(m_p_hiram, rom, 0x800); |
| 227 | m_maincpu->reset(); |
218 | 228 | } |
219 | 229 | |
220 | 230 | QUICKLOAD_LOAD_MEMBER( instruct_state, instruct ) |
r22558 | r22559 | |
292 | 302 | MCFG_CPU_ADD("maincpu",S2650, XTAL_3_579545MHz / 4) |
293 | 303 | MCFG_CPU_PROGRAM_MAP(instruct_mem) |
294 | 304 | MCFG_CPU_IO_MAP(instruct_io) |
| 305 | MCFG_CPU_PERIODIC_INT_DRIVER(instruct_state, t2l_int, 50) |
295 | 306 | |
296 | 307 | /* video hardware */ |
297 | 308 | MCFG_DEFAULT_LAYOUT(layout_instruct) |
r22558 | r22559 | |
308 | 319 | |
309 | 320 | /* ROM definition */ |
310 | 321 | ROM_START( instruct ) |
311 | | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
312 | | ROM_LOAD( "instruct.rom", 0x1800, 0x0800, CRC(131715a6) SHA1(4930b87d09046113ab172ba3fb31f5e455068ec7) ) |
| 322 | ROM_REGION( 0x0800, "user1", ROMREGION_ERASEFF ) |
| 323 | ROM_LOAD( "instruct.rom", 0x0000, 0x0800, CRC(131715a6) SHA1(4930b87d09046113ab172ba3fb31f5e455068ec7) ) |
313 | 324 | ROM_END |
314 | 325 | |
315 | 326 | /* Driver */ |
trunk/src/mess/drivers/ravens.c
r22558 | r22559 | |
12 | 12 | |
13 | 13 | No instructions, no schematics - it's all guesswork. |
14 | 14 | |
| 15 | The cassette saves a noise but it returns a bad load. |
15 | 16 | |
| 17 | |
16 | 18 | Version 0.9 |
17 | 19 | ----------- |
18 | 20 | Hardware: |
r22558 | r22559 | |
24 | 26 | The few photos show the CPU and a number of ordinary 74LSxxx chips. |
25 | 27 | There is a XTAL of unknown frequency. |
26 | 28 | |
27 | | There is a cassette interface.. |
28 | | |
29 | 29 | The buttons are labelled CMD, RUN, GOTO, RST, F, MON, PC, NXT but at |
30 | 30 | this time not all buttons are identified. |
31 | 31 | |
r22558 | r22559 | |
40 | 40 | -- E examine tape file |
41 | 41 | -- F fetch (load) from tape |
42 | 42 | |
| 43 | Quickload: Load the program then press Y. There are 6 that work and |
| 44 | 6 that do nothing. |
| 45 | |
43 | 46 | ToDo: |
44 | 47 | - Fix display of 8 round leds |
45 | 48 | - Cassette |
r22558 | r22559 | |
47 | 50 | Version V2.0 |
48 | 51 | ------------ |
49 | 52 | This used a terminal interface with a few non-standard control codes. |
50 | | The pushbuttons and LEDs appear to have been done away with. |
| 53 | The pushbuttons and LEDs appear to have been done away with. The list |
| 54 | is the same as on the CD2650. |
51 | 55 | |
52 | 56 | Commands (must be in uppercase): |
53 | 57 | A Examine memory; press C to alter memory |
54 | 58 | B Set breakpoint? |
55 | 59 | C View breakpoint? |
56 | | D Dump to screen |
| 60 | D Dump to screen and tape (at the same time) |
57 | 61 | E Execute |
58 | 62 | I ? |
59 | 63 | L Load |
60 | 64 | R ? |
61 | | V ? |
| 65 | V Verify? |
62 | 66 | |
63 | 67 | ToDo: |
64 | 68 | - Cassette |
r22558 | r22559 | |
67 | 71 | |
68 | 72 | #include "emu.h" |
69 | 73 | #include "cpu/s2650/s2650.h" |
| 74 | #include "imagedev/cassette.h" |
| 75 | #include "imagedev/snapquik.h" |
70 | 76 | #include "machine/terminal.h" |
| 77 | #include "sound/wave.h" |
71 | 78 | #include "ravens.lh" |
72 | 79 | |
73 | 80 | |
r22558 | r22559 | |
77 | 84 | ravens_state(const machine_config &mconfig, device_type type, const char *tag) |
78 | 85 | : driver_device(mconfig, type, tag), |
79 | 86 | m_maincpu(*this, "maincpu"), |
80 | | m_terminal(*this, TERMINAL_TAG) |
81 | | { } |
| 87 | m_terminal(*this, TERMINAL_TAG), |
| 88 | m_cass(*this, "cassette") { } |
82 | 89 | |
83 | 90 | DECLARE_READ8_MEMBER(port07_r); |
84 | 91 | DECLARE_READ8_MEMBER(port17_r); |
r22558 | r22559 | |
88 | 95 | DECLARE_WRITE8_MEMBER(leds_w); |
89 | 96 | DECLARE_WRITE8_MEMBER(kbd_put); |
90 | 97 | DECLARE_MACHINE_RESET(ravens2); |
| 98 | DECLARE_READ8_MEMBER(cass_r); |
| 99 | DECLARE_WRITE8_MEMBER(cass_w); |
| 100 | DECLARE_QUICKLOAD_LOAD_MEMBER( ravens ); |
91 | 101 | UINT8 m_term_char; |
92 | 102 | UINT8 m_term_data; |
93 | 103 | required_device<cpu_device> m_maincpu; |
94 | 104 | optional_device<generic_terminal_device> m_terminal; |
| 105 | required_device<cassette_image_device> m_cass; |
95 | 106 | }; |
96 | 107 | |
| 108 | WRITE8_MEMBER( ravens_state::cass_w ) |
| 109 | { |
| 110 | m_cass->output(BIT(data, 0) ? -1.0 : +1.0); |
| 111 | } |
| 112 | |
| 113 | READ8_MEMBER( ravens_state::cass_r ) |
| 114 | { |
| 115 | return (m_cass->input() > 0.03) ? 1 : 0; |
| 116 | } |
| 117 | |
97 | 118 | WRITE8_MEMBER( ravens_state::display_w ) |
98 | 119 | { |
99 | 120 | output_set_digit_value(offset, data); |
r22558 | r22559 | |
173 | 194 | ADDRESS_MAP_UNMAP_HIGH |
174 | 195 | AM_RANGE( 0x0000, 0x07ff) AM_ROM |
175 | 196 | AM_RANGE( 0x0800, 0x1fff) AM_RAM |
| 197 | AM_RANGE( 0x2000, 0x7FFF) AM_RAM // for quickload, optional |
176 | 198 | ADDRESS_MAP_END |
177 | 199 | |
178 | 200 | static ADDRESS_MAP_START( ravens_io, AS_IO, 8, ravens_state ) |
r22558 | r22559 | |
180 | 202 | AM_RANGE(0x09, 0x09) AM_WRITE(leds_w) // LED output port |
181 | 203 | AM_RANGE(0x10, 0x15) AM_WRITE(display_w) // 6-led display |
182 | 204 | AM_RANGE(0x17, 0x17) AM_READ(port17_r) // pushbuttons |
183 | | //AM_RANGE(S2650_SENSE_PORT, S2650_FO_PORT) AM_READWRITE(ravens_cass_in,ravens_cass_out) |
184 | | AM_RANGE(0x102, 0x103) AM_NOP // stops error log filling up while using debug |
| 205 | AM_RANGE(S2650_SENSE_PORT, S2650_FO_PORT) AM_READWRITE(cass_r,cass_w) |
185 | 206 | ADDRESS_MAP_END |
186 | 207 | |
187 | 208 | static ADDRESS_MAP_START( ravens2_io, AS_IO, 8, ravens_state ) |
r22558 | r22559 | |
189 | 210 | AM_RANGE(0x07, 0x07) AM_READ(port07_r) |
190 | 211 | AM_RANGE(0x1b, 0x1b) AM_WRITE(port1b_w) |
191 | 212 | AM_RANGE(0x1c, 0x1c) AM_WRITE(port1c_w) |
192 | | //AM_RANGE(S2650_SENSE_PORT, S2650_FO_PORT) AM_READWRITE(ravens_cass_in,ravens_cass_out) |
193 | | AM_RANGE(0x102, 0x103) AM_NOP // stops error log filling up while using debug |
| 213 | AM_RANGE(S2650_SENSE_PORT, S2650_FO_PORT) AM_READWRITE(cass_r,cass_w) |
194 | 214 | ADDRESS_MAP_END |
195 | 215 | |
196 | 216 | /* Input ports */ |
r22558 | r22559 | |
237 | 257 | DEVCB_DRIVER_MEMBER(ravens_state, kbd_put) |
238 | 258 | }; |
239 | 259 | |
| 260 | QUICKLOAD_LOAD_MEMBER( ravens_state, ravens ) |
| 261 | { |
| 262 | address_space &space = m_maincpu->space(AS_PROGRAM); |
| 263 | int i; |
| 264 | int quick_addr = 0x100; |
| 265 | int exec_addr; |
| 266 | int quick_length; |
| 267 | UINT8 *quick_data; |
| 268 | int read_; |
| 269 | |
| 270 | quick_length = image.length(); |
| 271 | quick_data = (UINT8*)malloc(quick_length); |
| 272 | if (!quick_data) |
| 273 | { |
| 274 | image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot open file"); |
| 275 | image.message(" Cannot open file"); |
| 276 | return IMAGE_INIT_FAIL; |
| 277 | } |
| 278 | |
| 279 | read_ = image.fread( quick_data, quick_length); |
| 280 | if (read_ != quick_length) |
| 281 | { |
| 282 | image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); |
| 283 | image.message(" Cannot read the file"); |
| 284 | return IMAGE_INIT_FAIL; |
| 285 | } |
| 286 | |
| 287 | if (quick_data[0] != 0xc6) |
| 288 | { |
| 289 | image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); |
| 290 | image.message(" Invalid header"); |
| 291 | return IMAGE_INIT_FAIL; |
| 292 | } |
| 293 | |
| 294 | exec_addr = quick_data[1] * 256 + quick_data[2]; |
| 295 | |
| 296 | if (exec_addr >= quick_length) |
| 297 | { |
| 298 | image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file"); |
| 299 | image.message(" Exec address beyond end of file"); |
| 300 | return IMAGE_INIT_FAIL; |
| 301 | } |
| 302 | |
| 303 | if (quick_length < 0x0900) |
| 304 | { |
| 305 | image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); |
| 306 | image.message(" File too short"); |
| 307 | return IMAGE_INIT_FAIL; |
| 308 | } |
| 309 | |
| 310 | if (quick_length > 0x8000) |
| 311 | { |
| 312 | image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); |
| 313 | image.message(" File too long"); |
| 314 | return IMAGE_INIT_FAIL; |
| 315 | } |
| 316 | |
| 317 | // read_ = 0x1000; |
| 318 | // if (quick_length < 0x1000) |
| 319 | // read_ = quick_length; |
| 320 | |
| 321 | for (i = quick_addr; i < read_; i++) |
| 322 | space.write_byte(i, quick_data[i]); |
| 323 | |
| 324 | // read_ = 0x1780; |
| 325 | // if (quick_length < 0x1780) |
| 326 | // read_ = quick_length; |
| 327 | |
| 328 | // if (quick_length > 0x157f) |
| 329 | // for (i = 0x1580; i < read_; i++) |
| 330 | // space.write_byte(i, quick_data[i]); |
| 331 | |
| 332 | // if (quick_length > 0x17ff) |
| 333 | // for (i = 0x1800; i < quick_length; i++) |
| 334 | // space.write_byte(i, quick_data[i]); |
| 335 | |
| 336 | /* display a message about the loaded quickload */ |
| 337 | image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr); |
| 338 | |
| 339 | // Start the quickload |
| 340 | m_maincpu->set_pc(exec_addr); |
| 341 | return IMAGE_INIT_PASS; |
| 342 | } |
| 343 | |
240 | 344 | static MACHINE_CONFIG_START( ravens, ravens_state ) |
241 | 345 | /* basic machine hardware */ |
242 | 346 | MCFG_CPU_ADD("maincpu",S2650, XTAL_1MHz) // frequency is unknown |
r22558 | r22559 | |
245 | 349 | |
246 | 350 | /* video hardware */ |
247 | 351 | MCFG_DEFAULT_LAYOUT(layout_ravens) |
| 352 | |
| 353 | /* quickload */ |
| 354 | MCFG_QUICKLOAD_ADD("quickload", ravens_state, ravens, "pgm", 1) |
| 355 | |
| 356 | /* cassette */ |
| 357 | MCFG_CASSETTE_ADD( "cassette", default_cassette_interface ) |
| 358 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 359 | MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") |
| 360 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
248 | 361 | MACHINE_CONFIG_END |
249 | 362 | |
250 | 363 | static MACHINE_CONFIG_START( ravens2, ravens_state ) |
r22558 | r22559 | |
256 | 369 | |
257 | 370 | /* video hardware */ |
258 | 371 | MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf) |
| 372 | |
| 373 | /* cassette */ |
| 374 | MCFG_CASSETTE_ADD( "cassette", default_cassette_interface ) |
| 375 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 376 | MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") |
| 377 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
259 | 378 | MACHINE_CONFIG_END |
260 | 379 | |
261 | 380 | /* ROM definition */ |
r22558 | r22559 | |
272 | 391 | /* Driver */ |
273 | 392 | |
274 | 393 | /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ |
275 | | COMP( 1985, ravens, 0, 0, ravens, ravens, driver_device, 0, "Joseph Glagla and Dieter Feiler", "Ravensburger Selbstbaucomputer V0.9", GAME_NOT_WORKING | GAME_NO_SOUND_HW ) |
| 394 | COMP( 1984, ravens, 0, 0, ravens, ravens, driver_device, 0, "Joseph Glagla and Dieter Feiler", "Ravensburger Selbstbaucomputer V0.9", GAME_NOT_WORKING | GAME_NO_SOUND_HW ) |
276 | 395 | COMP( 1985, ravens2, ravens, 0, ravens2, ravens, driver_device, 0, "Joseph Glagla and Dieter Feiler", "Ravensburger Selbstbaucomputer V2.0", GAME_NOT_WORKING | GAME_NO_SOUND_HW ) |