trunk/src/mess/machine/zx.c
| r20492 | r20493 | |
| 20 | 20 | |
| 21 | 21 | WRITE8_MEMBER(zx_state::zx_ram_w) |
| 22 | 22 | { |
| 23 | | UINT8 *RAM = memregion("maincpu")->base(); |
| 23 | UINT8 *RAM = m_region_maincpu->base(); |
| 24 | 24 | RAM[offset + 0x4000] = data; |
| 25 | 25 | |
| 26 | 26 | if (data & 0x40) |
| r20492 | r20493 | |
| 38 | 38 | /* I know this looks really pointless... but it has to be here */ |
| 39 | 39 | READ8_MEMBER( zx_state::zx_ram_r ) |
| 40 | 40 | { |
| 41 | | UINT8 *RAM = memregion("maincpu")->base(); |
| 41 | UINT8 *RAM = m_region_maincpu->base(); |
| 42 | 42 | return RAM[offset | 0xc000]; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | DRIVER_INIT_MEMBER(zx_state,zx) |
| 46 | 46 | { |
| 47 | | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 47 | address_space &space = m_maincpu->space(AS_PROGRAM); |
| 48 | 48 | |
| 49 | | space.install_read_bank(0x4000, 0x4000 + machine().device<ram_device>(RAM_TAG)->size() - 1, "bank1"); |
| 50 | | space.install_write_handler(0x4000, 0x4000 + machine().device<ram_device>(RAM_TAG)->size() - 1, write8_delegate(FUNC(zx_state::zx_ram_w),this)); |
| 51 | | membank("bank1")->set_base(memregion("maincpu")->base() + 0x4000); |
| 49 | space.install_read_bank(0x4000, 0x4000 + m_ram->size() - 1, "bank1"); |
| 50 | space.install_write_handler(0x4000, 0x4000 + m_ram->size() - 1, write8_delegate(FUNC(zx_state::zx_ram_w),this)); |
| 51 | membank("bank1")->set_base(m_region_maincpu->base() + 0x4000); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | DIRECT_UPDATE_MEMBER(zx_state::zx_setdirect) |
| 55 | 55 | { |
| 56 | 56 | if (address & 0xc000) |
| 57 | | zx_ula_r(machine(), address, "maincpu", 0); |
| 57 | zx_ula_r(address, m_region_maincpu, 0); |
| 58 | 58 | return address; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | DIRECT_UPDATE_MEMBER(zx_state::pc8300_setdirect) |
| 62 | 62 | { |
| 63 | 63 | if (address & 0xc000) |
| 64 | | zx_ula_r(machine(), address, "gfx1", 0); |
| 64 | zx_ula_r(address, m_region_gfx1, 0); |
| 65 | 65 | return address; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | DIRECT_UPDATE_MEMBER(zx_state::pow3000_setdirect) |
| 69 | 69 | { |
| 70 | 70 | if (address & 0xc000) |
| 71 | | zx_ula_r(machine(), address, "gfx1", 1); |
| 71 | zx_ula_r(address, m_region_gfx1, 1); |
| 72 | 72 | return address; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | void zx_state::machine_reset() |
| 76 | 76 | { |
| 77 | | machine().device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(zx_state::zx_setdirect), this)); |
| 77 | m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(zx_state::zx_setdirect), this)); |
| 78 | 78 | m_tape_bit = 0x80; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | MACHINE_RESET_MEMBER(zx_state,pow3000) |
| 82 | 82 | { |
| 83 | | machine().device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(zx_state::pow3000_setdirect), this)); |
| 83 | m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(zx_state::pow3000_setdirect), this)); |
| 84 | 84 | m_tape_bit = 0x80; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | MACHINE_RESET_MEMBER(zx_state,pc8300) |
| 88 | 88 | { |
| 89 | | machine().device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(zx_state::pc8300_setdirect), this)); |
| 89 | m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(zx_state::pc8300_setdirect), this)); |
| 90 | 90 | m_tape_bit = 0x80; |
| 91 | 91 | } |
| 92 | 92 | |
| r20492 | r20493 | |
| 106 | 106 | if (offs == 0xfe) |
| 107 | 107 | { |
| 108 | 108 | if ((offset & 0x0100) == 0) |
| 109 | | data &= ioport("ROW0")->read(); |
| 109 | data &= m_io_row0->read(); |
| 110 | 110 | if ((offset & 0x0200) == 0) |
| 111 | | data &= ioport("ROW1")->read(); |
| 111 | data &= m_io_row1->read(); |
| 112 | 112 | if ((offset & 0x0400) == 0) |
| 113 | | data &= ioport("ROW2")->read(); |
| 113 | data &= m_io_row2->read(); |
| 114 | 114 | if ((offset & 0x0800) == 0) |
| 115 | | data &= ioport("ROW3")->read(); |
| 115 | data &= m_io_row3->read(); |
| 116 | 116 | if ((offset & 0x1000) == 0) |
| 117 | | data &= ioport("ROW4")->read(); |
| 117 | data &= m_io_row4->read(); |
| 118 | 118 | if ((offset & 0x2000) == 0) |
| 119 | | data &= ioport("ROW5")->read(); |
| 119 | data &= m_io_row5->read(); |
| 120 | 120 | if ((offset & 0x4000) == 0) |
| 121 | | data &= ioport("ROW6")->read(); |
| 121 | data &= m_io_row6->read(); |
| 122 | 122 | if ((offset & 0x8000) == 0) |
| 123 | | data &= ioport("ROW7")->read(); |
| 123 | data &= m_io_row7->read(); |
| 124 | 124 | |
| 125 | | if (!ioport("CONFIG")->read()) |
| 125 | if (!m_io_config->read()) |
| 126 | 126 | data &= ~0x40; |
| 127 | 127 | |
| 128 | | machine().device<cassette_image_device>(CASSETTE_TAG)->output(+1.0); |
| 128 | m_cassette->output(+1.0); |
| 129 | 129 | |
| 130 | 130 | if (m_ula_irq_active) |
| 131 | 131 | { |
| r20492 | r20493 | |
| 134 | 134 | } |
| 135 | 135 | // else |
| 136 | 136 | // { |
| 137 | | if (((machine().device<cassette_image_device>(CASSETTE_TAG))->input() < -0.75) && m_tape_bit) |
| 137 | if ((m_cassette->input() < -0.75) && m_tape_bit) |
| 138 | 138 | { |
| 139 | 139 | m_tape_bit = 0x00; |
| 140 | 140 | machine().scheduler().timer_set(attotime::from_usec(362), timer_expired_delegate(FUNC(zx_state::zx_tape_pulse),this)); |
| r20492 | r20493 | |
| 163 | 163 | if (offs == 0xfe) |
| 164 | 164 | { |
| 165 | 165 | if ((offset & 0x0100) == 0) |
| 166 | | data &= ioport("ROW0")->read(); |
| 166 | data &= m_io_row0->read(); |
| 167 | 167 | if ((offset & 0x0200) == 0) |
| 168 | | data &= ioport("ROW1")->read(); |
| 168 | data &= m_io_row1->read(); |
| 169 | 169 | if ((offset & 0x0400) == 0) |
| 170 | | data &= ioport("ROW2")->read(); |
| 170 | data &= m_io_row2->read(); |
| 171 | 171 | if ((offset & 0x0800) == 0) |
| 172 | | data &= ioport("ROW3")->read(); |
| 172 | data &= m_io_row3->read(); |
| 173 | 173 | if ((offset & 0x1000) == 0) |
| 174 | | data &= ioport("ROW4")->read(); |
| 174 | data &= m_io_row4->read(); |
| 175 | 175 | if ((offset & 0x2000) == 0) |
| 176 | | data &= ioport("ROW5")->read(); |
| 176 | data &= m_io_row5->read(); |
| 177 | 177 | if ((offset & 0x4000) == 0) |
| 178 | | data &= ioport("ROW6")->read(); |
| 178 | data &= m_io_row6->read(); |
| 179 | 179 | if ((offset & 0x8000) == 0) |
| 180 | | data &= ioport("ROW7")->read(); |
| 180 | data &= m_io_row7->read(); |
| 181 | 181 | |
| 182 | | if (!ioport("CONFIG")->read()) |
| 182 | if (!m_io_config->read()) |
| 183 | 183 | data &= ~0x40; |
| 184 | 184 | |
| 185 | | machine().device<cassette_image_device>(CASSETTE_TAG)->output(+1.0); |
| 185 | m_cassette->output(+1.0); |
| 186 | 186 | |
| 187 | 187 | if (m_ula_irq_active) |
| 188 | 188 | { |
| r20492 | r20493 | |
| 191 | 191 | } |
| 192 | 192 | else |
| 193 | 193 | { |
| 194 | | if (((machine().device<cassette_image_device>(CASSETTE_TAG))->input() < -0.75) && m_tape_bit) |
| 194 | if ((m_cassette->input() < -0.75) && m_tape_bit) |
| 195 | 195 | { |
| 196 | 196 | m_tape_bit = 0x00; |
| 197 | 197 | machine().scheduler().timer_set(attotime::from_usec(362), timer_expired_delegate(FUNC(zx_state::zx_tape_pulse),this)); |
| r20492 | r20493 | |
| 219 | 219 | |
| 220 | 220 | UINT8 data = 0xff; |
| 221 | 221 | UINT8 offs = offset & 0xff; |
| 222 | | device_t *speaker = machine().device(SPEAKER_TAG); |
| 223 | 222 | |
| 224 | 223 | if (offs == 0xf5) |
| 225 | 224 | { |
| 226 | 225 | m_speaker_state ^= 1; |
| 227 | | speaker_level_w(speaker, m_speaker_state); |
| 226 | speaker_level_w(m_speaker, m_speaker_state); |
| 228 | 227 | } |
| 229 | 228 | else |
| 230 | 229 | if (offs == 0xfe) |
| 231 | 230 | { |
| 232 | 231 | if ((offset & 0x0100) == 0) |
| 233 | | data &= ioport("ROW0")->read(); |
| 232 | data &= m_io_row0->read(); |
| 234 | 233 | if ((offset & 0x0200) == 0) |
| 235 | | data &= ioport("ROW1")->read(); |
| 234 | data &= m_io_row1->read(); |
| 236 | 235 | if ((offset & 0x0400) == 0) |
| 237 | | data &= ioport("ROW2")->read(); |
| 236 | data &= m_io_row2->read(); |
| 238 | 237 | if ((offset & 0x0800) == 0) |
| 239 | | data &= ioport("ROW3")->read(); |
| 238 | data &= m_io_row3->read(); |
| 240 | 239 | if ((offset & 0x1000) == 0) |
| 241 | | data &= ioport("ROW4")->read(); |
| 240 | data &= m_io_row4->read(); |
| 242 | 241 | if ((offset & 0x2000) == 0) |
| 243 | | data &= ioport("ROW5")->read(); |
| 242 | data &= m_io_row5->read(); |
| 244 | 243 | if ((offset & 0x4000) == 0) |
| 245 | | data &= ioport("ROW6")->read(); |
| 244 | data &= m_io_row6->read(); |
| 246 | 245 | if ((offset & 0x8000) == 0) |
| 247 | | data &= ioport("ROW7")->read(); |
| 246 | data &= m_io_row7->read(); |
| 248 | 247 | |
| 249 | | machine().device<cassette_image_device>(CASSETTE_TAG)->output(+1.0); |
| 248 | m_cassette->output(+1.0); |
| 250 | 249 | |
| 251 | 250 | if (m_ula_irq_active) |
| 252 | 251 | { |
| r20492 | r20493 | |
| 255 | 254 | } |
| 256 | 255 | else |
| 257 | 256 | { |
| 258 | | if (((machine().device<cassette_image_device>(CASSETTE_TAG))->input() < -0.75) && m_tape_bit) |
| 257 | if ((m_cassette->input() < -0.75) && m_tape_bit) |
| 259 | 258 | { |
| 260 | 259 | m_tape_bit = 0x00; |
| 261 | 260 | machine().scheduler().timer_set(attotime::from_usec(362), timer_expired_delegate(FUNC(zx_state::zx_tape_pulse),this)); |
| r20492 | r20493 | |
| 283 | 282 | |
| 284 | 283 | UINT8 data = 0xff; |
| 285 | 284 | UINT8 offs = offset & 0xff; |
| 286 | | device_t *speaker = machine().device(SPEAKER_TAG); |
| 287 | 285 | |
| 288 | 286 | if (offs == 0x7e) |
| 289 | 287 | { |
| 290 | | data = (ioport("CONFIG")->read()); |
| 288 | data = (m_io_config->read()); |
| 291 | 289 | } |
| 292 | 290 | else |
| 293 | 291 | if (offs == 0xf5) |
| 294 | 292 | { |
| 295 | 293 | m_speaker_state ^= 1; |
| 296 | | speaker_level_w(speaker, m_speaker_state); |
| 294 | speaker_level_w(m_speaker, m_speaker_state); |
| 297 | 295 | } |
| 298 | 296 | else |
| 299 | 297 | if (offs == 0xfe) |
| 300 | 298 | { |
| 301 | 299 | if ((offset & 0x0100) == 0) |
| 302 | | data &= ioport("ROW0")->read(); |
| 300 | data &= m_io_row0->read(); |
| 303 | 301 | if ((offset & 0x0200) == 0) |
| 304 | | data &= ioport("ROW1")->read(); |
| 302 | data &= m_io_row1->read(); |
| 305 | 303 | if ((offset & 0x0400) == 0) |
| 306 | | data &= ioport("ROW2")->read(); |
| 304 | data &= m_io_row2->read(); |
| 307 | 305 | if ((offset & 0x0800) == 0) |
| 308 | | data &= ioport("ROW3")->read(); |
| 306 | data &= m_io_row3->read(); |
| 309 | 307 | if ((offset & 0x1000) == 0) |
| 310 | | data &= ioport("ROW4")->read(); |
| 308 | data &= m_io_row4->read(); |
| 311 | 309 | if ((offset & 0x2000) == 0) |
| 312 | | data &= ioport("ROW5")->read(); |
| 310 | data &= m_io_row5->read(); |
| 313 | 311 | if ((offset & 0x4000) == 0) |
| 314 | | data &= ioport("ROW6")->read(); |
| 312 | data &= m_io_row6->read(); |
| 315 | 313 | if ((offset & 0x8000) == 0) |
| 316 | | data &= ioport("ROW7")->read(); |
| 314 | data &= m_io_row7->read(); |
| 317 | 315 | |
| 318 | | machine().device<cassette_image_device>(CASSETTE_TAG)->output(+1.0); |
| 316 | m_cassette->output(+1.0); |
| 319 | 317 | |
| 320 | 318 | if (m_ula_irq_active) |
| 321 | 319 | { |
| r20492 | r20493 | |
| 324 | 322 | } |
| 325 | 323 | else |
| 326 | 324 | { |
| 327 | | if (((machine().device<cassette_image_device>(CASSETTE_TAG))->input() < -0.75) && m_tape_bit) |
| 325 | if ((m_cassette->input() < -0.75) && m_tape_bit) |
| 328 | 326 | { |
| 329 | 327 | m_tape_bit = 0x00; |
| 330 | 328 | machine().scheduler().timer_set(attotime::from_usec(362), timer_expired_delegate(FUNC(zx_state::zx_tape_pulse),this)); |
| r20492 | r20493 | |
| 348 | 346 | UINT8 offs = offset & 0xff; |
| 349 | 347 | |
| 350 | 348 | if (offs == 0xff) |
| 351 | | machine().device<cassette_image_device>(CASSETTE_TAG)->output(-1.0); |
| 349 | m_cassette->output(-1.0); |
| 352 | 350 | } |
| 353 | 351 | |
| 354 | 352 | WRITE8_MEMBER( zx_state::zx81_io_w ) |
| 355 | 353 | { |
| 356 | | address_space &mem = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 357 | 354 | /* port F5 = unknown, pc8300/pow3000/lambda only |
| 358 | 355 | F6 = unknown, pc8300/pow3000/lambda only |
| 359 | 356 | FB = write data to printer, not emulated |
| r20492 | r20493 | |
| 361 | 358 | FE = turn on NMI generator |
| 362 | 359 | FF = write HSYNC and cass data */ |
| 363 | 360 | |
| 364 | | screen_device *screen = machine().first_screen(); |
| 365 | | int height = screen->height(); |
| 361 | int height = m_screen->height(); |
| 366 | 362 | UINT8 offs = offset & 0xff; |
| 367 | 363 | |
| 368 | 364 | if (offs == 0xfd) |
| r20492 | r20493 | |
| 372 | 368 | else |
| 373 | 369 | if (offs == 0xfe) |
| 374 | 370 | { |
| 375 | | m_ula_nmi->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(207)); |
| 371 | m_ula_nmi->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(207)); |
| 376 | 372 | |
| 377 | 373 | /* remove the IRQ */ |
| 378 | 374 | m_ula_irq_active = 0; |
| r20492 | r20493 | |
| 380 | 376 | else |
| 381 | 377 | if (offs == 0xff) |
| 382 | 378 | { |
| 383 | | machine().device<cassette_image_device>(CASSETTE_TAG)->output(-1.0); |
| 379 | m_cassette->output(-1.0); |
| 384 | 380 | zx_ula_bkgnd(1); |
| 385 | 381 | if (m_ula_frame_vsync == 2) |
| 386 | 382 | { |
| 387 | | mem.device().execute().spin_until_time(machine().primary_screen->time_until_pos(height - 1, 0)); |
| 383 | m_maincpu->spin_until_time(m_screen->time_until_pos(height - 1, 0)); |
| 388 | 384 | m_ula_scanline_count = height - 1; |
| 389 | | logerror ("S: %d B: %d\n", machine().primary_screen->vpos(), machine().primary_screen->hpos()); |
| 385 | logerror ("S: %d B: %d\n", m_screen->vpos(), m_screen->hpos()); |
| 390 | 386 | } |
| 391 | 387 | } |
| 392 | 388 | } |
trunk/src/mess/includes/zx.h
| r20492 | r20493 | |
| 20 | 20 | { |
| 21 | 21 | public: |
| 22 | 22 | zx_state(const machine_config &mconfig, device_type type, const char *tag) |
| 23 | | : driver_device(mconfig, type, tag) { } |
| 23 | : driver_device(mconfig, type, tag) |
| 24 | , m_maincpu(*this, "maincpu") |
| 25 | , m_ram(*this, RAM_TAG) |
| 26 | , m_screen(*this, "screen") |
| 27 | , m_cassette(*this, CASSETTE_TAG) |
| 28 | , m_speaker(*this, SPEAKER_TAG) |
| 29 | , m_region_maincpu(*this, "maincpu") |
| 30 | , m_region_gfx1(*this, "gfx1") |
| 31 | , m_io_row0(*this, "ROW0") |
| 32 | , m_io_row1(*this, "ROW1") |
| 33 | , m_io_row2(*this, "ROW2") |
| 34 | , m_io_row3(*this, "ROW3") |
| 35 | , m_io_row4(*this, "ROW4") |
| 36 | , m_io_row5(*this, "ROW5") |
| 37 | , m_io_row6(*this, "ROW6") |
| 38 | , m_io_row7(*this, "ROW7") |
| 39 | , m_io_config(*this, "CONFIG") |
| 40 | { } |
| 24 | 41 | |
| 25 | 42 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 26 | 43 | |
| r20492 | r20493 | |
| 61 | 78 | TIMER_CALLBACK_MEMBER(zx_tape_pulse); |
| 62 | 79 | TIMER_CALLBACK_MEMBER(zx_ula_nmi); |
| 63 | 80 | TIMER_CALLBACK_MEMBER(zx_ula_irq); |
| 81 | |
| 82 | protected: |
| 83 | required_device<cpu_device> m_maincpu; |
| 84 | required_device<ram_device> m_ram; |
| 85 | required_device<screen_device> m_screen; |
| 86 | required_device<cassette_image_device> m_cassette; |
| 87 | required_device<device_t> m_speaker; |
| 88 | required_memory_region m_region_maincpu; |
| 89 | optional_memory_region m_region_gfx1; |
| 90 | required_ioport m_io_row0; |
| 91 | required_ioport m_io_row1; |
| 92 | required_ioport m_io_row2; |
| 93 | required_ioport m_io_row3; |
| 94 | required_ioport m_io_row4; |
| 95 | required_ioport m_io_row5; |
| 96 | required_ioport m_io_row6; |
| 97 | required_ioport m_io_row7; |
| 98 | optional_ioport m_io_config; |
| 99 | |
| 100 | void zx_ula_r(int offs, memory_region *region, const UINT8 param); |
| 64 | 101 | }; |
| 65 | | /*----------- defined in video/zx.c -----------*/ |
| 66 | 102 | |
| 67 | | void zx_ula_bkgnd(running_machine &machine, int color); |
| 68 | | void zx_ula_r(running_machine &machine, int offs, const char *region, const UINT8 param); |
| 69 | | |
| 70 | 103 | #endif /* ZX_H_ */ |
trunk/src/mess/video/zx.c
| r20492 | r20493 | |
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | | void zx_ula_r(running_machine &machine, int offs, const char *region, const UINT8 param) |
| 123 | void zx_state::zx_ula_r(int offs, memory_region *region, const UINT8 param) |
| 124 | 124 | { |
| 125 | | zx_state *state = machine.driver_data<zx_state>(); |
| 126 | | screen_device *screen = machine.first_screen(); |
| 127 | 125 | int offs0 = offs & 0x7fff; |
| 128 | | UINT8 *rom = machine.root_device().memregion("maincpu")->base(); |
| 126 | UINT8 *rom = m_region_maincpu->base(); |
| 129 | 127 | UINT8 chr = rom[offs0]; |
| 130 | 128 | |
| 131 | | if ((!state->m_ula_irq_active) && (chr == 0x76)) |
| 129 | if ((!m_ula_irq_active) && (chr == 0x76)) |
| 132 | 130 | { |
| 133 | | bitmap_ind16 &bitmap = state->m_bitmap; |
| 131 | bitmap_ind16 &bitmap = m_bitmap; |
| 134 | 132 | UINT16 y, *scanline; |
| 135 | | UINT16 ireg = machine.device("maincpu")->state().state_int(Z80_I) << 8; |
| 133 | UINT16 ireg = m_maincpu->state_int(Z80_I) << 8; |
| 136 | 134 | UINT8 data, *chrgen, creg; |
| 137 | 135 | |
| 138 | 136 | if (param) |
| 139 | | creg = machine.device("maincpu")->state().state_int(Z80_B); |
| 137 | creg = m_maincpu->state_int(Z80_B); |
| 140 | 138 | else |
| 141 | | creg = machine.device("maincpu")->state().state_int(Z80_C); |
| 139 | creg = m_maincpu->state_int(Z80_C); |
| 142 | 140 | |
| 143 | | chrgen = state->memregion(region)->base(); |
| 141 | chrgen = region->base(); |
| 144 | 142 | |
| 145 | | if ((++state->m_ula_scanline_count == screen->height()) || (creg == 32)) |
| 143 | if ((++m_ula_scanline_count == m_screen->height()) || (creg == 32)) |
| 146 | 144 | { |
| 147 | | state->m_ula_scanline_count = 0; |
| 148 | | state->m_offs1 = offs0; |
| 145 | m_ula_scanline_count = 0; |
| 146 | m_offs1 = offs0; |
| 149 | 147 | } |
| 150 | 148 | |
| 151 | | state->m_ula_frame_vsync = 3; |
| 149 | m_ula_frame_vsync = 3; |
| 152 | 150 | |
| 153 | | state->m_charline_ptr = 0; |
| 151 | m_charline_ptr = 0; |
| 154 | 152 | |
| 155 | | for (y = state->m_offs1+1; ((y < offs0) && (state->m_charline_ptr < ARRAY_LENGTH(state->m_charline))); y++) |
| 153 | for (y = m_offs1+1; ((y < offs0) && (m_charline_ptr < ARRAY_LENGTH(m_charline))); y++) |
| 156 | 154 | { |
| 157 | | state->m_charline[state->m_charline_ptr] = rom[y]; |
| 158 | | state->m_charline_ptr++; |
| 155 | m_charline[m_charline_ptr] = rom[y]; |
| 156 | m_charline_ptr++; |
| 159 | 157 | } |
| 160 | | for (y = state->m_charline_ptr; y < ARRAY_LENGTH(state->m_charline); y++) |
| 161 | | state->m_charline[y] = 0; |
| 158 | for (y = m_charline_ptr; y < ARRAY_LENGTH(m_charline); y++) |
| 159 | m_charline[y] = 0; |
| 162 | 160 | |
| 163 | | machine.scheduler().timer_set(machine.device<cpu_device>("maincpu")->cycles_to_attotime(((32 - state->m_charline_ptr) << 2)), timer_expired_delegate(FUNC(zx_state::zx_ula_irq),state)); |
| 164 | | state->m_ula_irq_active++; |
| 161 | machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(((32 - m_charline_ptr) << 2)), timer_expired_delegate(FUNC(zx_state::zx_ula_irq),this)); |
| 162 | m_ula_irq_active++; |
| 165 | 163 | |
| 166 | | scanline = &bitmap.pix16(state->m_ula_scanline_count); |
| 164 | scanline = &bitmap.pix16(m_ula_scanline_count); |
| 167 | 165 | y = 0; |
| 168 | 166 | |
| 169 | | for (state->m_charline_ptr = 0; state->m_charline_ptr < ARRAY_LENGTH(state->m_charline); state->m_charline_ptr++) |
| 167 | for (m_charline_ptr = 0; m_charline_ptr < ARRAY_LENGTH(m_charline); m_charline_ptr++) |
| 170 | 168 | { |
| 171 | | chr = state->m_charline[state->m_charline_ptr]; |
| 169 | chr = m_charline[m_charline_ptr]; |
| 172 | 170 | data = chrgen[ireg | ((chr & 0x3f) << 3) | ((8 - creg)&7) ]; |
| 173 | 171 | if (chr & 0x80) data ^= 0xff; |
| 174 | 172 | |
| r20492 | r20493 | |
| 180 | 178 | scanline[y++] = (data >> 2) & 1; |
| 181 | 179 | scanline[y++] = (data >> 1) & 1; |
| 182 | 180 | scanline[y++] = (data >> 0) & 1; |
| 183 | | state->m_charline[state->m_charline_ptr] = 0; |
| 181 | m_charline[m_charline_ptr] = 0; |
| 184 | 182 | } |
| 185 | 183 | |
| 186 | | if (creg == 1) state->m_offs1 = offs0; |
| 184 | if (creg == 1) m_offs1 = offs0; |
| 187 | 185 | } |
| 188 | 186 | } |
| 189 | 187 | |
| r20492 | r20493 | |
| 191 | 189 | { |
| 192 | 190 | m_ula_nmi = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(zx_state::zx_ula_nmi),this)); |
| 193 | 191 | m_ula_irq_active = 0; |
| 194 | | machine().primary_screen->register_screen_bitmap(m_bitmap); |
| 192 | m_screen->register_screen_bitmap(m_bitmap); |
| 195 | 193 | } |
| 196 | 194 | |
| 197 | 195 | void zx_state::screen_eof_zx(screen_device &screen, bool state) |