src/mess/drivers/okean240.c
| r11990 | r11991 | |
| 27 | 27 | portC=vid.scroll.x |
| 28 | 28 | |
| 29 | 29 | |
| 30 | | NOTES ABOUT THE TEST ROM: |
| 31 | | The test rom tests various things including video memory. The test results |
| 30 | NOTES ABOUT THE TEST ROM (-bios 1): |
| 31 | - The test rom tests various things including video memory. The test results |
| 32 | 32 | are sent to the comport (for us, the generic terminal). Therefore it would |
| 33 | 33 | be useful to have the 2 screens side-by-side. Unfortunately they will not |
| 34 | 34 | co-exist, instead causing a crash at start ("Mandatory artwork is missing"). |
| 35 | 35 | So, if you want to see the test rom results, you'll have to compile a modified |
| 36 | 36 | driver (change the below line to 1). |
| 37 | - All 'rand()' returns are only there to allow the tests to proceed. |
| 37 | 38 | |
| 38 | 39 | |
| 39 | 40 | ToDo: |
| r11990 | r11991 | |
| 43 | 44 | - Add disks |
| 44 | 45 | - Add cassette |
| 45 | 46 | |
| 47 | Usage of terminal: |
| 48 | - okean240 bios 0 - the keyboard |
| 49 | - okean240a bios 0 - not used |
| 50 | - (either) bios 1 - the screen if compiled specially |
| 51 | |
| 46 | 52 | ****************************************************************************/ |
| 47 | 53 | #define OKEAN240_USING_TESTROM 0 |
| 48 | 54 | |
| r11990 | r11991 | |
| 60 | 66 | public: |
| 61 | 67 | okean240_state(const machine_config &mconfig, device_type type, const char *tag) |
| 62 | 68 | : driver_device(mconfig, type, tag), |
| 63 | | m_p_videoram(0), |
| 64 | 69 | m_term_data(0), |
| 65 | | m_j(0) |
| 70 | m_j(0), |
| 71 | m_scroll(0) |
| 66 | 72 | { } |
| 67 | 73 | |
| 68 | | DECLARE_READ8_MEMBER(okean240_rand_r); |
| 74 | DECLARE_READ8_MEMBER(okean240_kbd_status_r); |
| 75 | DECLARE_READ8_MEMBER(okean240a_kbd_status_r); |
| 76 | DECLARE_READ8_MEMBER(term_status_r); |
| 69 | 77 | DECLARE_READ8_MEMBER(okean240_keyboard_r); |
| 70 | 78 | DECLARE_WRITE8_MEMBER(okean240_keyboard_w); |
| 71 | 79 | DECLARE_READ8_MEMBER(okean240a_keyboard_r); |
| 72 | 80 | DECLARE_WRITE8_MEMBER(kbd_put); |
| 81 | DECLARE_WRITE8_MEMBER(scroll_w); |
| 73 | 82 | UINT8 *m_p_videoram; |
| 74 | 83 | UINT8 m_term_data; |
| 75 | 84 | UINT8 m_j; |
| 85 | UINT8 m_scroll; |
| 76 | 86 | virtual void machine_reset(); |
| 77 | 87 | virtual void video_start(); |
| 78 | 88 | }; |
| 79 | 89 | |
| 80 | 90 | |
| 81 | | READ8_MEMBER( okean240_state::okean240_rand_r ) |
| 91 | READ8_MEMBER( okean240_state::okean240_kbd_status_r ) |
| 82 | 92 | { |
| 83 | | offset += 0x80; |
| 84 | | if (offset == 0xa1) |
| 85 | | return 1 | (machine().rand() & 2); |
| 93 | if (m_term_data) |
| 94 | return (machine().rand() & 0x10) | 2; |
| 86 | 95 | else |
| 87 | | if (offset == 0x80) |
| 96 | return machine().rand() & 0x10; |
| 97 | } |
| 98 | |
| 99 | // see if a key is pressed and indicate status |
| 100 | READ8_MEMBER( okean240_state::okean240a_kbd_status_r ) |
| 101 | { |
| 102 | char kbdrow[6]; |
| 103 | UINT8 i,j; |
| 104 | |
| 105 | for (i = 0; i < 11; i++) |
| 88 | 106 | { |
| 89 | | if (m_term_data) |
| 107 | sprintf(kbdrow,"X%X",i); |
| 108 | j = input_port_read(machine(), kbdrow); |
| 109 | if (j) |
| 90 | 110 | return (machine().rand() & 0x10) | 2; |
| 91 | | else |
| 92 | | return machine().rand() & 0x10; |
| 93 | 111 | } |
| 94 | | else |
| 95 | | return 0; |
| 112 | m_j = 0; |
| 113 | return machine().rand() & 0x10; |
| 96 | 114 | } |
| 97 | 115 | |
| 116 | READ8_MEMBER( okean240_state::term_status_r ) |
| 117 | { |
| 118 | return 1 | (machine().rand() & 2); |
| 119 | } |
| 120 | |
| 98 | 121 | READ8_MEMBER( okean240_state::okean240_keyboard_r ) |
| 99 | 122 | { |
| 100 | 123 | if (offset == 0) // port 40 (get ascii key value) |
| r11990 | r11991 | |
| 127 | 150 | { |
| 128 | 151 | if (j==m_j) return 0; |
| 129 | 152 | m_j=j; |
| 130 | | m_term_data = 1; |
| 131 | 153 | return j; |
| 132 | 154 | } |
| 133 | 155 | } |
| r11990 | r11991 | |
| 159 | 181 | // okean240a: port 42 bit 4 |
| 160 | 182 | } |
| 161 | 183 | |
| 184 | WRITE8_MEMBER( okean240_state::scroll_w ) |
| 185 | { |
| 186 | m_scroll = data; |
| 187 | } |
| 188 | |
| 162 | 189 | static ADDRESS_MAP_START(okean240_mem, AS_PROGRAM, 8, okean240_state) |
| 163 | 190 | ADDRESS_MAP_UNMAP_HIGH |
| 164 | 191 | AM_RANGE(0x0000, 0x07ff) AM_RAMBANK("boot") |
| r11990 | r11991 | |
| 169 | 196 | ADDRESS_MAP_END |
| 170 | 197 | |
| 171 | 198 | static ADDRESS_MAP_START(okean240_io, AS_IO, 8, okean240_state) |
| 172 | | ADDRESS_MAP_UNMAP_HIGH |
| 173 | 199 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 174 | | AM_RANGE(0x80, 0xff) AM_READ(okean240_rand_r) |
| 200 | AM_RANGE(0x40, 0x42) AM_READWRITE(okean240_keyboard_r,okean240_keyboard_w) |
| 201 | AM_RANGE(0x80, 0x80) AM_READ(okean240_kbd_status_r) |
| 202 | #if OKEAN240_USING_TESTROM |
| 175 | 203 | AM_RANGE(0xa0, 0xa0) AM_DEVWRITE_LEGACY(TERMINAL_TAG, terminal_write) |
| 176 | | AM_RANGE(0x40, 0x42) AM_READWRITE(okean240_keyboard_r,okean240_keyboard_w) |
| 204 | AM_RANGE(0xa1, 0xa1) AM_READ(term_status_r) |
| 205 | #endif |
| 206 | AM_RANGE(0xc0, 0xc0) AM_WRITE(scroll_w) |
| 177 | 207 | ADDRESS_MAP_END |
| 178 | 208 | |
| 179 | 209 | static ADDRESS_MAP_START(okean240a_io, AS_IO, 8, okean240_state) |
| 180 | | ADDRESS_MAP_UNMAP_HIGH |
| 181 | 210 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 182 | | AM_RANGE(0x80, 0xff) AM_READ(okean240_rand_r) |
| 211 | AM_RANGE(0x40, 0x42) AM_READWRITE(okean240a_keyboard_r,okean240_keyboard_w) |
| 212 | AM_RANGE(0x80, 0x80) AM_READ(okean240a_kbd_status_r) |
| 213 | #if OKEAN240_USING_TESTROM |
| 183 | 214 | AM_RANGE(0xa0, 0xa0) AM_DEVWRITE_LEGACY(TERMINAL_TAG, terminal_write) |
| 184 | | AM_RANGE(0x40, 0x42) AM_READWRITE(okean240a_keyboard_r,okean240_keyboard_w) |
| 215 | AM_RANGE(0xa1, 0xa1) AM_READ(term_status_r) |
| 216 | #endif |
| 217 | AM_RANGE(0xc0, 0xc0) AM_WRITE(scroll_w) |
| 185 | 218 | // AM_RANGE(0x00, 0x1f)=ppa00.data |
| 186 | 219 | // AM_RANGE(0x20, 0x23)=dsk.data |
| 187 | 220 | // AM_RANGE(0x24, 0x24)=dsk.wait |
| r11990 | r11991 | |
| 327 | 360 | machine().scheduler().timer_set(attotime::from_usec(10), FUNC(okean240_boot)); |
| 328 | 361 | memory_set_bank(machine(), "boot", 1); |
| 329 | 362 | m_term_data = 0; |
| 330 | | m_j=0; |
| 363 | m_j = 0; |
| 364 | m_scroll = 0; |
| 331 | 365 | } |
| 332 | 366 | |
| 333 | 367 | WRITE8_MEMBER( okean240_state::kbd_put ) |
| r11990 | r11991 | |
| 335 | 369 | m_term_data = data; |
| 336 | 370 | } |
| 337 | 371 | |
| 338 | | static GENERIC_TERMINAL_INTERFACE( terminal_intf ) |
| 372 | static GENERIC_TERMINAL_INTERFACE( okean240_terminal_intf ) |
| 339 | 373 | { |
| 340 | 374 | DEVCB_DRIVER_MEMBER(okean240_state, kbd_put) |
| 341 | 375 | }; |
| 342 | 376 | |
| 377 | static GENERIC_TERMINAL_INTERFACE( okean240a_terminal_intf ) |
| 378 | { |
| 379 | DEVCB_NULL |
| 380 | }; |
| 381 | |
| 343 | 382 | DRIVER_INIT( okean240 ) |
| 344 | 383 | { |
| 345 | 384 | UINT8 *RAM = machine.region("maincpu")->base(); |
| r11990 | r11991 | |
| 350 | 389 | { |
| 351 | 390 | } |
| 352 | 391 | |
| 353 | | // need to add colour |
| 354 | | SCREEN_UPDATE( okean240 ) |
| 392 | static SCREEN_UPDATE( okean240 ) |
| 355 | 393 | { |
| 356 | 394 | okean240_state *state = screen->machine().driver_data<okean240_state>(); |
| 357 | | UINT8 gfx,a; |
| 395 | UINT8 gfx,ma; // ma must be 8bit |
| 358 | 396 | UINT16 x,y; |
| 359 | 397 | |
| 360 | 398 | for (y = 0; y < 256; y++) |
| 361 | 399 | { |
| 400 | ma = y + state->m_scroll; |
| 362 | 401 | UINT16 *p = BITMAP_ADDR16(bitmap, y, 0); |
| 363 | 402 | |
| 364 | 403 | for (x = 0; x < 0x4000; x+=0x200) |
| 365 | 404 | { |
| 366 | | gfx = state->m_p_videoram[x|y]; |
| 367 | | a = state->m_p_videoram[x|0x100|y]; |
| 368 | | gfx |= a; |
| 405 | gfx = state->m_p_videoram[x|ma] | state->m_p_videoram[x|ma|0x100]; |
| 369 | 406 | |
| 370 | 407 | /* Display a scanline of a character */ |
| 371 | 408 | *p++ = BIT(gfx, 0); |
| r11990 | r11991 | |
| 425 | 462 | #endif |
| 426 | 463 | MCFG_GFXDECODE(okean240) |
| 427 | 464 | |
| 428 | | MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf) |
| 465 | MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, okean240_terminal_intf) |
| 429 | 466 | MACHINE_CONFIG_END |
| 430 | 467 | |
| 431 | 468 | static MACHINE_CONFIG_DERIVED( okean240a, okean240 ) |
| 432 | 469 | MCFG_CPU_MODIFY("maincpu") |
| 433 | 470 | MCFG_CPU_IO_MAP(okean240a_io) |
| 434 | 471 | MCFG_GFXDECODE(okean240a) |
| 472 | MCFG_GENERIC_TERMINAL_REMOVE(TERMINAL_TAG) |
| 473 | //MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, okean240a_terminal_intf) |
| 435 | 474 | MACHINE_CONFIG_END |
| 436 | 475 | |
| 437 | 476 | /* ROM definition */ |