| Previous | 15994 Revisions | Next |
| r8454 Friday 9th July, 2010 at 13:30:16 UTC by Miodrag Milanović |
|---|
| removal of devtag_get_device from mess code |
| [src/mess/audio] | gmaster.c mac.c mea8000.c sblaster.c vp550.c |
| [src/mess/devices] | aescart.c appldriv.c cartslot.c coco_vhd.c flopdrv.c orch90.c sonydriv.c thomflop.c ti99cart.c z80bin.c |
| [src/mess/drivers] | 4004clk.c a2600.c a310.c abc80.c abc80x.c acrnsys1.c adam.c altair.c ami1200.c amiga.c apexc.c apf.c apricot.c apricotf.c aquarius.c atarist.c atm.c atom.c avigo.c bbc.c bebox.c beta.c busicom.c bw12.c bw2.c c16.c c64.c c65.c c80.c camplynx.c cat.c cbmb.c ccs2422.c ccs2810.c cdi.c cgc7900.c coleco.c cosmicos.c cpschngr.c craft.c crvision.c dc.c dectalk.c dual68.c e01.c ec65.c einstein.c elf.c elwro800.c enterp.c esq1.c eti660.c ex800.c exelv.c exp85.c fidelz80.c fk1.c fm7.c fmtowns.c gba.c glasgow.c gp32.c h19.c horizon.c ht68k.c huebler.c ip20.c ip22.c ipb.c ipc.c ipds.c isbc.c jaguar.c jtc.c jupiter.c kc.c kim1.c kyocera.c lc80.c lx800.c lynx.c mac.c mc10.c mc1000.c mephisto.c microdec.c micronic.c mikromik.c mk1.c mk2.c mod8.c mpf1.c mz2500.c nakajies.c nanos.c nc.c newbrain.c ng_aes.c ngp.c osi.c p2000t.c p8k.c palm.c pasogo.c pc6001.c pc8001.c pc8401a.c pc98.c pce220.c pcw.c pcw16.c pegasus.c pentagon.c pet.c phc25.c pk8000.c pocketc.c pockstat.c poly880.c prof80.c psx.c pv1000.c px4.c px8.c pyl601.c ql.c qx10.c rt1715.c sage2.c samcoupe.c saturn.c scorpion.c scv.c sg1000.c sgi_ip2.c sgi_ip6.c socrates.c sord.c spc1000.c spec128.c specpls3.c spectrum.c ssem.c ssystem3.c studio2.c sun1.c supracan.c swtpc.c tandy2k.c tec1.c thomson.c ti89.c ti990_4.c tiki100.c timex.c tm990189.c tmc1800.c tmc2000e.c tmc600.c tricep.c trs80m2.c tutor.c tvc.c v1050.c vboy.c vcs80.c vector4.c vg5k.c vic20.c victor9k.c vidbrain.c vii.c vip.c vt100.c vt220.c vt320.c vtech1.c x07.c x1.c x68k.c xerox820.c xor100.c z88.c z9001.c zexall.c zrt80.c |
| [src/mess/formats] | comx35_comx.c m65_snqk.c spec_snqk.c |
| [src/mess/machine] | 3do.c 6551.c 6883sam.c 990_hd.c 994x_ser.c 99_dsk.c 99_hsgpl.c 99_ide.c 99_usbsm.c a7800.c abc77.c abcbus.c advision.c aim65.c amigacd.c amigacrt.c amigafdc.c amigakbd.c amstr_pc.c amstrad.c ap2_slot.c apple1.c apple2.c apple2gs.c apple3.c at.c ataricrt.c atarifdc.c b2m.c bbc.c bebox.c beta.c bk.c c128.c c1541.c c1551.c c1571.c c1581.c c2040.c c64.c c65.c c9060.c cbmb.c cbmiec.c cgenie.c coco.c compis.c comx35.c concept.c corvushd.c cybiko.c dai.c dc.c dgn_beta.c electron.c europc.c exidy.c galaxy.c gamecom.c gamepock.c gb.c gdrom.c genesis.c geneve.c hd63450.c hec2hrp.c hp48.c i82439tx.c i8271.c ieee488.c intv.c kay_kbd.c kaypro.c kc.c lisa.c llc.c lviv.c mac.c matsucd.c mbee.c mc68328.c mc80.c microtan.c mikro80.c mockngbd.c mpc105.c msm8251.c msx.c msx_slot.c mtx.c mz700.c mz80.c nascom1.c nes.c odyssey2.c ondra.c orao.c oric.c orion.c osborne1.c p2000t.c partner.c pc.c pc1251.c pc1350.c pc1401.c pc1403.c pc8801.c pc_hdc.c pce.c pdp1.c pecom.c pet.c pk8020.c pmd85.c pokemini.c poly88.c pp01.c primo.c radio86.c rmnimbus.c rt1715.c samcoupe.c sgi.c sms.c snescart.c special.c super80.c svi318.c sym1.c tandy1t.c teleprinter.c terminal.c thomson.c ti85.c ti99_4x.c ti99pcod.c trs80.c tx0.c upd765.c ut88.c vector06.c vectrex.c vic1112.c vtech2.c wd17xx.c wswan.c z1013.c z80ne.c zx.c |
| [src/mess/tools/messtest] | testmess.c |
| [src/mess/video] | 911_vdt.c a7800.c abc800.c abc802.c abc806.c aim65.c apple2.c apple3.c arcadia.c b2m.c cbmb.c coco3.c comx35.c crtc_ega.c dgn_beta.c dm9368.c epnick.c galaxy.c gba.c kaypro.c kc.c kyocera.c mac.c mc68328.c nc.c nes.c newport.c ondra.c orion.c pc8401a.c pc_aga.c pc_cga.c pc_ega.c pc_mda.c pc_t1t.c pcw.c pcw16.c pdp1.c pecom.c pk8020.c pmd85.c pp01.c radio86.c special.c ssystem3.c super80.c timex.c tmc600.c tx0.c upd3301.c v1050.c vc4000.c vector06.c vectrex.c vic4567.c vic6567.c x68k.c z88.c zx.c zx8301.c |
| r8453 | r8454 | |
|---|---|---|
| 53 | 53 | orch90_t *info = get_token(device); |
| 54 | 54 | |
| 55 | 55 | /* TODO - when we can instantiate DACs, we can do something better here */ |
| 56 | info->left_dac = devtag_get_device(device->machine, "dac"); | |
| 57 | info->right_dac = devtag_get_device(device->machine, "dac"); | |
| 56 | info->left_dac = device->machine->device("dac"); | |
| 57 | info->right_dac = device->machine->device("dac"); | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 |
| r8453 | r8454 | |
|---|---|---|
| 2797 | 2797 | cartridge_t *cart; |
| 2798 | 2798 | |
| 2799 | 2799 | /* Idle the CPU */ |
| 2800 | cpu_adjust_icount(dev | |
| 2800 | cpu_adjust_icount(dev | |
| 2801 | 2801 | // Alternatively: |
| 2802 | 2802 | // cpu_spinuntil_time(device->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 2803 | 2803 | |
| r8453 | r8454 | |
| 2861 | 2861 | cartridge_t *cart; |
| 2862 | 2862 | |
| 2863 | 2863 | /* Idle the CPU */ |
| 2864 | cpu_adjust_icount(dev | |
| 2864 | cpu_adjust_icount(dev | |
| 2865 | 2865 | // cpu_spinuntil_time(device->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 2866 | 2866 | |
| 2867 | 2867 | // Handle GRAM Kracker |
| r8453 | r8454 | |
| 2980 | 2980 | cartridge_t *cart; |
| 2981 | 2981 | |
| 2982 | 2982 | /* Idle the CPU. TODO: Check whether this is correct for this machine. */ |
| 2983 | cpu_adjust_icount(dev | |
| 2983 | cpu_adjust_icount(dev | |
| 2984 | 2984 | |
| 2985 | 2985 | // Handle GRAM Kracker |
| 2986 | 2986 | if ((cartslots->gk_slot != -1) && (input_port_read(device->machine, "CARTSLOT")==CART_GK)) |
| r8453 | r8454 | |
| 3020 | 3020 | int slot = cartslots->active_slot; |
| 3021 | 3021 | |
| 3022 | 3022 | /* Idle the CPU. TODO: Check whether this is correct for this machine. */ |
| 3023 | cpu_adjust_icount(dev | |
| 3023 | cpu_adjust_icount(dev | |
| 3024 | 3024 | |
| 3025 | 3025 | // Handle GRAM Kracker |
| 3026 | 3026 | if ((cartslots->gk_slot != -1) && (input_port_read(device->machine, "CARTSLOT")==CART_GK)) |
| r8453 | r8454 | |
|---|---|---|
| 126 | 126 | else |
| 127 | 127 | { |
| 128 | 128 | if (autorun) |
| 129 | cpu_set_reg( | |
| 129 | cpu_set_reg( | |
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 |
| r8453 | r8454 | |
|---|---|---|
| 755 | 755 | running_device *floppy_get_device(running_machine *machine,int drive) |
| 756 | 756 | { |
| 757 | 757 | switch(drive) { |
| 758 | case 0 : return devtag_get_device(machine,FLOPPY_0); | |
| 759 | case 1 : return devtag_get_device(machine,FLOPPY_1); | |
| 760 | case 2 : return devtag_get_device(machine,FLOPPY_2); | |
| 761 | case 3 : return devtag_get_device(machine,FLOPPY_3); | |
| 758 | case 0 : return machine->device(FLOPPY_0); | |
| 759 | case 1 : return machine->device(FLOPPY_1); | |
| 760 | case 2 : return machine->device(FLOPPY_2); | |
| 761 | case 3 : return machine->device(FLOPPY_3); | |
| 762 | 762 | } |
| 763 | 763 | return NULL; |
| 764 | 764 | } |
| r8453 | r8454 | |
| 830 | 830 | int floppy_get_count(running_machine *machine) |
| 831 | 831 | { |
| 832 | 832 | int cnt = 0; |
| 833 | if (devtag_get_device(machine,FLOPPY_0)) cnt++; | |
| 834 | if (devtag_get_device(machine,FLOPPY_1)) cnt++; | |
| 835 | if (devtag_get_device(machine,FLOPPY_2)) cnt++; | |
| 836 | if (devtag_get_device(machine,FLOPPY_3)) cnt++; | |
| 833 | if (machine->device(FLOPPY_0)) cnt++; | |
| 834 | if (machine->device(FLOPPY_1)) cnt++; | |
| 835 | if (machine->device(FLOPPY_2)) cnt++; | |
| 836 | if (machine->device(FLOPPY_3)) cnt++; | |
| 837 | 837 | return cnt; |
| 838 | 838 | } |
| 839 | 839 |
| r8453 | r8454 | |
|---|---|---|
| 478 | 478 | running_device *fdc; |
| 479 | 479 | |
| 480 | 480 | /* locate the FDC */ |
| 481 | fdc = | |
| 481 | fdc = | |
| 482 | 482 | |
| 483 | 483 | id = floppy_get_drive_by_type(&image.device(),FLOPPY_TYPE_SONY); |
| 484 | 484 | save_track_data(fdc, id); |
| r8453 | r8454 | |
|---|---|---|
| 107 | 107 | datawidth = ROMREGION_GETWIDTH(romrgn) / 8; |
| 108 | 108 | |
| 109 | 109 | /* if the region is inverted, do that now */ |
| 110 | cpu = | |
| 110 | cpu = | |
| 111 | 111 | if (cpu != NULL) |
| 112 | 112 | { |
| 113 | 113 | datawidth = device_memory(cpu)->space_config(AS_PROGRAM)->m_databus_width / 8; |
| r8453 | r8454 | |
|---|---|---|
| 135 | 135 | |
| 136 | 136 | int apple525_get_count(running_machine *machine) { |
| 137 | 137 | int cnt = 0; |
| 138 | if (devtag_get_device(machine,FLOPPY_0)!=NULL && flopimg_get_custom_data(devtag_get_device(machine,FLOPPY_0))!=NULL) cnt++; | |
| 139 | if (devtag_get_device(machine,FLOPPY_1)!=NULL && flopimg_get_custom_data(devtag_get_device(machine,FLOPPY_1))!=NULL) cnt++; | |
| 140 | if (devtag_get_device(machine,FLOPPY_2)!=NULL && flopimg_get_custom_data(devtag_get_device(machine,FLOPPY_2))!=NULL) cnt++; | |
| 141 | if (devtag_get_device(machine,FLOPPY_3)!=NULL && flopimg_get_custom_data(devtag_get_device(machine,FLOPPY_3))!=NULL) cnt++; | |
| 138 | if (machine->device(FLOPPY_0)!=NULL && flopimg_get_custom_data(machine->device(FLOPPY_0))!=NULL) cnt++; | |
| 139 | if (machine->device(FLOPPY_1)!=NULL && flopimg_get_custom_data(machine->device(FLOPPY_1))!=NULL) cnt++; | |
| 140 | if (machine->device(FLOPPY_2)!=NULL && flopimg_get_custom_data(machine->device(FLOPPY_2))!=NULL) cnt++; | |
| 141 | if (machine->device(FLOPPY_3)!=NULL && flopimg_get_custom_data(machine->device(FLOPPY_3))!=NULL) cnt++; | |
| 142 | 142 | return cnt; |
| 143 | 143 | } |
| 144 | 144 |
| r8453 | r8454 | |
|---|---|---|
| 503 | 503 | cartslot_t *cart; |
| 504 | 504 | multicart_open_error me; |
| 505 | 505 | UINT32 size; |
| 506 | running_device* ym = | |
| 506 | running_device* ym = | |
| 507 | 507 | |
| 508 | 508 | // first check software list |
| 509 | 509 | if(image.software_entry() != NULL) |
| r8453 | r8454 | |
|---|---|---|
| 164 | 164 | switch(data) |
| 165 | 165 | { |
| 166 | 166 | case VHDCMD_READ: /* Read sector */ |
| 167 | memset(&messram_get_ptr(dev | |
| 167 | memset(&messram_get_ptr(dev | |
| 168 | 168 | if (total_size > seek_position) |
| 169 | 169 | { |
| 170 | 170 | bytes_to_read = (UINT32) MIN((UINT64) 256, total_size - seek_position); |
| 171 | result = image->fread(&messram_get_ptr(dev | |
| 171 | result = image->fread(&messram_get_ptr(dev | |
| 172 | 172 | if (result != bytes_to_read) |
| 173 | 173 | { |
| 174 | 174 | vhd->status = VHDSTATUS_ACCESS_DENIED; |
| r8453 | r8454 | |
| 180 | 180 | break; |
| 181 | 181 | |
| 182 | 182 | case VHDCMD_WRITE: /* Write Sector */ |
| 183 | result = image->fwrite(&(messram_get_ptr(dev | |
| 183 | result = image->fwrite(&(messram_get_ptr(dev | |
| 184 | 184 | |
| 185 | 185 | if (result != 256) |
| 186 | 186 | { |
| r8453 | r8454 | |
|---|---|---|
| 273 | 273 | |
| 274 | 274 | static READ8_HANDLER ( to7_5p14_r ) |
| 275 | 275 | { |
| 276 | running_device *fdc = | |
| 276 | running_device *fdc = | |
| 277 | 277 | |
| 278 | 278 | if ( offset < 4 ) |
| 279 | 279 | return wd17xx_r( fdc, offset ); |
| 280 | 280 | else if ( offset == 8 ) |
| 281 | 281 | return to7_5p14_select; |
| 282 | 282 | else |
| 283 | logerror ( "%f $%04x to7_5p14_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 283 | logerror ( "%f $%04x to7_5p14_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 284 | 284 | return 0; |
| 285 | 285 | } |
| 286 | 286 | |
| r8453 | r8454 | |
| 288 | 288 | |
| 289 | 289 | static WRITE8_HANDLER( to7_5p14_w ) |
| 290 | 290 | { |
| 291 | running_device *fdc = | |
| 291 | running_device *fdc = | |
| 292 | 292 | if ( offset < 4 ) |
| 293 | 293 | wd17xx_w( fdc, offset, data ); |
| 294 | 294 | else if ( offset == 8 ) |
| r8453 | r8454 | |
| 304 | 304 | case 4: drive = 2; side = 0; break; |
| 305 | 305 | case 5: drive = 3; side = 1; break; |
| 306 | 306 | default: |
| 307 | logerror( "%f $%04x to7_5p14_w: invalid drive select pattern $%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 307 | logerror( "%f $%04x to7_5p14_w: invalid drive select pattern $%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | wd17xx_dden_w(fdc, BIT(data, 7)); |
| r8453 | r8454 | |
| 317 | 317 | wd17xx_set_drive( fdc, drive ); |
| 318 | 318 | wd17xx_set_side( fdc, side ); |
| 319 | 319 | LOG(( "%f $%04x to7_5p14_w: $%02X set drive=%i side=%i density=%s\n", |
| 320 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 320 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 321 | 321 | data, drive, side, (BIT(data, 7) ? "FM" : "MFM"))); |
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | else |
| 325 | 325 | logerror ( "%f $%04x to7_5p14_w: invalid write offset %i (data=$%02X)\n", |
| 326 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 326 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | |
| 330 | 330 | |
| 331 | 331 | static void to7_5p14_reset( running_machine *machine ) |
| 332 | 332 | { |
| 333 | running_device *fdc = | |
| 333 | running_device *fdc = m | |
| 334 | 334 | LOG(( "to7_5p14_reset: CD 90-640 controller\n" )); |
| 335 | 335 | wd17xx_reset(fdc); |
| 336 | 336 | } |
| r8453 | r8454 | |
| 362 | 362 | static READ8_HANDLER ( to7_5p14sd_r ) |
| 363 | 363 | { |
| 364 | 364 | if ( offset < 8 ) |
| 365 | return mc6843_r( | |
| 365 | return mc6843_r( | |
| 366 | 366 | else if ( offset >= 8 && offset <= 9 ) |
| 367 | 367 | return to7_5p14sd_select; |
| 368 | 368 | else |
| 369 | logerror ( "%f $%04x to7_5p14sd_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 369 | logerror ( "%f $%04x to7_5p14sd_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 370 | 370 | return 0; |
| 371 | 371 | } |
| 372 | 372 | |
| r8453 | r8454 | |
| 375 | 375 | static WRITE8_HANDLER( to7_5p14sd_w ) |
| 376 | 376 | { |
| 377 | 377 | if ( offset < 8 ) |
| 378 | mc6843_w( | |
| 378 | mc6843_w( | |
| 379 | 379 | else if ( offset >= 8 && offset <= 9 ) |
| 380 | 380 | { |
| 381 | 381 | /* drive select */ |
| r8453 | r8454 | |
| 407 | 407 | if ( drive != -1 ) |
| 408 | 408 | { |
| 409 | 409 | thom_floppy_active( space->machine, 0 ); |
| 410 | mc6843_set_drive( devtag_get_device(space->machine, "mc6843"), drive ); | |
| 411 | mc6843_set_side( devtag_get_device(space->machine, "mc6843"), side ); | |
| 410 | mc6843_set_drive( space->machine->device("mc6843"), drive ); | |
| 411 | mc6843_set_side( space->machine->device("mc6843"), side ); | |
| 412 | 412 | LOG(( "%f $%04x to7_5p14sd_w: $%02X set drive=%i side=%i\n", |
| 413 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 413 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 414 | 414 | } |
| 415 | 415 | } |
| 416 | 416 | else |
| 417 | 417 | logerror ( "%f $%04x to7_5p14sd_w: invalid write offset %i (data=$%02X)\n", |
| 418 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 418 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | static void to7_5p14_index_pulse_callback( running_device *controller,running_device *image, int state ) |
| 422 | 422 | { |
| 423 | mc6843_set_index_pulse( | |
| 423 | mc6843_set_index_pulse( | |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | static void to7_5p14sd_reset( running_machine *machine ) |
| r8453 | r8454 | |
| 593 | 593 | data = to7qdd->data[ to7qdd->data_idx ]; |
| 594 | 594 | |
| 595 | 595 | VLOG(( "%f $%04x to7_qdd_read_byte: RDATA off=%i/%i data=$%02X\n", |
| 596 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( | |
| 596 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(m | |
| 597 | 597 | to7qdd->data_idx, to7qdd->data_size, data )); |
| 598 | 598 | |
| 599 | 599 | to7qdd->data_idx++; |
| r8453 | r8454 | |
| 634 | 634 | to7qdd->data_idx++; |
| 635 | 635 | |
| 636 | 636 | VLOG (( "%f $%04x to7_qdd_write_byte: got $%02X offs=%i-%i\n", |
| 637 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( | |
| 637 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(m | |
| 638 | 638 | to7qdd->start_idx, to7qdd->data_idx )); |
| 639 | 639 | |
| 640 | 640 | /* end of tentative id field */ |
| r8453 | r8454 | |
| 648 | 648 | UINT8 filler = 0xff; |
| 649 | 649 | |
| 650 | 650 | LOG(( "%f $%04x to7_qdd_write_byte: got id field for sector=%i\n", |
| 651 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( | |
| 651 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(m | |
| 652 | 652 | |
| 653 | 653 | floppy_drive_format_sector( to7_qdd_image(machine), |
| 654 | 654 | 0, sector, 0, 0, sector, 128, filler ); |
| r8453 | r8454 | |
| 678 | 678 | int sector = (int) to7qdd->data[ i + 1 ] * 256 + (int) to7qdd->data[ i + 2 ]; |
| 679 | 679 | |
| 680 | 680 | LOG(( "%f $%04x to7_qdd_write_byte: goto data field for sector=%i\n", |
| 681 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( | |
| 681 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(m | |
| 682 | 682 | |
| 683 | 683 | floppy_drive_write_sector_data( to7_qdd_image(machine), 0, sector, to7qdd->data + to7qdd->start_idx + 1, 128, 0 ); |
| 684 | 684 | thom_floppy_active( machine, 1 ); |
| r8453 | r8454 | |
| 701 | 701 | case 0: /* MC6852 status */ |
| 702 | 702 | to7_qdd_stat_update(space->machine); |
| 703 | 703 | VLOG(( "%f $%04x to7_qdd_r: STAT=$%02X irq=%i pe=%i ovr=%i und=%i tr=%i rd=%i ncts=%i\n", |
| 704 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 704 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 705 | 705 | to7qdd->status & QDD_S_IRQ ? 1 : 0, |
| 706 | 706 | to7qdd->status & QDD_S_PE ? 1 : 0, |
| 707 | 707 | to7qdd->status & QDD_S_OVR ? 1 : 0, |
| r8453 | r8454 | |
| 724 | 724 | data |= 0x40; /* disk present */ |
| 725 | 725 | if ( to7qdd->index_pulse ) |
| 726 | 726 | data |= 0x80; /* disk start */ |
| 727 | VLOG(( "%f $%04x to7_qdd_r: STATUS8 $%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 727 | VLOG(( "%f $%04x to7_qdd_r: STATUS8 $%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 728 | 728 | return data; |
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | default: |
| 732 | logerror ( "%f $%04x to7_qdd_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 732 | logerror ( "%f $%04x to7_qdd_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 733 | 733 | return 0; |
| 734 | 734 | } |
| 735 | 735 | } |
| r8453 | r8454 | |
| 751 | 751 | to7qdd->ctrl1 = ( data & ~(QDD_C1_RRESET | QDD_C1_TRESET) ) |( data & (QDD_C1_RRESET | QDD_C1_TRESET) & to7qdd->ctrl1 ); |
| 752 | 752 | to7_qdd_stat_update(space->machine); |
| 753 | 753 | VLOG(( "%f $%04x to7_qdd_w: CTRL1=$%02X reset=%c%c %s%sirq=%c%c\n", |
| 754 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 754 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 755 | 755 | data & QDD_C1_RRESET ? 'r' : '-', data & QDD_C1_TRESET ? 't' : '-', |
| 756 | 756 | data & QDD_C1_STRIPSYNC ? "strip-sync " : "", |
| 757 | 757 | data & QDD_C1_CLRSYNC ? "clear-sync " : "", |
| r8453 | r8454 | |
| 775 | 775 | parity = par[ (data >> 3) & 7 ]; |
| 776 | 776 | to7_qdd_stat_update(space->machine); |
| 777 | 777 | VLOG(( "%f $%04x to7_qdd_w: CTRL2=$%02X bits=%i par=%s blen=%i under=%s%s\n", |
| 778 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 778 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 779 | 779 | bits, parname[ parity ], data & QDD_C2_BLEN ? 1 : 2, |
| 780 | 780 | data & QDD_C2_TSYNC ? "sync" : "ff", |
| 781 | 781 | data & QDD_C2_EIE ? "irq-err" : "" )); |
| r8453 | r8454 | |
| 793 | 793 | to7qdd->status &= ~QDD_S_NCTS; |
| 794 | 794 | to7_qdd_stat_update(space->machine); |
| 795 | 795 | VLOG(( "%f $%04x to7_qdd_w: CTRL3=$%02X %s%ssync-len=%i sync-mode=%s\n", |
| 796 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 796 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 797 | 797 | data & QDD_C3_CLRTUF ? "clr-tuf " : "", |
| 798 | 798 | data & QDD_C3_CLRCTS ? "clr-cts " : "", |
| 799 | 799 | data & QDD_C3_SYNCLEN ? 1 : 2, |
| r8453 | r8454 | |
| 805 | 805 | break; |
| 806 | 806 | |
| 807 | 807 | case 3: /* MC6852 data out => does not seem to be used */ |
| 808 | VLOG(( "%f $%04x to7_qdd_w: ignored WDATA=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 808 | VLOG(( "%f $%04x to7_qdd_w: ignored WDATA=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 809 | 809 | break; |
| 810 | 810 | |
| 811 | 811 | } |
| r8453 | r8454 | |
| 813 | 813 | |
| 814 | 814 | case 8: /* set drive */ |
| 815 | 815 | to7qdd->drive = data; |
| 816 | VLOG(( "%f $%04x to7_qdd_w: DRIVE=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 816 | VLOG(( "%f $%04x to7_qdd_w: DRIVE=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 817 | 817 | break; |
| 818 | 818 | |
| 819 | 819 | case 12: /* motor pulse ? */ |
| 820 | 820 | thom_floppy_active( space->machine, 0 ); |
| 821 | VLOG(( "%f $%04x to7_qdd_w: MOTOR=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 821 | VLOG(( "%f $%04x to7_qdd_w: MOTOR=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 822 | 822 | break; |
| 823 | 823 | |
| 824 | 824 | default: |
| 825 | logerror ( "%f $%04x to7_qdd_w: invalid write offset %i (data=$%02X)\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 825 | logerror ( "%f $%04x to7_qdd_w: invalid write offset %i (data=$%02X)\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 826 | 826 | } |
| 827 | 827 | } |
| 828 | 828 | |
| r8453 | r8454 | |
| 1054 | 1054 | UINT8 data = thmfc1->data[ thmfc1->data_idx ]; |
| 1055 | 1055 | |
| 1056 | 1056 | VLOG(( "%f $%04x thmfc_floppy_read_byte: off=%i/%i/%i data=$%02X\n", |
| 1057 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( | |
| 1057 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(m | |
| 1058 | 1058 | thmfc1->data_idx, thmfc1->data_finish - 1, thmfc1->data_size - 1, |
| 1059 | 1059 | data )); |
| 1060 | 1060 | |
| r8453 | r8454 | |
| 1097 | 1097 | data = thmfc1->data[ thmfc1->data_raw_idx ]; |
| 1098 | 1098 | |
| 1099 | 1099 | VLOG(( "%f $%04x thmfc_floppy_raw_read_byte: off=%i/%i data=$%02X\n", |
| 1100 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( | |
| 1100 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(m | |
| 1101 | 1101 | thmfc1->data_raw_idx, thmfc1->data_raw_size, data )); |
| 1102 | 1102 | |
| 1103 | 1103 | thmfc1->data_raw_idx++; |
| r8453 | r8454 | |
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | 1137 | VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: $%02X offs=%i-%i\n", |
| 1138 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( | |
| 1138 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(m | |
| 1139 | 1139 | thmfc1->data_idx,thmfc1->data_raw_idx )); |
| 1140 | 1140 | |
| 1141 | 1141 | if ( thmfc1->data_raw_idx == thmfc1->data_idx + 3 && |
| r8453 | r8454 | |
| 1147 | 1147 | int sector = (int) thmfc1->data[ thmfc1->data_idx ] * 256 + (int) thmfc1->data[ thmfc1->data_idx + 1 ]; |
| 1148 | 1148 | UINT8 filler = 0xff; |
| 1149 | 1149 | |
| 1150 | LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: id field, sector=%i\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( | |
| 1150 | LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: id field, sector=%i\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(m | |
| 1151 | 1151 | |
| 1152 | 1152 | floppy_drive_format_sector( thmfc_floppy_image(machine), 0, sector, 0, 0, sector, 128, filler ); |
| 1153 | 1153 | thom_floppy_active( machine, 1 ); |
| r8453 | r8454 | |
| 1177 | 1177 | (int) thmfc1->data[ i + 2 ]; |
| 1178 | 1178 | |
| 1179 | 1179 | LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: data field, sector=%i\n", |
| 1180 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( | |
| 1180 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(m | |
| 1181 | 1181 | |
| 1182 | 1182 | floppy_drive_write_sector_data( img, 0, sector, thmfc1->data + thmfc1->data_idx, 128, 0 ); |
| 1183 | 1183 | thom_floppy_active( machine, 1 ); |
| r8453 | r8454 | |
| 1192 | 1192 | else |
| 1193 | 1193 | { |
| 1194 | 1194 | thmfc1->data_raw_idx++; |
| 1195 | VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: ignored $%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( | |
| 1195 | VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: ignored $%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(m | |
| 1196 | 1196 | } |
| 1197 | 1197 | |
| 1198 | 1198 | } |
| r8453 | r8454 | |
| 1203 | 1203 | static void thmfc_floppy_write_byte ( running_machine *machine, UINT8 data ) |
| 1204 | 1204 | { |
| 1205 | 1205 | VLOG (( "%f $%04x thmfc_floppy_write_byte: off=%i/%i data=$%02X\n", |
| 1206 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( | |
| 1206 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(m | |
| 1207 | 1207 | thmfc1->data_idx, thmfc1->data_size - 1, data )); |
| 1208 | 1208 | |
| 1209 | 1209 | thmfc1->data_raw_size = 0; |
| r8453 | r8454 | |
| 1217 | 1217 | /* intelligent formatting */ |
| 1218 | 1218 | static void thmfc_floppy_format_byte ( running_machine *machine, UINT8 data ) |
| 1219 | 1219 | { |
| 1220 | VLOG (( "%f $%04x thmfc_floppy_format_byte: $%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( | |
| 1220 | VLOG (( "%f $%04x thmfc_floppy_format_byte: $%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(m | |
| 1221 | 1221 | |
| 1222 | 1222 | thmfc1->data_raw_size = 0; |
| 1223 | 1223 | |
| r8453 | r8454 | |
| 1262 | 1262 | |
| 1263 | 1263 | case 0: /* STAT0 */ |
| 1264 | 1264 | thmfc1->stat0 ^= THMFC1_STAT0_SYNCHRO | THMFC1_STAT0_BYTE_READY_POL; |
| 1265 | VLOG(( "%f $%04x thmfc_floppy_r: STAT0=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1265 | VLOG(( "%f $%04x thmfc_floppy_r: STAT0=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1266 | 1266 | return thmfc1->stat0; |
| 1267 | 1267 | |
| 1268 | 1268 | case 1: /* STAT1 */ |
| r8453 | r8454 | |
| 1294 | 1294 | data |= 0x10; |
| 1295 | 1295 | if (!floppy_wpt_r(&img->device())) |
| 1296 | 1296 | data |= 0x04; |
| 1297 | VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1297 | VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1298 | 1298 | return data; |
| 1299 | 1299 | } |
| 1300 | 1300 | |
| r8453 | r8454 | |
| 1312 | 1312 | { |
| 1313 | 1313 | /* undocumented => emulate TO7 QDD controller ? */ |
| 1314 | 1314 | UINT8 data = thmfc1->ipl << 7; |
| 1315 | VLOG(( "%f $%04x thmfc_floppy_r: STAT8=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1315 | VLOG(( "%f $%04x thmfc_floppy_r: STAT8=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1316 | 1316 | return data; |
| 1317 | 1317 | } |
| 1318 | 1318 | |
| 1319 | 1319 | default: |
| 1320 | logerror ( "%f $%04x thmfc_floppy_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1320 | logerror ( "%f $%04x thmfc_floppy_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1321 | 1321 | return 0; |
| 1322 | 1322 | } |
| 1323 | 1323 | } |
| r8453 | r8454 | |
| 1335 | 1335 | chrn_id id; |
| 1336 | 1336 | thmfc1->formatting = (data >> 2) & 1; |
| 1337 | 1337 | LOG (( "%f $%04x thmfc_floppy_w: CMD0=$%02X dens=%s wsync=%i dsync=%i fmt=%i op=%i\n", |
| 1338 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1338 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1339 | 1339 | (BIT(data, 5) ? "FM" : "MFM"), |
| 1340 | 1340 | wsync, (data >> 3) & 1, |
| 1341 | 1341 | thmfc1->formatting, data & 3 )); |
| r8453 | r8454 | |
| 1421 | 1421 | if ( thmfc1->sector_size > 256 ) |
| 1422 | 1422 | { |
| 1423 | 1423 | logerror( "$%04x thmfc_floppy_w: sector size %i > 256 not handled\n", |
| 1424 | cpu_get_previouspc( | |
| 1424 | cpu_get_previouspc( | |
| 1425 | 1425 | thmfc1->sector_size = 256; |
| 1426 | 1426 | } |
| 1427 | 1427 | |
| 1428 | 1428 | LOG (( "%f $%04x thmfc_floppy_w: CMD1=$%02X sect-size=%i comp=%i head=%i\n", |
| 1429 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1429 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1430 | 1430 | thmfc1->sector_size, (data >> 1) & 7, thmfc1->side )); |
| 1431 | 1431 | break; |
| 1432 | 1432 | |
| r8453 | r8454 | |
| 1455 | 1455 | thom_floppy_active( space->machine, 0 ); |
| 1456 | 1456 | |
| 1457 | 1457 | LOG (( "%f $%04x thmfc_floppy_w: CMD2=$%02X drv=%i step=%i motor=%i\n", |
| 1458 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1458 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1459 | 1459 | thmfc1->drive, seek, motor )); |
| 1460 | 1460 | |
| 1461 | 1461 | if ( seek ) |
| r8453 | r8454 | |
| 1486 | 1486 | { |
| 1487 | 1487 | /* TODO: implement other forms of raw track writing */ |
| 1488 | 1488 | LOG (( "%f $%04x thmfc_floppy_w: ignored raw WDATA $%02X\n", |
| 1489 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1489 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1490 | 1490 | } |
| 1491 | 1491 | break; |
| 1492 | 1492 | |
| r8453 | r8454 | |
| 1494 | 1494 | case 4: /* WCLK (unemulated) */ |
| 1495 | 1495 | /* clock configuration: FF for data, 0A for synchro */ |
| 1496 | 1496 | LOG (( "%f $%04x thmfc_floppy_w: WCLK=$%02X (%s)\n", |
| 1497 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1497 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1498 | 1498 | (data == 0xff) ? "data" : (data == 0x0A) ? "synchro" : "?" )); |
| 1499 | 1499 | break; |
| 1500 | 1500 | |
| 1501 | 1501 | case 5: /* WSECT */ |
| 1502 | 1502 | thmfc1->sector = data; |
| 1503 | 1503 | LOG (( "%f $%04x thmfc_floppy_w: WSECT=%i\n", |
| 1504 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1504 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1505 | 1505 | break; |
| 1506 | 1506 | |
| 1507 | 1507 | case 6: /* WTRCK */ |
| 1508 | 1508 | thmfc1->track = data; |
| 1509 | 1509 | LOG (( "%f $%04x thmfc_floppy_w: WTRCK=%i (real=%i)\n", |
| 1510 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1510 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1511 | 1511 | floppy_drive_get_current_track( thmfc_floppy_image(space->machine) ) )); |
| 1512 | 1512 | break; |
| 1513 | 1513 | |
| 1514 | 1514 | case 7: /* WCELL */ |
| 1515 | 1515 | /* precompensation (unemulated) */ |
| 1516 | 1516 | LOG (( "%f $%04x thmfc_floppy_w: WCELL=$%02X\n", |
| 1517 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1517 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1518 | 1518 | break; |
| 1519 | 1519 | |
| 1520 | 1520 | default: |
| 1521 | 1521 | logerror ( "%f $%04x thmfc_floppy_w: invalid write offset %i (data=$%02X)\n", |
| 1522 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1522 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1523 | 1523 | } |
| 1524 | 1524 | } |
| 1525 | 1525 | |
| r8453 | r8454 | |
| 1605 | 1605 | static TIMER_CALLBACK( ans4 ) |
| 1606 | 1606 | { |
| 1607 | 1607 | LOG(( "%f ans4\n", attotime_to_double(timer_get_time(machine)) )); |
| 1608 | mc6854_set_cts( | |
| 1608 | mc6854_set_cts( m | |
| 1609 | 1609 | } |
| 1610 | 1610 | |
| 1611 | 1611 | static TIMER_CALLBACK( ans3 ) |
| 1612 | 1612 | { |
| 1613 | 1613 | LOG(( "%f ans3\n", attotime_to_double(timer_get_time(machine)) )); |
| 1614 | mc6854_set_cts( | |
| 1614 | mc6854_set_cts( m | |
| 1615 | 1615 | timer_set( machine, ATTOTIME_IN_USEC( 100 ), NULL, 0, ans4 ); |
| 1616 | 1616 | } |
| 1617 | 1617 | |
| 1618 | 1618 | static TIMER_CALLBACK( ans2 ) |
| 1619 | 1619 | { |
| 1620 | 1620 | LOG(( "%f ans2\n", attotime_to_double(timer_get_time(machine)) )); |
| 1621 | mc6854_set_cts( | |
| 1621 | mc6854_set_cts( m | |
| 1622 | 1622 | timer_set( machine, ATTOTIME_IN_USEC( 100 ), NULL, 0, ans3 ); |
| 1623 | 1623 | } |
| 1624 | 1624 | |
| 1625 | 1625 | static TIMER_CALLBACK( ans ) |
| 1626 | 1626 | { |
| 1627 | 1627 | LOG(( "%f ans\n", attotime_to_double(timer_get_time(machine)) )); |
| 1628 | mc6854_set_cts( | |
| 1628 | mc6854_set_cts( m | |
| 1629 | 1629 | timer_set( machine, ATTOTIME_IN_USEC( 100 ), NULL, 0, ans2 ); |
| 1630 | 1630 | } |
| 1631 | 1631 | /* consigne DKBOOT |
| r8453 | r8454 | |
| 1705 | 1705 | static void to7_network_reset( running_machine *machine ) |
| 1706 | 1706 | { |
| 1707 | 1707 | LOG(( "to7_network_reset: NR 07-005 network extension\n" )); |
| 1708 | mc6854_set_cts( devtag_get_device(machine, "mc6854"), 0 ); | |
| 1709 | mc6854_set_cts( devtag_get_device(machine, "mc6854"), 1 ); | |
| 1708 | mc6854_set_cts( machine->device("mc6854"), 0 ); | |
| 1709 | mc6854_set_cts( machine->device("mc6854"), 1 ); | |
| 1710 | 1710 | } |
| 1711 | 1711 | |
| 1712 | 1712 | |
| r8453 | r8454 | |
| 1714 | 1714 | static READ8_HANDLER ( to7_network_r ) |
| 1715 | 1715 | { |
| 1716 | 1716 | if ( offset >= 0 && offset < 4 ) |
| 1717 | return mc6854_r( | |
| 1717 | return mc6854_r( | |
| 1718 | 1718 | |
| 1719 | 1719 | if ( offset == 8 ) |
| 1720 | 1720 | { |
| 1721 | 1721 | /* network ID of the computer */ |
| 1722 | 1722 | UINT8 id = input_port_read(space->machine, "fconfig") >> 3; |
| 1723 | VLOG(( "%f $%04x to7_network_r: read id $%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1723 | VLOG(( "%f $%04x to7_network_r: read id $%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1724 | 1724 | return id; |
| 1725 | 1725 | } |
| 1726 | 1726 | |
| 1727 | logerror( "%f $%04x to7_network_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1727 | logerror( "%f $%04x to7_network_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1728 | 1728 | return 0; |
| 1729 | 1729 | } |
| 1730 | 1730 | |
| r8453 | r8454 | |
| 1733 | 1733 | static WRITE8_HANDLER ( to7_network_w ) |
| 1734 | 1734 | { |
| 1735 | 1735 | if ( offset >= 0 && offset < 4 ) |
| 1736 | mc6854_w( | |
| 1736 | mc6854_w( | |
| 1737 | 1737 | else |
| 1738 | 1738 | { |
| 1739 | 1739 | logerror( "%f $%04x to7_network_w: invalid write offset %i (data=$%02X)\n", |
| 1740 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1740 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( | |
| 1741 | 1741 | } |
| 1742 | 1742 | } |
| 1743 | 1743 |
| r8453 | r8454 | |
|---|---|---|
| 709 | 709 | if (ident->type == IO_UNKNOWN) |
| 710 | 710 | { |
| 711 | 711 | /* no device_type was specified; use the new preferred mechanism */ |
| 712 | device = dynamic_cast<device_image_interface *>( | |
| 712 | device = dynamic_cast<device_image_interface *>(m | |
| 713 | 713 | } |
| 714 | 714 | |
| 715 | 715 | /* did the image slot lookup fail? */ |
| r8453 | r8454 | |
|---|---|---|
| 146 | 146 | |
| 147 | 147 | WRITE8_HANDLER( soundblaster_w ) |
| 148 | 148 | { |
| 149 | running_device *dac_device = | |
| 149 | running_device *dac_device = | |
| 150 | 150 | |
| 151 | 151 | switch (offset) { |
| 152 | 152 | case 6: |
| r8453 | r8454 | |
|---|---|---|
| 137 | 137 | mac_sound *token = get_token(device); |
| 138 | 138 | |
| 139 | 139 | if (buffer) |
| 140 | token->mac_snd_buf_ptr = (UINT16 *) (messram_get_ptr(dev | |
| 140 | token->mac_snd_buf_ptr = (UINT16 *) (messram_get_ptr(dev | |
| 141 | 141 | else |
| 142 | token->mac_snd_buf_ptr = (UINT16 *) (messram_get_ptr(dev | |
| 142 | token->mac_snd_buf_ptr = (UINT16 *) (messram_get_ptr(dev | |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 |
| r8453 | r8454 | |
|---|---|---|
| 30 | 30 | |
| 31 | 31 | int gmaster_io_callback(running_device *device, int ioline, int state) |
| 32 | 32 | { /* comes across with cpu device - need to use sound device */ |
| 33 | gmaster_sound *token = get_token(dev | |
| 33 | gmaster_sound *token = get_token(dev | |
| 34 | 34 | |
| 35 | 35 | switch (ioline) |
| 36 | 36 | { |
| r8453 | r8454 | |
|---|---|---|
| 471 | 471 | /* enter stop mode */ |
| 472 | 472 | timer_reset( mea8000->timer, attotime_never ); |
| 473 | 473 | mea8000->state = MEA8000_STOPPED; |
| 474 | dac_signed_data_16_w( | |
| 474 | dac_signed_data_16_w(m | |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | |
| r8453 | r8454 | |
| 488 | 488 | /* sample is really computed only every 8-th time */ |
| 489 | 489 | mea8000->lastsample = mea8000->sample; |
| 490 | 490 | mea8000->sample = mea8000_compute_sample(mea8000); |
| 491 | dac_signed_data_16_w( | |
| 491 | dac_signed_data_16_w(m | |
| 492 | 492 | } |
| 493 | 493 | else |
| 494 | 494 | { |
| r8453 | r8454 | |
| 496 | 496 | int sample = |
| 497 | 497 | mea8000->lastsample + |
| 498 | 498 | ((pos*(mea8000->sample-mea8000->lastsample)) / SUPERSAMPLING); |
| 499 | dac_signed_data_16_w( | |
| 499 | dac_signed_data_16_w(m | |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | mea8000->framepos++; |
| r8453 | r8454 | |
|---|---|---|
| 239 | 239 | vp550_t *vp550 = get_safe_token(device); |
| 240 | 240 | |
| 241 | 241 | /* look up devices */ |
| 242 | vp550->cdp1863[CHANNEL_A] = devtag_get_device(device->machine, "vp550:u1"); | |
| 243 | vp550->cdp1863[CHANNEL_B] = devtag_get_device(device->machine, "vp550:u2"); | |
| 242 | vp550->cdp1863[CHANNEL_A] = device->machine->device("vp550:u1"); | |
| 243 | vp550->cdp1863[CHANNEL_B] = device->machine->device("vp550:u2"); | |
| 244 | 244 | vp550->sync_timer = device->machine->device<timer_device>("vp550:sync"); |
| 245 | 245 | |
| 246 | 246 | /* set initial values */ |
| r8453 | r8454 | |
|---|---|---|
| 310 | 310 | // |
| 311 | 311 | // Map block, $00-$BF are ram, $FC-$FF are Boot ROM |
| 312 | 312 | // |
| 313 | if ((MapPage*4) < ((messram_get_size( | |
| 313 | if ((MapPage*4) < ((messram_get_size(m | |
| 314 | 314 | { |
| 315 | 315 | if (!is_last_page(Page)) |
| 316 | 316 | { |
| 317 | readbank = &messram_get_ptr( | |
| 317 | readbank = &messram_get_ptr(m | |
| 318 | 318 | if(LogDatWrites) |
| 319 | 319 | debug_console_printf(machine, "Mapping page %X, pageno=%X, mess_ram)[%X]\n",Page,MapPage,(MapPage*RamPageSize)); |
| 320 | 320 | } |
| 321 | 321 | else |
| 322 | 322 | { |
| 323 | readbank = &messram_get_ptr( | |
| 323 | readbank = &messram_get_ptr(m | |
| 324 | 324 | logerror("Error RAM in Last page !\n"); |
| 325 | 325 | } |
| 326 | 326 | writebank=bank_info[Page].handler; |
| r8453 | r8454 | |
| 387 | 387 | |
| 388 | 388 | /* Map video ram to base of area it can use, that way we can take the literal RA */ |
| 389 | 389 | /* from the 6845 without having to mask it ! */ |
| 390 | machine->generic.videoram.u8=&messram_get_ptr( | |
| 390 | machine->generic.videoram.u8=&messram_get_ptr(m | |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | // Return the value of a page register |
| r8453 | r8454 | |
| 706 | 706 | static WRITE8_DEVICE_HANDLER(d_pia1_pa_w) |
| 707 | 707 | { |
| 708 | 708 | int HALT_DMA; |
| 709 | running_device *fdc = dev | |
| 709 | running_device *fdc = dev | |
| 710 | 710 | |
| 711 | 711 | /* Only play with halt line if halt bit changed since last write */ |
| 712 | 712 | if((data & 0x80) != d_pia1_pa_last) |
| r8453 | r8454 | |
| 722 | 722 | |
| 723 | 723 | /* CPU un-halted let it run ! */ |
| 724 | 724 | if (HALT_DMA == CLEAR_LINE) |
| 725 | cpu_yield(dev | |
| 725 | cpu_yield(dev | |
| 726 | 726 | |
| 727 | 727 | d_pia1_pa_last = data & 0x80; |
| 728 | 728 | } |
| r8453 | r8454 | |
| 760 | 760 | |
| 761 | 761 | /* CPU un-halted let it run ! */ |
| 762 | 762 | if (HALT_CPU == CLEAR_LINE) |
| 763 | cpu_yield(dev | |
| 763 | cpu_yield(dev | |
| 764 | 764 | } |
| 765 | 765 | } |
| 766 | 766 | |
| r8453 | r8454 | |
| 807 | 807 | { |
| 808 | 808 | cputag_set_input_line(device->machine, DMACPU_TAG, INPUT_LINE_NMI, ASSERT_LINE); |
| 809 | 809 | logerror("cpu_yield()\n"); |
| 810 | cpu_yield(dev | |
| 810 | cpu_yield(dev | |
| 811 | 811 | } |
| 812 | 812 | else |
| 813 | 813 | { |
| r8453 | r8454 | |
| 878 | 878 | /* CPU 0 */ |
| 879 | 879 | static void cpu0_recalc_irq(running_machine *machine, int state) |
| 880 | 880 | { |
| 881 | running_device *pia_0 = devtag_get_device( machine, PIA_0_TAG ); | |
| 882 | running_device *pia_1 = devtag_get_device( machine, PIA_1_TAG ); | |
| 883 | running_device *pia_2 = devtag_get_device( machine, PIA_2_TAG ); | |
| 881 | running_device *pia_0 = machine->device( PIA_0_TAG ); | |
| 882 | running_device *pia_1 = machine->device( PIA_1_TAG ); | |
| 883 | running_device *pia_2 = machine->device( PIA_2_TAG ); | |
| 884 | 884 | UINT8 pia0_irq_a = pia6821_get_irq_a(pia_0); |
| 885 | 885 | UINT8 pia1_irq_a = pia6821_get_irq_a(pia_1); |
| 886 | 886 | UINT8 pia1_irq_b = pia6821_get_irq_b(pia_1); |
| r8453 | r8454 | |
| 899 | 899 | |
| 900 | 900 | static void cpu0_recalc_firq(running_machine *machine, int state) |
| 901 | 901 | { |
| 902 | running_device *pia_0 = | |
| 902 | running_device *pia_0 = m | |
| 903 | 903 | UINT8 pia0_irq_b = pia6821_get_irq_b(pia_0); |
| 904 | 904 | UINT8 FIRQ; |
| 905 | 905 | |
| r8453 | r8454 | |
| 951 | 951 | READ8_HANDLER(dgnbeta_wd2797_r) |
| 952 | 952 | { |
| 953 | 953 | int result = 0; |
| 954 | running_device *fdc = | |
| 954 | running_device *fdc = | |
| 955 | 955 | |
| 956 | 956 | switch(offset & 0x03) |
| 957 | 957 | { |
| r8453 | r8454 | |
| 977 | 977 | |
| 978 | 978 | WRITE8_HANDLER(dgnbeta_wd2797_w) |
| 979 | 979 | { |
| 980 | running_device *fdc = | |
| 980 | running_device *fdc = | |
| 981 | 981 | |
| 982 | 982 | wd2797_written=1; |
| 983 | 983 | |
| r8453 | r8454 | |
| 1039 | 1039 | /* VBlank inturrupt */ |
| 1040 | 1040 | void dgn_beta_frame_interrupt (running_machine *machine, int data) |
| 1041 | 1041 | { |
| 1042 | running_device *pia_2 = | |
| 1042 | running_device *pia_2 = m | |
| 1043 | 1043 | |
| 1044 | 1044 | /* Set PIA line, so it recognises inturrupt */ |
| 1045 | 1045 | if (!data) |
| r8453 | r8454 | |
| 1070 | 1070 | /********************************* Machine/Driver Initialization ****************************************/ |
| 1071 | 1071 | static void dgnbeta_reset(running_machine &machine) |
| 1072 | 1072 | { |
| 1073 | running_device *fdc = devtag_get_device(&machine, FDC_TAG); | |
| 1074 | running_device *pia_0 = devtag_get_device( &machine, PIA_0_TAG ); | |
| 1075 | running_device *pia_1 = devtag_get_device( &machine, PIA_1_TAG ); | |
| 1076 | running_device *pia_2 = devtag_get_device( &machine, PIA_2_TAG ); | |
| 1073 | running_device *fdc = machine.device(FDC_TAG); | |
| 1074 | running_device *pia_0 = machine.device( PIA_0_TAG ); | |
| 1075 | running_device *pia_1 = machine.device( PIA_1_TAG ); | |
| 1076 | running_device *pia_2 = machine.device( PIA_2_TAG ); | |
| 1077 | 1077 | |
| 1078 | 1078 | logerror("MACHINE_RESET( dgnbeta )\n"); |
| 1079 | 1079 | |
| r8453 | r8454 | |
| 1112 | 1112 | wd17xx_dden_w(fdc, CLEAR_LINE); |
| 1113 | 1113 | wd17xx_set_drive(fdc, 0); |
| 1114 | 1114 | |
| 1115 | machine.generic.videoram.u8 = messram_get_ptr( | |
| 1115 | machine.generic.videoram.u8 = messram_get_ptr(m | |
| 1116 | 1116 | |
| 1117 | 1117 | dgnbeta_video_reset(&machine); |
| 1118 | 1118 | wd17xx_reset(fdc); |
| r8453 | r8454 | |
|---|---|---|
| 553 | 553 | tape_reader.rcl = 0; |
| 554 | 554 | if (tape_reader.rcp) |
| 555 | 555 | { |
| 556 | cpu_set_reg(devtag_get_device(machine, "maincpu"), PDP1_IO, tape_reader.rb); /* transfer reader buffer to IO */ | |
| 557 | pdp1_pulse_iot_done(devtag_get_device(machine, "maincpu")); | |
| 556 | cpu_set_reg(machine->device("maincpu"), PDP1_IO, tape_reader.rb); /* transfer reader buffer to IO */ | |
| 557 | pdp1_pulse_iot_done(machine->device("maincpu")); | |
| 558 | 558 | } |
| 559 | 559 | else |
| 560 | 560 | io_status |= io_st_ptr; |
| r8453 | r8454 | |
| 579 | 579 | io_status |= io_st_ptp; |
| 580 | 580 | if (nac) |
| 581 | 581 | { |
| 582 | pdp1_pulse_iot_done( | |
| 582 | pdp1_pulse_iot_done(m | |
| 583 | 583 | } |
| 584 | 584 | } |
| 585 | 585 | |
| r8453 | r8454 | |
| 876 | 876 | io_status |= io_st_tyo; |
| 877 | 877 | if (nac) |
| 878 | 878 | { |
| 879 | pdp1_pulse_iot_done( | |
| 879 | pdp1_pulse_iot_done(m | |
| 880 | 880 | } |
| 881 | 881 | } |
| 882 | 882 | |
| r8453 | r8454 | |
| 992 | 992 | */ |
| 993 | 993 | static TIMER_CALLBACK(dpy_callback) |
| 994 | 994 | { |
| 995 | pdp1_pulse_iot_done( | |
| 995 | pdp1_pulse_iot_done(m | |
| 996 | 996 | } |
| 997 | 997 | |
| 998 | 998 | |
| r8453 | r8454 | |
| 1018 | 1018 | { |
| 1019 | 1019 | io_status |= io_st_pen; |
| 1020 | 1020 | |
| 1021 | cpu_set_reg(dev | |
| 1021 | cpu_set_reg(dev | |
| 1022 | 1022 | } |
| 1023 | 1023 | |
| 1024 | 1024 | if (nac) |
| r8453 | r8454 | |
| 1172 | 1172 | if (parallel_drum.wc) |
| 1173 | 1173 | delay = attotime_add(delay, PARALLEL_DRUM_WORD_TIME); |
| 1174 | 1174 | } while (parallel_drum.wc); |
| 1175 | cpu_adjust_icount(dev | |
| 1175 | cpu_adjust_icount(dev | |
| 1176 | 1176 | /* if no error, skip */ |
| 1177 | cpu_set_reg(dev | |
| 1177 | cpu_set_reg(dev | |
| 1178 | 1178 | } |
| 1179 | 1179 | |
| 1180 | 1180 | static void iot_dra(running_device *device, int op2, int nac, int mb, int *io, int ac) |
| r8453 | r8454 | |
| 1303 | 1303 | #if USE_SBS |
| 1304 | 1304 | cputag_set_input_line_and_vector(machine, "maincpu", 0, ASSERT_LINE, 0); /* interrupt it, baby */ |
| 1305 | 1305 | #endif |
| 1306 | cpu_set_reg( | |
| 1306 | cpu_set_reg(m | |
| 1307 | 1307 | pdp1_typewriter_drawchar(machine, typewriter.tb); /* we want to echo input */ |
| 1308 | 1308 | break; |
| 1309 | 1309 | } |
| r8453 | r8454 | |
| 1454 | 1454 | pdp1_pulse_start_clear(device); /* pulse Start Clear line */ |
| 1455 | 1455 | cpu_set_reg(device, PDP1_PC, ( cpu_get_reg(device, PDP1_TA) & 0170000) |
| 1456 | 1456 | | (cpu_get_reg(device, PDP1_PC) & 0007777)); /* transfer ETA to EPC */ |
| 1457 | /*cpu_set_reg( | |
| 1457 | /*cpu_set_reg(m | |
| 1458 | 1458 | cpu_set_reg(device, PDP1_EXD, cpu_get_reg(device, PDP1_EXTEND_SW)); |
| 1459 | 1459 | cpu_set_reg(device, PDP1_OV, (UINT64)0); /* right??? */ |
| 1460 | 1460 | cpu_set_reg(device, PDP1_RUN, (UINT64)0); |
| r8453 | r8454 | |
|---|---|---|
| 793 | 793 | |
| 794 | 794 | #ifdef MESS |
| 795 | 795 | /* TODO: get rid of this ifdef MESS section */ |
| 796 | our_this->cdrom = mess_cd_get_cdrom_file( | |
| 796 | our_this->cdrom = mess_cd_get_cdrom_file( m | |
| 797 | 797 | #else |
| 798 | 798 | our_this->cdrom = cdrom_open(get_disk_handle( diskregion )); |
| 799 | 799 |
| r8453 | r8454 | |
|---|---|---|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /* install RAM */ |
| 40 | ram_top = MIN(messram_get_size( | |
| 40 | ram_top = MIN(messram_get_size(m | |
| 41 | 41 | memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), |
| 42 | 42 | 0x0000, ram_top, 0, 0, SMH_BANK(2)); |
| 43 | 43 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), |
| 44 | 44 | 0x0000, ram_top, 0, 0, SMH_BANK(2)); |
| 45 | memory_set_bankptr(machine, 2, messram_get_ptr( | |
| 45 | memory_set_bankptr(machine, 2, messram_get_ptr(m | |
| 46 | 46 | } |
| 47 | 47 | #endif |
| 48 | 48 | |
| r8453 | r8454 | |
| 68 | 68 | } |
| 69 | 69 | else |
| 70 | 70 | { |
| 71 | read_addr = &messram_get_ptr(devtag_get_device(machine, "messram"))[0x08000]; | |
| 72 | write_addr = &messram_get_ptr(devtag_get_device(machine, "messram"))[0x08000]; | |
| 71 | read_addr = &messram_get_ptr(machine->device("messram"))[0x08000]; | |
| 72 | write_addr = &messram_get_ptr(machine->device("messram"))[0x08000]; | |
| 73 | 73 | } |
| 74 | 74 | break; |
| 75 | 75 | } |
| r8453 | r8454 | |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /* install RAM */ |
| 122 | ram_top = MIN(messram_get_size( | |
| 122 | ram_top = MIN(messram_get_size(m | |
| 123 | 123 | memory_install_readwrite_bank(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM),0x0000, ram_top, 0, 0, "bank2"); |
| 124 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 124 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 125 | 125 | |
| 126 | 126 | /* cartridge */ |
| 127 | 127 | if (has_cart) |
| r8453 | r8454 | |
|---|---|---|
| 371 | 371 | *tailptr = auto_alloc(device->machine, cbm_iec_daisy_state); |
| 372 | 372 | |
| 373 | 373 | (*tailptr)->next = NULL; |
| 374 | (*tailptr)->device = dev | |
| 374 | (*tailptr)->device = dev | |
| 375 | 375 | |
| 376 | 376 | if ((*tailptr)->device == NULL) |
| 377 | 377 | { |
| r8453 | r8454 | |
|---|---|---|
| 194 | 194 | /* end of send event */ |
| 195 | 195 | static TIMER_CALLBACK( hp48_rs232_byte_sent_cb ) |
| 196 | 196 | { |
| 197 | device_image_interface *xmodem = dynamic_cast<device_image_interface *>(devtag_get_device(machine, "rs232_x")); | |
| 198 | device_image_interface *kermit = dynamic_cast<device_image_interface *>(devtag_get_device(machine, "rs232_k")); | |
| 197 | device_image_interface *xmodem = dynamic_cast<device_image_interface *>(machine->device("rs232_x")); | |
| 198 | device_image_interface *kermit = dynamic_cast<device_image_interface *>(machine->device("rs232_k")); | |
| 199 | 199 | |
| 200 | 200 | LOG_SERIAL(( "%f hp48_rs232_byte_sent_cb: end of send, data=%02x\n", |
| 201 | 201 | attotime_to_double(timer_get_time(machine)), param )); |
| r8453 | r8454 | |
| 222 | 222 | UINT8 data = HP48_IO_8(0x16); /* byte to send */ |
| 223 | 223 | |
| 224 | 224 | LOG_SERIAL(( "%05x %f hp48_rs232_send_byte: start sending, data=%02x\n", |
| 225 | cpu_get_previouspc( | |
| 225 | cpu_get_previouspc(m | |
| 226 | 226 | |
| 227 | 227 | /* set byte sending and send buffer full */ |
| 228 | 228 | hp48_io[0x12] |= 3; |
| r8453 | r8454 | |
| 296 | 296 | void hp48_reg_out( running_device *device, int out ) |
| 297 | 297 | { |
| 298 | 298 | LOG(( "%05x %f hp48_reg_out: %03x\n", |
| 299 | cpu_get_previouspc(dev | |
| 299 | cpu_get_previouspc(dev | |
| 300 | 300 | |
| 301 | 301 | /* bits 0-8: keyboard lines */ |
| 302 | 302 | hp48_out = out & 0x1ff; |
| r8453 | r8454 | |
| 304 | 304 | /* bits 9-10: unused */ |
| 305 | 305 | |
| 306 | 306 | /* bit 11: beeper */ |
| 307 | dac_data_w( dev | |
| 307 | dac_data_w( dev | |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | static int hp48_get_in( running_machine *machine ) |
| r8453 | r8454 | |
| 333 | 333 | { |
| 334 | 334 | int in = hp48_get_in( device->machine ); |
| 335 | 335 | LOG(( "%05x %f hp48_reg_in: %04x\n", |
| 336 | cpu_get_previouspc(dev | |
| 336 | cpu_get_previouspc(dev | |
| 337 | 337 | return in; |
| 338 | 338 | } |
| 339 | 339 | |
| r8453 | r8454 | |
| 375 | 375 | /* RSI opcode */ |
| 376 | 376 | void hp48_rsi( running_device *device ) |
| 377 | 377 | { |
| 378 | LOG(( "%05x %f hp48_rsi\n", cpu_get_previouspc(dev | |
| 378 | LOG(( "%05x %f hp48_rsi\n", cpu_get_previouspc(dev | |
| 379 | 379 | |
| 380 | 380 | /* enables interrupts on key repeat |
| 381 | 381 | (normally, there is only one interrupt, when the key is pressed) |
| r8453 | r8454 | |
| 594 | 594 | { |
| 595 | 595 | /* second nibble of received data */ |
| 596 | 596 | |
| 597 | device_image_interface *xmodem = dynamic_cast<device_image_interface *>(devtag_get_device(space->machine, "rs232_x")); | |
| 598 | device_image_interface *kermit = dynamic_cast<device_image_interface *>(devtag_get_device(space->machine, "rs232_k")); | |
| 597 | device_image_interface *xmodem = dynamic_cast<device_image_interface *>(space->machine->device("rs232_x")); | |
| 598 | device_image_interface *kermit = dynamic_cast<device_image_interface *>(space->machine->device("rs232_k")); | |
| 599 | 599 | |
| 600 | 600 | hp48_io[0x11] &= ~1; /* clear byte received */ |
| 601 | 601 | data = hp48_io[offset]; |
| r8453 | r8454 | |
| 870 | 870 | /* RESET opcode */ |
| 871 | 871 | void hp48_mem_reset( running_device *device ) |
| 872 | 872 | { |
| 873 | LOG(( "%05x %f hp48_mem_reset\n", cpu_get_previouspc(dev | |
| 873 | LOG(( "%05x %f hp48_mem_reset\n", cpu_get_previouspc(dev | |
| 874 | 874 | hp48_reset_modules( device->machine ); |
| 875 | 875 | } |
| 876 | 876 | |
| r8453 | r8454 | |
| 880 | 880 | { |
| 881 | 881 | int i; |
| 882 | 882 | |
| 883 | LOG(( "%05x %f hp48_mem_config: %05x\n", cpu_get_previouspc(dev | |
| 883 | LOG(( "%05x %f hp48_mem_config: %05x\n", cpu_get_previouspc(dev | |
| 884 | 884 | |
| 885 | 885 | /* find the highest priority unconfigured module (except non-configurable NCE1)... */ |
| 886 | 886 | for ( i = 0; i < 5; i++ ) |
| r8453 | r8454 | |
| 911 | 911 | void hp48_mem_unconfig( running_device *device, int v ) |
| 912 | 912 | { |
| 913 | 913 | int i; |
| 914 | LOG(( "%05x %f hp48_mem_unconfig: %05x\n", cpu_get_previouspc(dev | |
| 914 | LOG(( "%05x %f hp48_mem_unconfig: %05x\n", cpu_get_previouspc(dev | |
| 915 | 915 | |
| 916 | 916 | /* find the highest priority fully configured module at address v (except NCE1)... */ |
| 917 | 917 | for ( i = 0; i < 5; i++ ) |
| r8453 | r8454 | |
| 954 | 954 | } |
| 955 | 955 | |
| 956 | 956 | LOG(( "%05x %f hp48_mem_id = %02x\n", |
| 957 | cpu_get_previouspc(dev | |
| 957 | cpu_get_previouspc(dev | |
| 958 | 958 | |
| 959 | 959 | return data; /* everything is configured */ |
| 960 | 960 | } |
| r8453 | r8454 | |
|---|---|---|
| 64 | 64 | assert((slotnum >= 0) && (slotnum <= 7)); |
| 65 | 65 | snprintf(buffer, ARRAY_LENGTH(buffer), "slot_%d", slotnum); |
| 66 | 66 | |
| 67 | return | |
| 67 | return m | |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | |
| r8453 | r8454 | |
| 82 | 82 | if (config->tag != NULL) |
| 83 | 83 | { |
| 84 | 84 | /* locate the device */ |
| 85 | token->slot_device = dev | |
| 85 | token->slot_device = dev | |
| 86 | 86 | |
| 87 | 87 | assert(token->slot_device != NULL); |
| 88 | 88 | } |
| r8453 | r8454 | |
|---|---|---|
| 144 | 144 | |
| 145 | 145 | WRITE8_DEVICE_HANDLER(mockingboard_w) |
| 146 | 146 | { |
| 147 | running_device *ay8910_1 = devtag_get_device(device->machine, "ay8910.1"); | |
| 148 | running_device *ay8910_2 = devtag_get_device(device->machine, "ay8910.2"); | |
| 147 | running_device *ay8910_1 = device->machine->device("ay8910.1"); | |
| 148 | running_device *ay8910_2 = device->machine->device("ay8910.2"); | |
| 149 | 149 | mockingboard_token *token = get_token(device); |
| 150 | 150 | |
| 151 | 151 | if (LOG_MOCKINGBOARD) |
| r8453 | r8454 | |
|---|---|---|
| 118 | 118 | |
| 119 | 119 | static READ8_HANDLER( apple3_c0xx_r ) |
| 120 | 120 | { |
| 121 | running_device *acia = devtag_get_device(space->machine, "acia"); | |
| 122 | running_device *fdc = devtag_get_device(space->machine, "fdc"); | |
| 121 | running_device *acia = space->machine->device("acia"); | |
| 122 | running_device *fdc = space->machine->device("fdc"); | |
| 123 | 123 | UINT8 result = 0xFF; |
| 124 | 124 | |
| 125 | 125 | switch(offset) |
| r8453 | r8454 | |
| 174 | 174 | apple3_flags |= VAR_EXTA0 << ((offset - 0xD0) / 2); |
| 175 | 175 | else |
| 176 | 176 | apple3_flags &= ~(VAR_EXTA0 << ((offset - 0xD0) / 2)); |
| 177 | apple3_update_drives( | |
| 177 | apple3_update_drives( | |
| 178 | 178 | result = 0x00; |
| 179 | 179 | break; |
| 180 | 180 | |
| r8453 | r8454 | |
| 203 | 203 | |
| 204 | 204 | static WRITE8_HANDLER( apple3_c0xx_w ) |
| 205 | 205 | { |
| 206 | running_device *acia = devtag_get_device(space->machine, "acia"); | |
| 207 | running_device *fdc = devtag_get_device(space->machine, "fdc"); | |
| 206 | running_device *acia = space->machine->device("acia"); | |
| 207 | running_device *fdc = space->machine->device("fdc"); | |
| 208 | 208 | switch(offset) |
| 209 | 209 | { |
| 210 | 210 | case 0x10: case 0x11: case 0x12: case 0x13: |
| r8453 | r8454 | |
| 238 | 238 | apple3_flags |= VAR_EXTA0 << ((offset - 0xD0) / 2); |
| 239 | 239 | else |
| 240 | 240 | apple3_flags &= ~(VAR_EXTA0 << ((offset - 0xD0) / 2)); |
| 241 | apple3_update_drives( | |
| 241 | apple3_update_drives( | |
| 242 | 242 | break; |
| 243 | 243 | |
| 244 | 244 | case 0xDB: |
| r8453 | r8454 | |
| 263 | 263 | |
| 264 | 264 | INTERRUPT_GEN( apple3_interrupt ) |
| 265 | 265 | { |
| 266 | running_device *via_1 = dev | |
| 266 | running_device *via_1 = dev | |
| 267 | 267 | |
| 268 | 268 | via_ca2_w(via_1, (AY3600_keydata_strobe_r() & 0x80) ? 1 : 0); |
| 269 | 269 | via_cb1_w(via_1, device->machine->primary_screen->vblank()); |
| r8453 | r8454 | |
| 276 | 276 | { |
| 277 | 277 | if (bank != (UINT16) ~0) |
| 278 | 278 | { |
| 279 | bank %= messram_get_size(devtag_get_device(machine, "messram")) / 0x8000; | |
| 280 | if ((bank + 1) == (messram_get_size(devtag_get_device(machine, "messram")) / 0x8000)) | |
| 279 | bank %= messram_get_size(machine->device("messram")) / 0x8000; | |
| 280 | if ((bank + 1) == (messram_get_size(machine->device("messram")) / 0x8000)) | |
| 281 | 281 | bank = 0x02; |
| 282 | 282 | } |
| 283 | 283 | offset += ((offs_t) bank) * 0x8000; |
| 284 | offset %= messram_get_size(devtag_get_device(machine, "messram")); | |
| 285 | return &messram_get_ptr(devtag_get_device(machine, "messram"))[offset]; | |
| 284 | offset %= messram_get_size(machine->device("messram")); | |
| 285 | return &messram_get_ptr(machine->device("messram"))[offset]; | |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | |
| r8453 | r8454 | |
| 297 | 297 | if (LOG_MEMORY) |
| 298 | 298 | { |
| 299 | 299 | #ifdef PTR64 |
| 300 | //logerror("\tbank %s --> %02x/%04x [0x%08lx]\n", mame_bank, (unsigned) bank, (unsigned)offset, ptr - messram_get_ptr( | |
| 300 | //logerror("\tbank %s --> %02x/%04x [0x%08lx]\n", mame_bank, (unsigned) bank, (unsigned)offset, ptr - messram_get_ptr(m | |
| 301 | 301 | #else |
| 302 | logerror("\tbank %s --> %02x/%04x [0x%08x]\n", mame_bank, (unsigned) bank, (unsigned)offset, ptr - messram_get_ptr( | |
| 302 | logerror("\tbank %s --> %02x/%04x [0x%08x]\n", mame_bank, (unsigned) bank, (unsigned)offset, ptr - messram_get_ptr(m | |
| 303 | 303 | #endif |
| 304 | 304 | } |
| 305 | 305 | } |
| r8453 | r8454 | |
| 457 | 457 | |
| 458 | 458 | /* reinstall VIA handlers */ |
| 459 | 459 | { |
| 460 | running_device *via_0 = devtag_get_device(space->machine, "via6522_0"); | |
| 461 | running_device *via_1 = devtag_get_device(space->machine, "via6522_1"); | |
| 460 | running_device *via_0 = space->machine->device("via6522_0"); | |
| 461 | running_device *via_1 = space->machine->device("via6522_1"); | |
| 462 | 462 | memory_install_read8_device_handler(space, via_0, 0xFFD0, 0xFFDF, 0, 0, via_r); |
| 463 | 463 | memory_install_write8_device_handler(space, via_0, 0xFFD0, 0xFFDF, 0, 0, via_w); |
| 464 | 464 | memory_install_read8_device_handler(space, via_1, 0xFFE0, 0xFFEF, 0, 0, via_r); |
| r8453 | r8454 | |
| 568 | 568 | else if (offset > 0x9FFF) |
| 569 | 569 | result = apple3_bankaddr(machine,~0, offset - 0x8000); |
| 570 | 570 | else |
| 571 | result = &messram_get_ptr( | |
| 571 | result = &messram_get_ptr(m | |
| 572 | 572 | } |
| 573 | 573 | else if ((n >= 0x80) && (n <= 0x8E)) |
| 574 | 574 | { |
| r8453 | r8454 | |
| 715 | 715 | memory_region(machine, "maincpu")[0x0685] = 0x00; |
| 716 | 716 | |
| 717 | 717 | apple3_enable_mask = 0; |
| 718 | apple3_update_drives( | |
| 718 | apple3_update_drives(m | |
| 719 | 719 | |
| 720 | 720 | AY3600_init(machine); |
| 721 | 721 |
| r8453 | r8454 | |
|---|---|---|
| 71 | 71 | |
| 72 | 72 | |
| 73 | 73 | READ32_HANDLER( _3do_nvarea_r ) { |
| 74 | logerror( "%08X: NVRAM read offset = %08X\n", cpu_get_pc( | |
| 74 | logerror( "%08X: NVRAM read offset = %08X\n", cpu_get_pc( | |
| 75 | 75 | return 0; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | WRITE32_HANDLER( _3do_nvarea_w ) { |
| 79 | logerror( "%08X: NVRAM write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc( | |
| 79 | logerror( "%08X: NVRAM write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc( | |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
| r8453 | r8454 | |
| 123 | 123 | several groups of 16 write actions or 16 read actions |
| 124 | 124 | */ |
| 125 | 125 | READ32_HANDLER( _3do_unk_318_r ) { |
| 126 | logerror( "%08X: UNK_318 read offset = %08X\n", cpu_get_pc( | |
| 126 | logerror( "%08X: UNK_318 read offset = %08X\n", cpu_get_pc( | |
| 127 | 127 | #if 0 |
| 128 | 128 | switch( offset ) { |
| 129 | 129 | case 0: /* Boot ROM checks here and expects to read 1, 0, 1, 0 in the lowest bit */ |
| r8453 | r8454 | |
| 136 | 136 | |
| 137 | 137 | WRITE32_HANDLER( _3do_unk_318_w ) |
| 138 | 138 | { |
| 139 | logerror( "%08X: UNK_318 write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc( | |
| 139 | logerror( "%08X: UNK_318 write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc( | |
| 140 | 140 | |
| 141 | 141 | switch( offset ) |
| 142 | 142 | { |
| r8453 | r8454 | |
| 152 | 152 | |
| 153 | 153 | READ32_HANDLER( _3do_svf_r ) |
| 154 | 154 | { |
| 155 | logerror( "%08X: SVF read offset = %08X\n", cpu_get_pc( | |
| 155 | logerror( "%08X: SVF read offset = %08X\n", cpu_get_pc( | |
| 156 | 156 | switch( offset & ( 0xE000 / 4 ) ) |
| 157 | 157 | { |
| 158 | 158 | case 0x0000/4: /* SPORT transfer */ |
| r8453 | r8454 | |
| 169 | 169 | |
| 170 | 170 | WRITE32_HANDLER( _3do_svf_w ) |
| 171 | 171 | { |
| 172 | logerror( "%08X: SVF write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc( | |
| 172 | logerror( "%08X: SVF write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc( | |
| 173 | 173 | switch( offset & ( 0xe000 / 4 ) ) |
| 174 | 174 | { |
| 175 | 175 | case 0x0000/4: /* SPORT transfer */ |
| r8453 | r8454 | |
| 187 | 187 | |
| 188 | 188 | |
| 189 | 189 | READ32_HANDLER( _3do_madam_r ) { |
| 190 | logerror( "%08X: MADAM read offset = %08X\n", cpu_get_pc( | |
| 190 | logerror( "%08X: MADAM read offset = %08X\n", cpu_get_pc( | |
| 191 | 191 | switch( offset ) { |
| 192 | 192 | case 0x0000/4: /* 03300000 - Revision */ |
| 193 | 193 | return madam.revision; |
| r8453 | r8454 | |
| 340 | 340 | |
| 341 | 341 | |
| 342 | 342 | WRITE32_HANDLER( _3do_madam_w ) { |
| 343 | logerror( "%08X: MADAM write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc( | |
| 343 | logerror( "%08X: MADAM write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc( | |
| 344 | 344 | switch( offset ) { |
| 345 | 345 | case 0x0004/4: /* 03300004 - Memory configuration 29 = 2MB DRAM, 1MB VRAM */ |
| 346 | 346 | madam.msysbits = data; |
| r8453 | r8454 | |
| 519 | 519 | |
| 520 | 520 | READ32_HANDLER( _3do_clio_r ) |
| 521 | 521 | { |
| 522 | logerror( "%08X: CLIO read offset = %08X\n", cpu_get_pc( | |
| 522 | logerror( "%08X: CLIO read offset = %08X\n", cpu_get_pc( | |
| 523 | 523 | |
| 524 | 524 | switch( offset ) |
| 525 | 525 | { |
| r8453 | r8454 | |
| 557 | 557 | |
| 558 | 558 | WRITE32_HANDLER( _3do_clio_w ) |
| 559 | 559 | { |
| 560 | logerror( "%08X: CLIO write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc( | |
| 560 | logerror( "%08X: CLIO write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc( | |
| 561 | 561 | |
| 562 | 562 | switch( offset ) |
| 563 | 563 | { |
| r8453 | r8454 | |
|---|---|---|
| 177 | 177 | if (device->owner() != NULL) |
| 178 | 178 | image = device->owner()->subdevice(fdc->intf->floppy_drive_tags[fdc->drive]); |
| 179 | 179 | else |
| 180 | image = dev | |
| 180 | image = dev | |
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | else |
| r8453 | r8454 | |
| 2223 | 2223 | if (device->owner() != NULL) |
| 2224 | 2224 | img = device->owner()->subdevice(fdc->intf->floppy_drive_tags[i]); |
| 2225 | 2225 | else |
| 2226 | img = dev | |
| 2226 | img = dev | |
| 2227 | 2227 | |
| 2228 | 2228 | device_image_interface *image = dynamic_cast<device_image_interface *>( img); |
| 2229 | 2229 | if (image->exists()) |
| r8453 | r8454 | |
| 2353 | 2353 | if (device->owner() != NULL) |
| 2354 | 2354 | img = device->owner()->subdevice(fdc->intf->floppy_drive_tags[i]); |
| 2355 | 2355 | else |
| 2356 | img = dev | |
| 2356 | img = dev | |
| 2357 | 2357 | |
| 2358 | 2358 | floppy_drive_set_controller(img, device); |
| 2359 | 2359 | floppy_drive_set_ready_state_change_callback(img, upd765_set_ready_change_callback); |
| r8453 | r8454 | |
|---|---|---|
| 49 | 49 | static void c65_nmi( running_machine *machine ) |
| 50 | 50 | { |
| 51 | 51 | static int nmilevel = 0; |
| 52 | running_device *cia_1 = | |
| 52 | running_device *cia_1 = m | |
| 53 | 53 | int cia1irq = mos6526_irq_r(cia_1); |
| 54 | 54 | |
| 55 | 55 | if (nmilevel != (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq) /* KEY_RESTORE */ |
| r8453 | r8454 | |
| 79 | 79 | |
| 80 | 80 | static READ8_DEVICE_HANDLER( c65_cia0_port_a_r ) |
| 81 | 81 | { |
| 82 | UINT8 cia0portb = mos6526_pb_r(dev | |
| 82 | UINT8 cia0portb = mos6526_pb_r(dev | |
| 83 | 83 | |
| 84 | 84 | return cbm_common_cia0_port_a_r(device, cia0portb); |
| 85 | 85 | } |
| r8453 | r8454 | |
| 87 | 87 | static READ8_DEVICE_HANDLER( c65_cia0_port_b_r ) |
| 88 | 88 | { |
| 89 | 89 | UINT8 value = 0xff; |
| 90 | UINT8 cia0porta = mos6526_pa_r(dev | |
| 90 | UINT8 cia0porta = mos6526_pa_r(dev | |
| 91 | 91 | |
| 92 | 92 | value &= cbm_common_cia0_port_b_r(device, cia0porta); |
| 93 | 93 | |
| r8453 | r8454 | |
| 100 | 100 | static WRITE8_DEVICE_HANDLER( c65_cia0_port_b_w ) |
| 101 | 101 | { |
| 102 | 102 | // was there lightpen support in c65 video chip? |
| 103 | // running_device *vic3 = dev | |
| 103 | // running_device *vic3 = dev | |
| 104 | 104 | // vic3_lightpen_write(vic3, data & 0x10); |
| 105 | 105 | } |
| 106 | 106 | |
| r8453 | r8454 | |
| 125 | 125 | /* is this correct for c65 as well as c64? */ |
| 126 | 126 | void c65_vic_interrupt( running_machine *machine, int level ) |
| 127 | 127 | { |
| 128 | running_device *cia_0 = | |
| 128 | running_device *cia_0 = m | |
| 129 | 129 | #if 1 |
| 130 | 130 | if (level != vicirq) |
| 131 | 131 | { |
| r8453 | r8454 | |
| 187 | 187 | static READ8_DEVICE_HANDLER( c65_cia1_port_a_r ) |
| 188 | 188 | { |
| 189 | 189 | UINT8 value = 0xff; |
| 190 | running_device *serbus = dev | |
| 190 | running_device *serbus = dev | |
| 191 | 191 | |
| 192 | 192 | if (!cbm_iec_clk_r(serbus)) |
| 193 | 193 | value &= ~0x40; |
| r8453 | r8454 | |
| 201 | 201 | static WRITE8_DEVICE_HANDLER( c65_cia1_port_a_w ) |
| 202 | 202 | { |
| 203 | 203 | static const int helper[4] = {0xc000, 0x8000, 0x4000, 0x0000}; |
| 204 | running_device *serbus = dev | |
| 204 | running_device *serbus = dev | |
| 205 | 205 | |
| 206 | 206 | cbm_iec_atn_w(serbus, device, !BIT(data, 3)); |
| 207 | 207 | cbm_iec_clk_w(serbus, device, !BIT(data, 4)); |
| r8453 | r8454 | |
| 554 | 554 | |
| 555 | 555 | static void c65_fdc_w( running_machine *machine, int offset, int data ) |
| 556 | 556 | { |
| 557 | DBG_LOG(machine, 1, "fdc write", ("%.5x %.2x %.2x\n", cpu_get_pc( | |
| 557 | DBG_LOG(machine, 1, "fdc write", ("%.5x %.2x %.2x\n", cpu_get_pc(m | |
| 558 | 558 | switch (offset & 0xf) |
| 559 | 559 | { |
| 560 | 560 | case 0: |
| r8453 | r8454 | |
| 638 | 638 | data = c65_fdc.reg[offset & 0xf]; |
| 639 | 639 | break; |
| 640 | 640 | } |
| 641 | DBG_LOG(machine, 1, "fdc read", ("%.5x %.2x %.2x\n", cpu_get_pc( | |
| 641 | DBG_LOG(machine, 1, "fdc read", ("%.5x %.2x %.2x\n", cpu_get_pc(m | |
| 642 | 642 | return data; |
| 643 | 643 | } |
| 644 | 644 | |
| r8453 | r8454 | |
| 664 | 664 | static READ8_HANDLER( c65_ram_expansion_r ) |
| 665 | 665 | { |
| 666 | 666 | UINT8 data = 0xff; |
| 667 | if (messram_get_size( | |
| 667 | if (messram_get_size( | |
| 668 | 668 | data = expansion_ram.reg; |
| 669 | 669 | return data; |
| 670 | 670 | } |
| r8453 | r8454 | |
| 674 | 674 | offs_t expansion_ram_begin; |
| 675 | 675 | offs_t expansion_ram_end; |
| 676 | 676 | |
| 677 | if (messram_get_size( | |
| 677 | if (messram_get_size( | |
| 678 | 678 | { |
| 679 | 679 | expansion_ram.reg = data; |
| 680 | 680 | |
| 681 | 681 | expansion_ram_begin = 0x80000; |
| 682 | expansion_ram_end = 0x80000 + (messram_get_size( | |
| 682 | expansion_ram_end = 0x80000 + (messram_get_size( | |
| 683 | 683 | |
| 684 | 684 | if (data == 0x00) { |
| 685 | 685 | memory_install_readwrite_bank(space, expansion_ram_begin, expansion_ram_end,0,0,"bank16"); |
| 686 | memory_set_bankptr(space->machine, "bank16", messram_get_ptr( | |
| 686 | memory_set_bankptr(space->machine, "bank16", messram_get_ptr( | |
| 687 | 687 | } else { |
| 688 | 688 | memory_nop_readwrite(space, expansion_ram_begin, expansion_ram_end,0,0); |
| 689 | 689 | } |
| r8453 | r8454 | |
| 692 | 692 | |
| 693 | 693 | static WRITE8_HANDLER( c65_write_io ) |
| 694 | 694 | { |
| 695 | running_device *sid_0 = devtag_get_device(space->machine, "sid_r"); | |
| 696 | running_device *sid_1 = devtag_get_device(space->machine, "sid_l"); | |
| 697 | running_device *vic3 = devtag_get_device(space->machine, "vic3"); | |
| 695 | running_device *sid_0 = space->machine->device("sid_r"); | |
| 696 | running_device *sid_1 = space->machine->device("sid_l"); | |
| 697 | running_device *vic3 = space->machine->device("vic3"); | |
| 698 | 698 | |
| 699 | 699 | switch (offset & 0xf00) |
| 700 | 700 | { |
| r8453 | r8454 | |
| 736 | 736 | |
| 737 | 737 | static WRITE8_HANDLER( c65_write_io_dc00 ) |
| 738 | 738 | { |
| 739 | running_device *cia_0 = devtag_get_device(space->machine, "cia_0"); | |
| 740 | running_device *cia_1 = devtag_get_device(space->machine, "cia_1"); | |
| 739 | running_device *cia_0 = space->machine->device("cia_0"); | |
| 740 | running_device *cia_1 = space->machine->device("cia_1"); | |
| 741 | 741 | |
| 742 | 742 | switch (offset & 0xf00) |
| 743 | 743 | { |
| r8453 | r8454 | |
| 756 | 756 | |
| 757 | 757 | static READ8_HANDLER( c65_read_io ) |
| 758 | 758 | { |
| 759 | running_device *sid_0 = devtag_get_device(space->machine, "sid_r"); | |
| 760 | running_device *sid_1 = devtag_get_device(space->machine, "sid_l"); | |
| 761 | running_device *vic3 = devtag_get_device(space->machine, "vic3"); | |
| 759 | running_device *sid_0 = space->machine->device("sid_r"); | |
| 760 | running_device *sid_1 = space->machine->device("sid_l"); | |
| 761 | running_device *vic3 = space->machine->device("vic3"); | |
| 762 | 762 | |
| 763 | 763 | switch (offset & 0xf00) |
| 764 | 764 | { |
| r8453 | r8454 | |
| 799 | 799 | |
| 800 | 800 | static READ8_HANDLER( c65_read_io_dc00 ) |
| 801 | 801 | { |
| 802 | running_device *cia_0 = devtag_get_device(space->machine, "cia_0"); | |
| 803 | running_device *cia_1 = devtag_get_device(space->machine, "cia_1"); | |
| 802 | running_device *cia_0 = space->machine->device("cia_0"); | |
| 803 | running_device *cia_1 = space->machine->device("cia_1"); | |
| 804 | 804 | |
| 805 | 805 | switch (offset & 0x300) |
| 806 | 806 | { |
| r8453 | r8454 | |
| 1044 | 1044 | MACHINE_START( c65 ) |
| 1045 | 1045 | { |
| 1046 | 1046 | /* clear upper memory */ |
| 1047 | memset(messram_get_ptr( | |
| 1047 | memset(messram_get_ptr(m | |
| 1048 | 1048 | |
| 1049 | 1049 | //removed cbm_drive_0_config (SERIAL, 10); |
| 1050 | 1050 | //removed cbm_drive_1_config (SERIAL, 11); |
| r8453 | r8454 | |
|---|---|---|
| 48 | 48 | |
| 49 | 49 | static TIMER_CALLBACK(dai_bootstrap_callback) |
| 50 | 50 | { |
| 51 | cpu_set_reg( | |
| 51 | cpu_set_reg(m | |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | static UINT8 dai_keyboard_scan_mask = 0; |
| r8453 | r8454 | |
| 144 | 144 | |
| 145 | 145 | MACHINE_START( dai ) |
| 146 | 146 | { |
| 147 | dai_tms5501 = | |
| 147 | dai_tms5501 = m | |
| 148 | 148 | |
| 149 | 149 | memory_configure_bank(machine, "bank2", 0, 4, memory_region(machine, "maincpu") + 0x010000, 0x1000); |
| 150 | 150 | timer_set(machine, attotime_zero, NULL, 0, dai_bootstrap_callback); |
| r8453 | r8454 | |
| 153 | 153 | |
| 154 | 154 | MACHINE_RESET( dai ) |
| 155 | 155 | { |
| 156 | memory_set_bankptr(machine, "bank1", messram_get_ptr( | |
| 156 | memory_set_bankptr(machine, "bank1", messram_get_ptr(m | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /*************************************************************************** |
| r8453 | r8454 | |
| 195 | 195 | data |= 0x08; // serial ready |
| 196 | 196 | if (mame_rand(space->machine)&0x01) |
| 197 | 197 | data |= 0x40; // random number generator |
| 198 | if (cassette_input( | |
| 198 | if (cassette_input( | |
| 199 | 199 | data |= 0x80; // tape input |
| 200 | 200 | break; |
| 201 | 201 | |
| r8453 | r8454 | |
| 230 | 230 | dai_paddle_enable = (data&0x08)>>3; |
| 231 | 231 | dai_cassette_motor[0] = (data&0x10)>>4; |
| 232 | 232 | dai_cassette_motor[1] = (data&0x20)>>5; |
| 233 | cassette_change_state(devtag_get_device(space->machine, "cassette"), dai_cassette_motor[0]?CASSETTE_MOTOR_DISABLED:CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); | |
| 234 | cassette_output(devtag_get_device(space->machine, "cassette"), (data & 0x01) ? -1.0 : 1.0); | |
| 233 | cassette_change_state(space->machine->device("cassette"), dai_cassette_motor[0]?CASSETTE_MOTOR_DISABLED:CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); | |
| 234 | cassette_output(space->machine->device("cassette"), (data & 0x01) ? -1.0 : 1.0); | |
| 235 | 235 | dai_update_memory (space->machine, (data&0xc0)>>6); |
| 236 | 236 | LOG_DAI_PORT_W (offset, (data&0x06)>>2, "discrete devices - paddle select"); |
| 237 | 237 | LOG_DAI_PORT_W (offset, (data&0x08)>>3, "discrete devices - paddle enable"); |
| r8453 | r8454 | |
|---|---|---|
| 256 | 256 | |
| 257 | 257 | static VIDEO_UPDATE(teleprinter ) |
| 258 | 258 | { |
| 259 | running_device *devconf = | |
| 259 | running_device *devconf = | |
| 260 | 260 | generic_teleprinter_update( devconf, bitmap, cliprect); |
| 261 | 261 | return 0; |
| 262 | 262 | } |
| r8453 | r8454 | |
|---|---|---|
| 460 | 460 | /* find devices */ |
| 461 | 461 | c1581->cia = device->subdevice(M8520_TAG); |
| 462 | 462 | c1581->wd1770 = device->subdevice(WD1770_TAG); |
| 463 | c1581->serial_bus = dev | |
| 463 | c1581->serial_bus = dev | |
| 464 | 464 | c1581->image = device->subdevice(FLOPPY_0); |
| 465 | 465 | |
| 466 | 466 | /* register for state saving */ |
| r8453 | r8454 | |
|---|---|---|
| 68 | 68 | */ |
| 69 | 69 | READ8_DEVICE_HANDLER( cbmb_tpi0_port_a_r ) |
| 70 | 70 | { |
| 71 | running_device *ieeebus = dev | |
| 71 | running_device *ieeebus = dev | |
| 72 | 72 | UINT8 data = 0; |
| 73 | 73 | |
| 74 | 74 | if (ieee488_nrfd_r(ieeebus)) |
| r8453 | r8454 | |
| 94 | 94 | |
| 95 | 95 | WRITE8_DEVICE_HANDLER( cbmb_tpi0_port_a_w ) |
| 96 | 96 | { |
| 97 | running_device *ieeebus = dev | |
| 97 | running_device *ieeebus = dev | |
| 98 | 98 | |
| 99 | 99 | ieee488_nrfd_w(ieeebus, device, BIT(data, 7)); |
| 100 | 100 | ieee488_ndac_w(ieeebus, device, BIT(data, 6)); |
| r8453 | r8454 | |
| 106 | 106 | |
| 107 | 107 | READ8_DEVICE_HANDLER( cbmb_tpi0_port_b_r ) |
| 108 | 108 | { |
| 109 | running_device *ieeebus = dev | |
| 109 | running_device *ieeebus = dev | |
| 110 | 110 | UINT8 data = 0; |
| 111 | 111 | |
| 112 | 112 | if (ieee488_srq_r(ieeebus)) |
| r8453 | r8454 | |
| 120 | 120 | |
| 121 | 121 | WRITE8_DEVICE_HANDLER( cbmb_tpi0_port_b_w ) |
| 122 | 122 | { |
| 123 | running_device *ieeebus = dev | |
| 123 | running_device *ieeebus = dev | |
| 124 | 124 | |
| 125 | 125 | ieee488_srq_w(ieeebus, device, BIT(data, 1)); |
| 126 | 126 | ieee488_ifc_w(ieeebus, device, BIT(data, 0)); |
| r8453 | r8454 | |
| 263 | 263 | */ |
| 264 | 264 | static READ8_DEVICE_HANDLER( cbmb_cia_port_a_r ) |
| 265 | 265 | { |
| 266 | running_device *ieeebus = dev | |
| 266 | running_device *ieeebus = dev | |
| 267 | 267 | return ieee488_dio_r(ieeebus, 0); |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | static WRITE8_DEVICE_HANDLER( cbmb_cia_port_a_w ) |
| 271 | 271 | { |
| 272 | running_device *ieeebus = dev | |
| 272 | running_device *ieeebus = dev | |
| 273 | 273 | ieee488_dio_w(ieeebus, device, data); |
| 274 | 274 | } |
| 275 | 275 | |
| r8453 | r8454 | |
| 385 | 385 | static TIMER_CALLBACK(cbmb_frame_interrupt) |
| 386 | 386 | { |
| 387 | 387 | static int level = 0; |
| 388 | running_device *tpi_0 = | |
| 388 | running_device *tpi_0 = m | |
| 389 | 389 | |
| 390 | 390 | #if 0 |
| 391 | 391 | int controller1 = input_port_read(machine, "CTRLSEL") & 0x07; |
| r8453 | r8454 | |
|---|---|---|
| 22 | 22 | |
| 23 | 23 | MACHINE_RESET(mc8020) |
| 24 | 24 | { |
| 25 | cpu_set_irq_callback( | |
| 25 | cpu_set_irq_callback(m | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | static WRITE_LINE_DEVICE_HANDLER( ctc_z0_w ) |
| r8453 | r8454 | |
| 119 | 119 | |
| 120 | 120 | MACHINE_RESET(mc8030) |
| 121 | 121 | { |
| 122 | cpu_set_irq_callback( | |
| 122 | cpu_set_irq_callback(m | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | static READ8_DEVICE_HANDLER (zve_port_a_r) |
| r8453 | r8454 | |
|---|---|---|
| 34 | 34 | static WRITE8_DEVICE_HANDLER( pio_ardy ) |
| 35 | 35 | { |
| 36 | 36 | /* devices need to be redeclared in this callback for some strange reason */ |
| 37 | mbee_printer = dev | |
| 37 | mbee_printer = dev | |
| 38 | 38 | centronics_strobe_w(mbee_printer, (data) ? 0 : 1); |
| 39 | 39 | } |
| 40 | 40 | |
| r8453 | r8454 | |
| 162 | 162 | { |
| 163 | 163 | timer_set(machine, ATTOTIME_IN_USEC(4), NULL, 0, mbee_reset); |
| 164 | 164 | memory_set_bank(machine, "bank1", 1); |
| 165 | mbee_z80pio = devtag_get_device(machine, "z80pio"); | |
| 166 | mbee_speaker = devtag_get_device(machine, "speaker"); | |
| 167 | mbee_cassette = devtag_get_device(machine, "cassette"); | |
| 168 | mbee_printer = devtag_get_device(machine, "centronics"); | |
| 169 | mbee_fdc = devtag_get_device(machine, "wd179x"); | |
| 165 | mbee_z80pio = machine->device("z80pio"); | |
| 166 | mbee_speaker = machine->device("speaker"); | |
| 167 | mbee_cassette = machine->device("cassette"); | |
| 168 | mbee_printer = machine->device("centronics"); | |
| 169 | mbee_fdc = machine->device("wd179x"); | |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | |
| r8453 | r8454 | |
| 196 | 196 | |
| 197 | 197 | Z80BIN_EXECUTE( mbee ) |
| 198 | 198 | { |
| 199 | running_device *cpu = | |
| 199 | running_device *cpu = m | |
| 200 | 200 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 201 | 201 | |
| 202 | 202 | memory_write_word_16le(space, 0xa6, execute_address); /* fix the EXEC command */ |
| r8453 | r8454 | |
| 214 | 214 | |
| 215 | 215 | QUICKLOAD_LOAD( mbee ) |
| 216 | 216 | { |
| 217 | running_device *cpu = | |
| 217 | running_device *cpu = | |
| 218 | 218 | const address_space *space = cputag_get_address_space(image.device().machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 219 | 219 | UINT16 i, j; |
| 220 | 220 | UINT8 data, sw = input_port_read(image.device().machine, "CONFIG") & 1; /* reading the dipswitch: 1 = autorun */ |
| r8453 | r8454 | |
|---|---|---|
| 369 | 369 | } |
| 370 | 370 | else |
| 371 | 371 | { |
| 372 | return k051649_waveform_r ( | |
| 372 | return k051649_waveform_r ( | |
| 373 | 373 | } |
| 374 | 374 | } |
| 375 | 375 | |
| r8453 | r8454 | |
| 433 | 433 | } |
| 434 | 434 | else if (state->cart.scc.active && addr >= 0x9800 && addr < 0xa000) |
| 435 | 435 | { |
| 436 | running_device *k051649 = | |
| 436 | running_device *k051649 = | |
| 437 | 437 | int offset = addr & 0xff; |
| 438 | 438 | |
| 439 | 439 | if (offset < 0x80) |
| r8453 | r8454 | |
| 1252 | 1252 | |
| 1253 | 1253 | MSX_SLOT_RESET(diskrom) |
| 1254 | 1254 | { |
| 1255 | running_device *fdc = | |
| 1255 | running_device *fdc = m | |
| 1256 | 1256 | wd17xx_reset(fdc); |
| 1257 | 1257 | } |
| 1258 | 1258 | |
| 1259 | 1259 | static READ8_HANDLER (msx_diskrom_page1_r) |
| 1260 | 1260 | { |
| 1261 | running_device *fdc = | |
| 1261 | running_device *fdc = | |
| 1262 | 1262 | switch (offset) |
| 1263 | 1263 | { |
| 1264 | 1264 | case 0: return wd17xx_status_r (fdc, 0); |
| r8453 | r8454 | |
| 1273 | 1273 | |
| 1274 | 1274 | static READ8_HANDLER (msx_diskrom_page2_r) |
| 1275 | 1275 | { |
| 1276 | running_device *fdc = | |
| 1276 | running_device *fdc = | |
| 1277 | 1277 | if (offset >= 0x7f8) |
| 1278 | 1278 | { |
| 1279 | 1279 | switch (offset) |
| r8453 | r8454 | |
| 1326 | 1326 | |
| 1327 | 1327 | MSX_SLOT_WRITE(diskrom) |
| 1328 | 1328 | { |
| 1329 | running_device *fdc = | |
| 1329 | running_device *fdc = m | |
| 1330 | 1330 | if (addr >= 0xa000 && addr < 0xc000) |
| 1331 | 1331 | { |
| 1332 | 1332 | addr -= 0x4000; |
| r8453 | r8454 | |
| 1377 | 1377 | |
| 1378 | 1378 | MSX_SLOT_RESET(diskrom2) |
| 1379 | 1379 | { |
| 1380 | running_device *fdc = | |
| 1380 | running_device *fdc = m | |
| 1381 | 1381 | wd17xx_reset (fdc); |
| 1382 | 1382 | } |
| 1383 | 1383 | |
| 1384 | 1384 | static READ8_HANDLER (msx_diskrom2_page1_r) |
| 1385 | 1385 | { |
| 1386 | running_device *fdc = | |
| 1386 | running_device *fdc = | |
| 1387 | 1387 | switch (offset) |
| 1388 | 1388 | { |
| 1389 | 1389 | case 0: return wd17xx_status_r(fdc, 0); |
| r8453 | r8454 | |
| 1398 | 1398 | |
| 1399 | 1399 | static READ8_HANDLER (msx_diskrom2_page2_r) |
| 1400 | 1400 | { |
| 1401 | running_device *fdc = | |
| 1401 | running_device *fdc = | |
| 1402 | 1402 | if (offset >= 0x7b8) |
| 1403 | 1403 | { |
| 1404 | 1404 | switch (offset) |
| r8453 | r8454 | |
| 1450 | 1450 | |
| 1451 | 1451 | MSX_SLOT_WRITE(diskrom2) |
| 1452 | 1452 | { |
| 1453 | running_device *fdc = | |
| 1453 | running_device *fdc = m | |
| 1454 | 1454 | if (addr >= 0xa000 && addr < 0xc000) |
| 1455 | 1455 | { |
| 1456 | 1456 | addr -= 0x4000; |
| r8453 | r8454 | |
| 1527 | 1527 | { |
| 1528 | 1528 | if (addr >= 0x4000 && addr < 0x8000 && !(addr & 0x0010)) |
| 1529 | 1529 | { |
| 1530 | dac_data_w ( | |
| 1530 | dac_data_w (m | |
| 1531 | 1531 | } |
| 1532 | 1532 | } |
| 1533 | 1533 | |
| r8453 | r8454 | |
| 1583 | 1583 | { |
| 1584 | 1584 | if (addr >= 0x5000 && addr < 0x6000) |
| 1585 | 1585 | { |
| 1586 | dac_data_w ( | |
| 1586 | dac_data_w (m | |
| 1587 | 1587 | } |
| 1588 | 1588 | else if (addr >= 0x6000 && addr < 0x8000) |
| 1589 | 1589 | { |
| r8453 | r8454 | |
| 1716 | 1716 | case 0x7ff4: |
| 1717 | 1717 | if (state->cart.fmpac.opll_active) |
| 1718 | 1718 | { |
| 1719 | ym2413_w ( | |
| 1719 | ym2413_w ( | |
| 1720 | 1720 | } |
| 1721 | 1721 | break; |
| 1722 | 1722 | case 0x7ff5: |
| 1723 | 1723 | if (state->cart.fmpac.opll_active) |
| 1724 | 1724 | { |
| 1725 | ym2413_w ( | |
| 1725 | ym2413_w ( | |
| 1726 | 1726 | } |
| 1727 | 1727 | break; |
| 1728 | 1728 | case 0x7ff6: |
| r8453 | r8454 | |
| 2206 | 2206 | |
| 2207 | 2207 | if (reg < 0x80) |
| 2208 | 2208 | { |
| 2209 | return k051649_waveform_r ( | |
| 2209 | return k051649_waveform_r ( | |
| 2210 | 2210 | } |
| 2211 | 2211 | else if (reg < 0xa0) |
| 2212 | 2212 | { |
| r8453 | r8454 | |
| 2215 | 2215 | else if (reg < 0xc0) |
| 2216 | 2216 | { |
| 2217 | 2217 | /* read wave 5 */ |
| 2218 | return k051649_waveform_r ( | |
| 2218 | return k051649_waveform_r ( | |
| 2219 | 2219 | } |
| 2220 | 2220 | #if 0 |
| 2221 | 2221 | else if (reg < 0xe0) |
| r8453 | r8454 | |
| 2241 | 2241 | |
| 2242 | 2242 | if (reg < 0xa0) |
| 2243 | 2243 | { |
| 2244 | return k051649_waveform_r ( | |
| 2244 | return k051649_waveform_r ( | |
| 2245 | 2245 | } |
| 2246 | 2246 | #if 0 |
| 2247 | 2247 | else if (reg >= 0xc0 && reg < 0xe0) |
| r8453 | r8454 | |
| 2351 | 2351 | } |
| 2352 | 2352 | else if (addr >= 0x9800 && state->cart.sccp.scc_active) |
| 2353 | 2353 | { |
| 2354 | running_device *k051649 = | |
| 2354 | running_device *k051649 = | |
| 2355 | 2355 | int offset = addr & 0xff; |
| 2356 | 2356 | |
| 2357 | 2357 | if (offset < 0x80) |
| r8453 | r8454 | |
| 2403 | 2403 | } |
| 2404 | 2404 | else if (addr >= 0xb800 && state->cart.sccp.sccp_active) |
| 2405 | 2405 | { |
| 2406 | running_device *k051649 = | |
| 2406 | running_device *k051649 = | |
| 2407 | 2407 | int offset = addr & 0xff; |
| 2408 | 2408 | |
| 2409 | 2409 | if (offset < 0xa0) |
| r8453 | r8454 | |
|---|---|---|
| 204 | 204 | |
| 205 | 205 | static void pokemini_update_sound( running_machine *machine ) |
| 206 | 206 | { |
| 207 | running_device *speaker = | |
| 207 | running_device *speaker = m | |
| 208 | 208 | /* Check if sound should be muted */ |
| 209 | 209 | if ( pm_reg[0x70] & 0x03 ) |
| 210 | 210 | { |
| r8453 | r8454 | |
|---|---|---|
| 91 | 91 | /* currently enough to save the external ram */ |
| 92 | 92 | NVRAM_HANDLER( pc1350 ) |
| 93 | 93 | { |
| 94 | running_device *main_cpu = | |
| 94 | running_device *main_cpu = m | |
| 95 | 95 | UINT8 *ram = memory_region(machine, "maincpu") + 0x2000; |
| 96 | 96 | UINT8 *cpu = sc61860_internal_ram(main_cpu); |
| 97 | 97 | |
| r8453 | r8454 | |
| 124 | 124 | timer_set(machine, ATTOTIME_IN_SEC(1), NULL, 0, pc1350_power_up); |
| 125 | 125 | |
| 126 | 126 | memory_install_readwrite_bank(space, 0x6000, 0x6fff, 0, 0, "bank1"); |
| 127 | memory_set_bankptr(machine, "bank1", &messram_get_ptr( | |
| 127 | memory_set_bankptr(machine, "bank1", &messram_get_ptr(m | |
| 128 | 128 | |
| 129 | if (messram_get_size( | |
| 129 | if (messram_get_size(m | |
| 130 | 130 | { |
| 131 | 131 | memory_install_readwrite_bank(space, 0x4000, 0x5fff, 0, 0, "bank2"); |
| 132 | memory_set_bankptr(machine, "bank2", &messram_get_ptr( | |
| 132 | memory_set_bankptr(machine, "bank2", &messram_get_ptr(m | |
| 133 | 133 | } |
| 134 | 134 | else |
| 135 | 135 | { |
| 136 | 136 | memory_nop_readwrite(space, 0x4000, 0x5fff, 0, 0); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | if (messram_get_size( | |
| 139 | if (messram_get_size(m | |
| 140 | 140 | { |
| 141 | 141 | memory_install_readwrite_bank(space, 0x2000, 0x3fff, 0, 0, "bank3"); |
| 142 | memory_set_bankptr(machine, "bank3", &messram_get_ptr( | |
| 142 | memory_set_bankptr(machine, "bank3", &messram_get_ptr(m | |
| 143 | 143 | } |
| 144 | 144 | else |
| 145 | 145 | { |
| r8453 | r8454 | |
|---|---|---|
| 602 | 602 | { |
| 603 | 603 | coco_state *state = (coco_state *)machine->driver_data; |
| 604 | 604 | |
| 605 | cpu_set_reg(devtag_get_device(machine, "maincpu"), M6809_PC, trailer->reg_pc); | |
| 606 | cpu_set_reg(devtag_get_device(machine, "maincpu"), M6809_X, trailer->reg_x); | |
| 607 | cpu_set_reg(devtag_get_device(machine, "maincpu"), M6809_Y, trailer->reg_y); | |
| 608 | cpu_set_reg(devtag_get_device(machine, "maincpu"), M6809_U, trailer->reg_u); | |
| 609 | cpu_set_reg(devtag_get_device(machine, "maincpu"), M6809_S, trailer->reg_s); | |
| 610 | cpu_set_reg(devtag_get_device(machine, "maincpu"), M6809_DP, trailer->reg_dp); | |
| 611 | cpu_set_reg(devtag_get_device(machine, "maincpu"), M6809_B, trailer->reg_b); | |
| 612 | cpu_set_reg(devtag_get_device(machine, "maincpu"), M6809_A, trailer->reg_a); | |
| 613 | cpu_set_reg(devtag_get_device(machine, "maincpu"), M6809_CC, trailer->reg_cc); | |
| 605 | cpu_set_reg(machine->device("maincpu"), M6809_PC, trailer->reg_pc); | |
| 606 | cpu_set_reg(machine->device("maincpu"), M6809_X, trailer->reg_x); | |
| 607 | cpu_set_reg(machine->device("maincpu"), M6809_Y, trailer->reg_y); | |
| 608 | cpu_set_reg(machine->device("maincpu"), M6809_U, trailer->reg_u); | |
| 609 | cpu_set_reg(machine->device("maincpu"), M6809_S, trailer->reg_s); | |
| 610 | cpu_set_reg(machine->device("maincpu"), M6809_DP, trailer->reg_dp); | |
| 611 | cpu_set_reg(machine->device("maincpu"), M6809_B, trailer->reg_b); | |
| 612 | cpu_set_reg(machine->device("maincpu"), M6809_A, trailer->reg_a); | |
| 613 | cpu_set_reg(machine->device("maincpu"), M6809_CC, trailer->reg_cc); | |
| 614 | 614 | |
| 615 | 615 | /* I seem to only be able to get a small amount of the PIA state from the |
| 616 | 616 | * snapshot trailers. Thus I am going to configure the PIA myself. The |
| r8453 | r8454 | |
| 660 | 660 | int trailer_load = 0; |
| 661 | 661 | |
| 662 | 662 | ROM = memory_region(image.device().machine, "maincpu"); |
| 663 | rambase = &messram_get_ptr( | |
| 663 | rambase = &messram_get_ptr( | |
| 664 | 664 | rombase = &ROM[rombase_index]; |
| 665 | 665 | pakbase = &ROM[pakbase_index]; |
| 666 | 666 | |
| 667 | if (messram_get_size( | |
| 667 | if (messram_get_size( | |
| 668 | 668 | { |
| 669 | 669 | if (LOG_PAK) |
| 670 | 670 | logerror("Cannot load PAK files without at least 64k.\n"); |
| r8453 | r8454 | |
| 742 | 742 | |
| 743 | 743 | SNAPSHOT_LOAD ( coco3_pak ) |
| 744 | 744 | { |
| 745 | return generic_pak_load(image, (0x70000 % messram_get_size( | |
| 745 | return generic_pak_load(image, (0x70000 % messram_get_size( | |
| 746 | 746 | } |
| 747 | 747 | |
| 748 | 748 | /*************************************************************************** |
| r8453 | r8454 | |
| 775 | 775 | if (preamble != 0) |
| 776 | 776 | { |
| 777 | 777 | /* start address - just set the address and return */ |
| 778 | cpu_set_reg( | |
| 778 | cpu_set_reg( | |
| 779 | 779 | done = TRUE; |
| 780 | 780 | } |
| 781 | 781 | else |
| r8453 | r8454 | |
| 1283 | 1283 | |
| 1284 | 1284 | WRITE8_HANDLER( dgnalpha_psg_porta_write ) |
| 1285 | 1285 | { |
| 1286 | running_device *fdc = | |
| 1286 | running_device *fdc = | |
| 1287 | 1287 | /* Bits 0..3 are the drive select lines for the internal floppy interface */ |
| 1288 | 1288 | /* Bit 4 is the motor on, in the real hardware these are inverted on their way to the drive */ |
| 1289 | 1289 | /* Bits 5,6,7 are connected to /DDEN, ENP and 5/8 on the WD2797 */ |
| r8453 | r8454 | |
| 1678 | 1678 | |
| 1679 | 1679 | static WRITE8_DEVICE_HANDLER( dgnalpha_pia2_pa_w ) |
| 1680 | 1680 | { |
| 1681 | running_device *ay8912 = dev | |
| 1681 | running_device *ay8912 = dev | |
| 1682 | 1682 | int bc_flags; /* BCDDIR/BC1, as connected to PIA2 port a bits 0 and 1 */ |
| 1683 | 1683 | |
| 1684 | 1684 | /* If bit 2 of the pia2 ddra is 1 then this pin is an output so use it */ |
| r8453 | r8454 | |
| 1764 | 1764 | /* The Dragon Alpha hardware reverses the order of the WD2797 registers */ |
| 1765 | 1765 | READ8_HANDLER(dgnalpha_wd2797_r) |
| 1766 | 1766 | { |
| 1767 | running_device *fdc = | |
| 1767 | running_device *fdc = | |
| 1768 | 1768 | int result = 0; |
| 1769 | 1769 | |
| 1770 | 1770 | switch(offset & 0x03) |
| r8453 | r8454 | |
| 1790 | 1790 | |
| 1791 | 1791 | WRITE8_HANDLER(dgnalpha_wd2797_w) |
| 1792 | 1792 | { |
| 1793 | running_device *fdc = | |
| 1793 | running_device *fdc = | |
| 1794 | 1794 | switch(offset & 0x3) |
| 1795 | 1795 | { |
| 1796 | 1796 | case 0: |
| r8453 | r8454 | |
| 1852 | 1852 | to access 32K of ram, and also allows the cocoe driver to access |
| 1853 | 1853 | the full 64K, as this uses Color Basic 1.2, which can configure 64K rams */ |
| 1854 | 1854 | |
| 1855 | if (messram_get_size(dev | |
| 1855 | if (messram_get_size(dev | |
| 1856 | 1856 | result = (pia6821_get_output_b(state->pia_0) & 0x80) >> 5; |
| 1857 | else if (messram_get_size(dev | |
| 1857 | else if (messram_get_size(dev | |
| 1858 | 1858 | result = 0x04; |
| 1859 | 1859 | else |
| 1860 | 1860 | result = 0x00; /* 4K Rams */ |
| r8453 | r8454 | |
| 1873 | 1873 | as both the 64 and Alpha, always have 64K rams, also the meaning of |
| 1874 | 1874 | the bit is different with respect to the CoCo 1 */ |
| 1875 | 1875 | |
| 1876 | if (messram_get_size(dev | |
| 1876 | if (messram_get_size(dev | |
| 1877 | 1877 | result = 0x00; /* 1 bank of 64K, rams */ |
| 1878 | 1878 | else |
| 1879 | 1879 | result = 0x04; /* 2 banks of 16K rams */ |
| r8453 | r8454 | |
| 1890 | 1890 | */ |
| 1891 | 1891 | int result; |
| 1892 | 1892 | |
| 1893 | if (messram_get_size(dev | |
| 1893 | if (messram_get_size(dev | |
| 1894 | 1894 | result = 0x00; /* 4K: wire pia1_pb2 low */ |
| 1895 | else if (messram_get_size(dev | |
| 1895 | else if (messram_get_size(dev | |
| 1896 | 1896 | result = 0x04; /* 16K: wire pia1_pb2 high */ |
| 1897 | 1897 | else |
| 1898 | 1898 | result = (pia6821_get_output_b(state->pia_0) & 0x40) >> 4; /* 32/64K: wire output of pia0_pb6 to input pia1_pb2 */ |
| r8453 | r8454 | |
| 1933 | 1933 | |
| 1934 | 1934 | switch (map) |
| 1935 | 1935 | { |
| 1936 | case 0x00 : bottom_32k=&messram_get_ptr(devtag_get_device(space->machine, "messram"))[0x00000]; break; | |
| 1937 | case 0x01 : bottom_32k=&messram_get_ptr(devtag_get_device(space->machine, "messram"))[0x10000]; break; | |
| 1938 | case 0x02 : bottom_32k=&messram_get_ptr(devtag_get_device(space->machine, "messram"))[0x18000]; break; | |
| 1939 | case 0x03 : bottom_32k=&messram_get_ptr(devtag_get_device(space->machine, "messram"))[0x00000]; break; | |
| 1940 | default : bottom_32k=&messram_get_ptr(devtag_get_device(space->machine, "messram"))[0x00000]; break; // Just to shut the compiler up ! | |
| 1936 | case 0x00 : bottom_32k=&messram_get_ptr(space->machine->device("messram"))[0x00000]; break; | |
| 1937 | case 0x01 : bottom_32k=&messram_get_ptr(space->machine->device("messram"))[0x10000]; break; | |
| 1938 | case 0x02 : bottom_32k=&messram_get_ptr(space->machine->device("messram"))[0x18000]; break; | |
| 1939 | case 0x03 : bottom_32k=&messram_get_ptr(space->machine->device("messram"))[0x00000]; break; | |
| 1940 | default : bottom_32k=&messram_get_ptr(space->machine->device("messram"))[0x00000]; break; // Just to shut the compiler up ! | |
| 1941 | 1941 | } |
| 1942 | 1942 | |
| 1943 | 1943 | setup_memory_map(space->machine); |
| r8453 | r8454 | |
| 1973 | 1973 | * TODO: Make the overclock more accurate. In dual speed, ROM was a fast |
| 1974 | 1974 | * access but RAM was not. I don't know how to simulate this. |
| 1975 | 1975 | */ |
| 1976 | cpu_set_clockscale(dev | |
| 1976 | cpu_set_clockscale(dev | |
| 1977 | 1977 | } |
| 1978 | 1978 | |
| 1979 | 1979 | READ8_HANDLER(dgnalpha_mapped_irq_r) |
| r8453 | r8454 | |
| 2057 | 2057 | /* Lookup the apropreate wbank value dependent on ram size */ |
| 2058 | 2058 | if (memsize==0) |
| 2059 | 2059 | wbank=memmap[block_index].wbank4; |
| 2060 | else if ((memsize==1) && (messram_get_size( | |
| 2060 | else if ((memsize==1) && (messram_get_size(m | |
| 2061 | 2061 | wbank=memmap[block_index].wbank16_1; |
| 2062 | else if ((memsize==1) && (messram_get_size( | |
| 2062 | else if ((memsize==1) && (messram_get_size(m | |
| 2063 | 2063 | wbank=memmap[block_index].wbank16_2; |
| 2064 | 2064 | else |
| 2065 | 2065 | wbank=memmap[block_index].wbank64; |
| r8453 | r8454 | |
| 2073 | 2073 | if(block_index<8) |
| 2074 | 2074 | memory_set_bankptr(machine, bank, &bottom_32k[memmap[wbank-1].start]); |
| 2075 | 2075 | else |
| 2076 | memory_set_bankptr(machine, bank,&messram_get_ptr( | |
| 2076 | memory_set_bankptr(machine, bank,&messram_get_ptr(m | |
| 2077 | 2077 | |
| 2078 | 2078 | memory_install_readwrite_bank(space, memmap[block_index].start, memmap[block_index].end, 0, 0, bank); |
| 2079 | 2079 | } |
| r8453 | r8454 | |
| 2118 | 2118 | |
| 2119 | 2119 | if (!sam6883_maptype(device)) // Ignored in maptype 1 |
| 2120 | 2120 | { |
| 2121 | if((messram_get_size(devtag_get_device(device->machine, "messram"))>0x8000) && val) | |
| 2122 | bottom_32k=&messram_get_ptr(devtag_get_device(device->machine, "messram"))[0x8000]; | |
| 2121 | if((messram_get_size(device->machine->device("messram"))>0x8000) && val) | |
| 2122 | bottom_32k=&messram_get_ptr(device->machine->device("messram"))[0x8000]; | |
| 2123 | 2123 | else |
| 2124 | bottom_32k=messram_get_ptr(dev | |
| 2124 | bottom_32k=messram_get_ptr(dev | |
| 2125 | 2125 | |
| 2126 | 2126 | setup_memory_map(device->machine); |
| 2127 | 2127 | } |
| r8453 | r8454 | |
| 2248 | 2248 | static SAM6883_SET_MAP_TYPE( d_sam_set_maptype ) |
| 2249 | 2249 | { |
| 2250 | 2250 | if(val) |
| 2251 | bottom_32k=messram_get_ptr(dev | |
| 2251 | bottom_32k=messram_get_ptr(dev | |
| 2252 | 2252 | |
| 2253 | 2253 | setup_memory_map(device->machine); |
| 2254 | 2254 | } |
| r8453 | r8454 | |
| 2296 | 2296 | /* this GIME register fixes logical addresses $FExx to physical |
| 2297 | 2297 | * addresses $7FExx ($1FExx if 128k */ |
| 2298 | 2298 | assert(offset < 0x200); |
| 2299 | return ((messram_get_size( | |
| 2299 | return ((messram_get_size(m | |
| 2300 | 2300 | } |
| 2301 | 2301 | bank = 7; |
| 2302 | 2302 | offset += 0x1e00; |
| r8453 | r8454 | |
| 2346 | 2346 | } |
| 2347 | 2347 | else |
| 2348 | 2348 | { |
| 2349 | result = ((block * 0x2000) + offset) % messram_get_size( | |
| 2349 | result = ((block * 0x2000) + offset) % messram_get_size(m | |
| 2350 | 2350 | } |
| 2351 | 2351 | return result; |
| 2352 | 2352 | } |
| r8453 | r8454 | |
| 2396 | 2396 | else |
| 2397 | 2397 | { |
| 2398 | 2398 | /* offset into normal RAM */ |
| 2399 | readbank = &messram_get_ptr( | |
| 2399 | readbank = &messram_get_ptr(m | |
| 2400 | 2400 | memory_install_write_bank(space, bank_info[i].start, bank_info[i].end, 0, 0, bank); |
| 2401 | 2401 | } |
| 2402 | 2402 | |
| r8453 | r8454 | |
| 2675 | 2675 | { |
| 2676 | 2676 | UINT32 video_base; |
| 2677 | 2677 | video_base = coco3_get_video_base(0xE0, 0x3F); |
| 2678 | return &messram_get_ptr(dev | |
| 2678 | return &messram_get_ptr(dev | |
| 2679 | 2679 | } |
| 2680 | 2680 | |
| 2681 | 2681 | |
| r8453 | r8454 | |
| 2786 | 2786 | coco_state *state = (coco_state *)(coco_state *) machine->driver_data; |
| 2787 | 2787 | |
| 2788 | 2788 | /* locate devices */ |
| 2789 | state->cococart_device = devtag_get_device(machine, "coco_cartslot"); | |
| 2790 | state->cassette_device = devtag_get_device(machine, "cassette"); | |
| 2791 | state->bitbanger_device = devtag_get_device(machine, "bitbanger"); | |
| 2792 | state->printer_device = devtag_get_device(machine, "printer"); | |
| 2793 | state->dac = devtag_get_device(machine, "dac"); | |
| 2794 | state->sam = devtag_get_device(machine, "sam"); | |
| 2795 | state->pia_0 = devtag_get_device(machine, "pia_0"); | |
| 2796 | state->pia_1 = devtag_get_device(machine, "pia_1"); | |
| 2797 | state->pia_2 = devtag_get_device(machine, "pia_2"); | |
| 2789 | state->cococart_device = machine->device("coco_cartslot"); | |
| 2790 | state->cassette_device = machine->device("cassette"); | |
| 2791 | state->bitbanger_device = machine->device("bitbanger"); | |
| 2792 | state->printer_device = machine->device("printer"); | |
| 2793 | state->dac = machine->device("dac"); | |
| 2794 | state->sam = machine->device("sam"); | |
| 2795 | state->pia_0 = machine->device("pia_0"); | |
| 2796 | state->pia_1 = machine->device("pia_1"); | |
| 2797 | state->pia_2 = machine->device("pia_2"); | |
| 2798 | 2798 | |
| 2799 | 2799 | /* clear static variables */ |
| 2800 | 2800 | coco_hiresjoy_ca = 1; |
| r8453 | r8454 | |
| 2819 | 2819 | bas_rom_bank = coco_rom; |
| 2820 | 2820 | |
| 2821 | 2821 | /* setup default pointer for botom 32K of ram */ |
| 2822 | bottom_32k = messram_get_ptr( | |
| 2822 | bottom_32k = messram_get_ptr(m | |
| 2823 | 2823 | |
| 2824 | 2824 | /* setup printer output callback */ |
| 2825 | 2825 | printer_out = init->printer_out_; |
| r8453 | r8454 | |
| 2836 | 2836 | static void generic_coco12_dragon_init(running_machine *machine, const machine_init_interface *init) |
| 2837 | 2837 | { |
| 2838 | 2838 | /* Set default RAM mapping */ |
| 2839 | memory_set_bankptr(machine, "bank1", &messram_get_ptr( | |
| 2839 | memory_set_bankptr(machine, "bank1", &messram_get_ptr(m | |
| 2840 | 2840 | |
| 2841 | 2841 | /* Do generic Inits */ |
| 2842 | 2842 | generic_init_machine(machine, init); |
| r8453 | r8454 | |
| 2927 | 2927 | |
| 2928 | 2928 | MACHINE_RESET( dgnalpha ) |
| 2929 | 2929 | { |
| 2930 | running_device *fdc = | |
| 2930 | running_device *fdc = m | |
| 2931 | 2931 | wd17xx_set_complete_command_delay(fdc,20); |
| 2932 | 2932 | |
| 2933 | 2933 | /* dgnalpha_just_reset, is here to flag that we should ignore the first irq generated */ |
| r8453 | r8454 | |
|---|---|---|
| 62 | 62 | MBC_UNKNOWN, /* Unknown mapper */ |
| 63 | 63 | }; |
| 64 | 64 | |
| 65 | /* messram_get_ptr( | |
| 65 | /* messram_get_ptr(m | |
| 66 | 66 | #define CGB_START_VRAM_BANKS 0x0000 |
| 67 | 67 | #define CGB_START_RAM_BANKS ( 2 * 8 * 1024 ) |
| 68 | 68 | |
| r8453 | r8454 | |
| 290 | 290 | break; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | gb_sound_w( | |
| 293 | gb_sound_w( | |
| 294 | 294 | |
| 295 | 295 | gb_driver_data.divcount = 0; |
| 296 | 296 | gb_driver_data.triggering_irq = 0; |
| r8453 | r8454 | |
| 390 | 390 | gb_init_regs(machine); |
| 391 | 391 | |
| 392 | 392 | /* Initialize the Sound registers */ |
| 393 | gb_sound_w(devtag_get_device(machine, "custom"), 0x16,0x80); | |
| 394 | gb_sound_w(devtag_get_device(machine, "custom"), 0x15,0xF3); | |
| 395 | gb_sound_w(devtag_get_device(machine, "custom"), 0x14,0x77); | |
| 393 | gb_sound_w(machine->device("custom"), 0x16,0x80); | |
| 394 | gb_sound_w(machine->device("custom"), 0x15,0xF3); | |
| 395 | gb_sound_w(machine->device("custom"), 0x14,0x77); | |
| 396 | 396 | |
| 397 | 397 | /* Enable BIOS rom if we have one */ |
| 398 | 398 | gb_rom16_0000( machine, gb_driver_data.ROMMap[gb_driver_data.ROMBank00] ? gb_driver_data.ROMMap[gb_driver_data.ROMBank00] : gb_driver_data.gb_dummy_rom_bank ); |
| r8453 | r8454 | |
| 419 | 419 | /* Allocate memory for internal ram */ |
| 420 | 420 | for( ii = 0; ii < 8; ii++ ) |
| 421 | 421 | { |
| 422 | gb_driver_data.GBC_RAMMap[ii] = messram_get_ptr( | |
| 422 | gb_driver_data.GBC_RAMMap[ii] = messram_get_ptr(m | |
| 423 | 423 | memset (gb_driver_data.GBC_RAMMap[ii], 0, 0x1000); |
| 424 | 424 | } |
| 425 | 425 | } |
| r8453 | r8454 | |
| 433 | 433 | /* NOTE: The reason we save the carts RAM this way instead of using MAME's |
| 434 | 434 | built in macros is because they force the filename to be the name of |
| 435 | 435 | the machine. We need to have a separate name for each game. */ |
| 436 | device_image_interface *image = dynamic_cast<device_image_interface *>( | |
| 436 | device_image_interface *image = dynamic_cast<device_image_interface *>(m | |
| 437 | 437 | image->battery_save(gb_driver_data.gb_cart_ram, gb_driver_data.RAMBanks * 0x2000); |
| 438 | 438 | } |
| 439 | 439 | |
| r8453 | r8454 | |
| 891 | 891 | break; |
| 892 | 892 | case 0x0F: /* IF - Interrupt flag */ |
| 893 | 893 | data &= 0x1F; |
| 894 | cpu_set_reg( | |
| 894 | cpu_set_reg( | |
| 895 | 895 | break; |
| 896 | 896 | } |
| 897 | 897 | |
| r8453 | r8454 | |
| 1446 | 1446 | /* Interrupt Enable register */ |
| 1447 | 1447 | READ8_HANDLER( gb_ie_r ) |
| 1448 | 1448 | { |
| 1449 | return cpu_get_reg( | |
| 1449 | return cpu_get_reg( | |
| 1450 | 1450 | } |
| 1451 | 1451 | |
| 1452 | 1452 | WRITE8_HANDLER ( gb_ie_w ) |
| 1453 | 1453 | { |
| 1454 | cpu_set_reg( | |
| 1454 | cpu_set_reg( | |
| 1455 | 1455 | } |
| 1456 | 1456 | |
| 1457 | 1457 | /* IO read */ |
| r8453 | r8454 | |
| 1471 | 1471 | return gb_driver_data.gb_io[offset]; |
| 1472 | 1472 | case 0x0F: |
| 1473 | 1473 | /* Make sure the internal states are up to date */ |
| 1474 | return 0xE0 | cpu_get_reg( | |
| 1474 | return 0xE0 | cpu_get_reg( | |
| 1475 | 1475 | default: |
| 1476 | 1476 | /* It seems unsupported registers return 0xFF */ |
| 1477 | 1477 | return 0xFF; |
| r8453 | r8454 | |
| 2024 | 2024 | switch( offset ) |
| 2025 | 2025 | { |
| 2026 | 2026 | case 0x0D: /* KEY1 - Prepare speed switch */ |
| 2027 | cpu_set_reg( | |
| 2027 | cpu_set_reg( | |
| 2028 | 2028 | return; |
| 2029 | 2029 | case 0x10: /* BFF - Bios disable */ |
| 2030 | 2030 | gb_rom16_0000( space->machine, gb_driver_data.ROMMap[gb_driver_data.ROMBank00] ); |
| r8453 | r8454 | |
| 2048 | 2048 | switch( offset ) |
| 2049 | 2049 | { |
| 2050 | 2050 | case 0x0D: /* KEY1 */ |
| 2051 | return cpu_get_reg( | |
| 2051 | return cpu_get_reg( | |
| 2052 | 2052 | case 0x16: /* RP - Infrared port */ |
| 2053 | 2053 | break; |
| 2054 | 2054 | case 0x30: /* SVBK - RAM bank select */ |
| r8453 | r8454 | |
| 2151 | 2151 | |
| 2152 | 2152 | WRITE8_HANDLER( megaduck_sound_w1 ) |
| 2153 | 2153 | { |
| 2154 | gb_sound_w( | |
| 2154 | gb_sound_w( | |
| 2155 | 2155 | } |
| 2156 | 2156 | |
| 2157 | 2157 | READ8_HANDLER( megaduck_sound_r1 ) |
| 2158 | 2158 | { |
| 2159 | return gb_sound_r( | |
| 2159 | return gb_sound_r( | |
| 2160 | 2160 | } |
| 2161 | 2161 | |
| 2162 | 2162 | WRITE8_HANDLER( megaduck_sound_w2 ) |
| 2163 | 2163 | { |
| 2164 | 2164 | switch(offset) |
| 2165 | 2165 | { |
| 2166 | case 0x00: gb_sound_w(devtag_get_device(space->machine, "custom"), 0x10, data ); break; | |
| 2167 | case 0x01: gb_sound_w(devtag_get_device(space->machine, "custom"), 0x12, data ); break; | |
| 2168 | case 0x02: gb_sound_w(devtag_get_device(space->machine, "custom"), 0x11, data ); break; | |
| 2169 | case 0x03: gb_sound_w(devtag_get_device(space->machine, "custom"), 0x13, data ); break; | |
| 2170 | case 0x04: gb_sound_w(devtag_get_device(space->machine, "custom"), 0x14, data ); break; | |
| 2171 | case 0x05: gb_sound_w(devtag_get_device(space->machine, "custom"), 0x16, data ); break; | |
| 2172 | case 0x06: gb_sound_w(devtag_get_device(space->machine, "custom"), 0x15, data ); break; | |
| 2166 | case 0x00: gb_sound_w(space->machine->device("custom"), 0x10, data ); break; | |
| 2167 | case 0x01: gb_sound_w(space->machine->device("custom"), 0x12, data ); break; | |
| 2168 | case 0x02: gb_sound_w(space->machine->device("custom"), 0x11, data ); break; | |
| 2169 | case 0x03: gb_sound_w(space->machine->device("custom"), 0x13, data ); break; | |
| 2170 | case 0x04: gb_sound_w(space->machine->device("custom"), 0x14, data ); break; | |
| 2171 | case 0x05: gb_sound_w(space->machine->device("custom"), 0x16, data ); break; | |
| 2172 | case 0x06: gb_sound_w(space->machine->device("custom"), 0x15, data ); break; | |
| 2173 | 2173 | case 0x07: |
| 2174 | 2174 | case 0x08: |
| 2175 | 2175 | case 0x09: |
| r8453 | r8454 | |
| 2185 | 2185 | |
| 2186 | 2186 | READ8_HANDLER( megaduck_sound_r2 ) |
| 2187 | 2187 | { |
| 2188 | return gb_sound_r( | |
| 2188 | return gb_sound_r( | |
| 2189 | 2189 | } |
| 2190 | 2190 | |
| 2191 | 2191 | WRITE8_HANDLER( megaduck_rom_bank_select_type1 ) |
| r8453 | r8454 | |
|---|---|---|
| 342 | 342 | hdc.w[7] = w7_idle; |
| 343 | 343 | |
| 344 | 344 | /* get references to harddisk devices */ |
| 345 | hdc.d[0].img = dynamic_cast<device_image_interface *>(devtag_get_device(machine, "harddisk1")); | |
| 346 | hdc.d[1].img = dynamic_cast<device_image_interface *>(devtag_get_device(machine, "harddisk2")); | |
| 347 | hdc.d[2].img = dynamic_cast<device_image_interface *>(devtag_get_device(machine, "harddisk3")); | |
| 348 | hdc.d[3].img = dynamic_cast<device_image_interface *>(devtag_get_device(machine, "harddisk4")); | |
| 345 | hdc.d[0].img = dynamic_cast<device_image_interface *>(machine->device("harddisk1")); | |
| 346 | hdc.d[1].img = dynamic_cast<device_image_interface *>(machine->device("harddisk2")); | |
| 347 | hdc.d[2].img = dynamic_cast<device_image_interface *>(machine->device("harddisk3")); | |
| 348 | hdc.d[3].img = dynamic_cast<device_image_interface *>(machine->device("harddisk4")); | |
| 349 | 349 | |
| 350 | 350 | hdc.interrupt_callback = interrupt_callback; |
| 351 | 351 |
| r8453 | r8454 | |
|---|---|---|
| 85 | 85 | |
| 86 | 86 | static void set_all_geometries(running_machine *machine, floppy_type_t type) |
| 87 | 87 | { |
| 88 | set_geometry(devtag_get_device(machine, FLOPPY_0), type); | |
| 89 | set_geometry(devtag_get_device(machine, FLOPPY_1), type); | |
| 90 | set_geometry(devtag_get_device(machine, FLOPPY_2), type); | |
| 91 | set_geometry(devtag_get_device(machine, FLOPPY_3), type); | |
| 88 | set_geometry(machine->device(FLOPPY_0), type); | |
| 89 | set_geometry(machine->device(FLOPPY_1), type); | |
| 90 | set_geometry(machine->device(FLOPPY_2), type); | |
| 91 | set_geometry(machine->device(FLOPPY_3), type); | |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /* |
| r8453 | r8454 | |
| 161 | 161 | void ti99_floppy_controllers_init_all(running_machine *machine) |
| 162 | 162 | { |
| 163 | 163 | motor_on_timer = timer_alloc(machine, motor_on_timer_callback, NULL); |
| 164 | expansion_box = | |
| 164 | expansion_box = m | |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /*===========================================================================*/ |
| r8453 | r8454 | |
| 192 | 192 | */ |
| 193 | 193 | void ti99_fdc_reset(running_machine *machine) |
| 194 | 194 | { |
| 195 | running_device *fdc = | |
| 195 | running_device *fdc = m | |
| 196 | 196 | ti99_disk_DSR = memory_region(machine, region_dsr) + offset_fdc_dsr; |
| 197 | 197 | DSEL = 0; |
| 198 | 198 | DSKnum = -1; |
| r8453 | r8454 | |
| 251 | 251 | */ |
| 252 | 252 | static void fdc_cru_w(running_machine *machine, int offset, int data) |
| 253 | 253 | { |
| 254 | running_device *fdc = | |
| 254 | running_device *fdc = m | |
| 255 | 255 | |
| 256 | 256 | switch (offset) |
| 257 | 257 | { |
| r8453 | r8454 | |
| 331 | 331 | */ |
| 332 | 332 | static READ8_HANDLER(fdc_mem_r) |
| 333 | 333 | { |
| 334 | running_device *fdc = | |
| 334 | running_device *fdc = | |
| 335 | 335 | |
| 336 | 336 | /* only use the even addresses from 1ff0 to 1ff6. |
| 337 | 337 | Note that data is inverted. */ |
| r8453 | r8454 | |
| 346 | 346 | */ |
| 347 | 347 | static WRITE8_HANDLER(fdc_mem_w) |
| 348 | 348 | { |
| 349 | running_device *fdc = | |
| 349 | running_device *fdc = | |
| 350 | 350 | |
| 351 | 351 | /* only use the even addresses from 1ff8 to 1ffe. |
| 352 | 352 | Note that data is inverted. */ |
| r8453 | r8454 | |
| 385 | 385 | #if HAS_99CCFDC |
| 386 | 386 | void ti99_ccfdc_reset(running_machine *machine) |
| 387 | 387 | { |
| 388 | running_device *fdc = | |
| 388 | running_device *fdc = m | |
| 389 | 389 | |
| 390 | 390 | ti99_disk_DSR = memory_region(machine, region_dsr) + offset_ccfdc_dsr; |
| 391 | 391 | DSEL = 0; |
| r8453 | r8454 | |
| 441 | 441 | */ |
| 442 | 442 | static void ccfdc_cru_w(running_machine *machine, int offset, int data) |
| 443 | 443 | { |
| 444 | running_device *fdc = | |
| 444 | running_device *fdc = m | |
| 445 | 445 | |
| 446 | 446 | switch (offset) |
| 447 | 447 | { |
| r8453 | r8454 | |
| 602 | 602 | */ |
| 603 | 603 | void ti99_bwg_reset(running_machine *machine) |
| 604 | 604 | { |
| 605 | running_device *fdc = | |
| 605 | running_device *fdc = m | |
| 606 | 606 | |
| 607 | 607 | ti99_disk_DSR = memory_region(machine, region_dsr) + offset_bwg_dsr; |
| 608 | 608 | bwg_ram = memory_region(machine, region_dsr) + offset_bwg_ram; |
| r8453 | r8454 | |
| 661 | 661 | */ |
| 662 | 662 | static void bwg_cru_w(running_machine *machine, int offset, int data) |
| 663 | 663 | { |
| 664 | running_device *fdc = | |
| 664 | running_device *fdc = m | |
| 665 | 665 | |
| 666 | 666 | switch (offset) |
| 667 | 667 | { |
| r8453 | r8454 | |
| 778 | 778 | */ |
| 779 | 779 | static READ8_HANDLER(bwg_mem_r) |
| 780 | 780 | { |
| 781 | running_device *fdc = | |
| 781 | running_device *fdc = | |
| 782 | 782 | |
| 783 | 783 | int reply = 0; |
| 784 | 784 | |
| r8453 | r8454 | |
| 789 | 789 | else if (bwg_rtc_enable) |
| 790 | 790 | { |
| 791 | 791 | if (! (offset & 1)) |
| 792 | reply = mm58274c_r( | |
| 792 | reply = mm58274c_r( | |
| 793 | 793 | } |
| 794 | 794 | else |
| 795 | 795 | { |
| r8453 | r8454 | |
| 823 | 823 | */ |
| 824 | 824 | static WRITE8_HANDLER(bwg_mem_w) |
| 825 | 825 | { |
| 826 | running_device *fdc = | |
| 826 | running_device *fdc = | |
| 827 | 827 | |
| 828 | 828 | if (offset < 0x1c00) |
| 829 | 829 | ; |
| r8453 | r8454 | |
| 832 | 832 | else if (bwg_rtc_enable) |
| 833 | 833 | { |
| 834 | 834 | if (! (offset & 1)) |
| 835 | mm58274c_w( | |
| 835 | mm58274c_w( | |
| 836 | 836 | } |
| 837 | 837 | else |
| 838 | 838 | { |
| r8453 | r8454 | |
| 1144 | 1144 | */ |
| 1145 | 1145 | void ti99_hfdc_reset(running_machine *machine) |
| 1146 | 1146 | { |
| 1147 | running_device *device = | |
| 1147 | running_device *device = m | |
| 1148 | 1148 | const char *flopname[] = {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3}; |
| 1149 | 1149 | const char *hardname[] = {MFMHD_0, MFMHD_1, MFMHD_2}; |
| 1150 | 1150 | |
| r8453 | r8454 | |
| 1188 | 1188 | floppy_unit[i] = device->owner()->subdevice(flopname[i]); |
| 1189 | 1189 | if (floppy_unit[i]==NULL) |
| 1190 | 1190 | { |
| 1191 | floppy_unit[i] = dev | |
| 1191 | floppy_unit[i] = dev | |
| 1192 | 1192 | } |
| 1193 | 1193 | } |
| 1194 | 1194 | else |
| 1195 | 1195 | { |
| 1196 | floppy_unit[i] = dev | |
| 1196 | floppy_unit[i] = dev | |
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | 1199 | if (floppy_unit[i]!=NULL) |
| r8453 | r8454 | |
| 1211 | 1211 | /* In the HFDC ROM, WDSx selects drive x; drive 0 is not used */ |
| 1212 | 1212 | for (i = 1; i < 4; i++) |
| 1213 | 1213 | { |
| 1214 | harddisk_unit[i] = dev | |
| 1214 | harddisk_unit[i] = dev | |
| 1215 | 1215 | } |
| 1216 | 1216 | harddisk_unit[0] = NULL; |
| 1217 | 1217 | |
| r8453 | r8454 | |
| 1349 | 1349 | /* reset fdc (active low) */ |
| 1350 | 1350 | if (!data) |
| 1351 | 1351 | { |
| 1352 | running_device *device = | |
| 1352 | running_device *device = m | |
| 1353 | 1353 | smc92x4_reset(device); |
| 1354 | 1354 | } |
| 1355 | 1355 | break; |
| r8453 | r8454 | |
| 1427 | 1427 | */ |
| 1428 | 1428 | static READ8_HANDLER(hfdc_mem_r) |
| 1429 | 1429 | { |
| 1430 | running_device *device = | |
| 1430 | running_device *device = | |
| 1431 | 1431 | |
| 1432 | 1432 | if (offset >= 0x0000 && offset <= 0x0fbf) |
| 1433 | 1433 | { |
| r8453 | r8454 | |
| 1460 | 1460 | /* Real-time clock. Again, ignore odd addresses. */ |
| 1461 | 1461 | if ((offset & 1) == 0) |
| 1462 | 1462 | { |
| 1463 | running_device *clock = | |
| 1463 | running_device *clock = | |
| 1464 | 1464 | return mm58274c_r(clock, (offset - 0x0fe0) >> 1); |
| 1465 | 1465 | } |
| 1466 | 1466 | else return 0; |
| r8453 | r8454 | |
| 1484 | 1484 | */ |
| 1485 | 1485 | static WRITE8_HANDLER(hfdc_mem_w) |
| 1486 | 1486 | { |
| 1487 | running_device *diskcnt = | |
| 1487 | running_device *diskcnt = | |
| 1488 | 1488 | |
| 1489 | 1489 | if (offset >= 0x0000 && offset <= 0x0fbf) |
| 1490 | 1490 | { |
| r8453 | r8454 | |
| 1515 | 1515 | /* Real-time clock. Again, ignore odd addresses. */ |
| 1516 | 1516 | if ((offset & 1) == 0) |
| 1517 | 1517 | { |
| 1518 | running_device *clock = | |
| 1518 | running_device *clock = | |
| 1519 | 1519 | mm58274c_w(clock, (offset - 0x0fe0) >> 1, data); |
| 1520 | 1520 | } |
| 1521 | 1521 | return; |
| r8453 | r8454 | |
|---|---|---|
| 693 | 693 | |
| 694 | 694 | DRIVER_INIT( gamecom ) |
| 695 | 695 | { |
| 696 | gamecom_cpu = | |
| 696 | gamecom_cpu = m | |
| 697 | 697 | gamecom_iram = sm8500_get_internal_ram(machine->device<legacy_cpu_device>("maincpu")); |
| 698 | 698 | gamecom_clock_timer = timer_alloc(machine, gamecom_clock_timer_callback , NULL); |
| 699 | 699 | } |
| r8453 | r8454 | |
|---|---|---|
| 110 | 110 | |
| 111 | 111 | static void update_dac(running_machine *machine) |
| 112 | 112 | { |
| 113 | running_device *dac_device = | |
| 113 | running_device *dac_device = m | |
| 114 | 114 | advision_state *state = (advision_state *)machine->driver_data; |
| 115 | 115 | |
| 116 | 116 | if (state->sound_g == 0 && state->sound_d == 0) |
| r8453 | r8454 | |
|---|---|---|
| 59 | 59 | |
| 60 | 60 | static READ8_DEVICE_HANDLER (radio86_8255_portc_r2 ) |
| 61 | 61 | { |
| 62 | double level = cassette_input(dev | |
| 62 | double level = cassette_input(dev | |
| 63 | 63 | UINT8 dat = input_port_read(device->machine, "LINE8"); |
| 64 | 64 | if (level < 0) { |
| 65 | 65 | dat ^= radio86_tape_value; |
| r8453 | r8454 | |
| 74 | 74 | |
| 75 | 75 | static WRITE8_DEVICE_HANDLER (radio86_8255_portc_w2 ) |
| 76 | 76 | { |
| 77 | cassette_output(dev | |
| 77 | cassette_output(dev | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | |
| r8453 | r8454 | |
| 102 | 102 | |
| 103 | 103 | static READ8_DEVICE_HANDLER (rk7007_8255_portc_r ) |
| 104 | 104 | { |
| 105 | double level = cassette_input(dev | |
| 105 | double level = cassette_input(dev | |
| 106 | 106 | UINT8 key = 0xff; |
| 107 | 107 | if ((radio86_keyboard_mask & 0x01)!=0) { key &= input_port_read(device->machine,"CLINE0"); } |
| 108 | 108 | if ((radio86_keyboard_mask & 0x02)!=0) { key &= input_port_read(device->machine,"CLINE1"); } |
| r8453 | r8454 | |
|---|---|---|
| 56 | 56 | case 1 : |
| 57 | 57 | memory_unmap_write(space, 0xe000, 0xffff, 0, 0); |
| 58 | 58 | |
| 59 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 60 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2800); | |
| 61 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x3000); | |
| 62 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x7000); | |
| 59 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram"))); | |
| 60 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0x2800); | |
| 61 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x3000); | |
| 62 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x7000); | |
| 63 | 63 | memory_set_bankptr(machine, "bank5", rom + 0x10000); |
| 64 | 64 | break; |
| 65 | 65 | #if 0 |
| r8453 | r8454 | |
| 67 | 67 | memory_unmap_write(space, 0x3000, 0x6fff, 0, 0); |
| 68 | 68 | memory_unmap_write(space, 0xe000, 0xffff, 0, 0); |
| 69 | 69 | |
| 70 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 71 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2800); | |
| 70 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram"))); | |
| 71 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0x2800); | |
| 72 | 72 | memory_set_bankptr(machine, "bank3", rom + 0x12000); |
| 73 | 73 | memory_set_bankptr(machine, "bank4", rom + 0x16000); |
| 74 | 74 | memory_set_bankptr(machine, "bank5", rom + 0x10000); |
| r8453 | r8454 | |
| 78 | 78 | memory_unmap_write(space, 0x2800, 0x2fff, 0, 0); |
| 79 | 79 | memory_unmap_write(space, 0xe000, 0xffff, 0, 0); |
| 80 | 80 | |
| 81 | memory_set_bankptr(machine, "bank1", messram_get_ptr( | |
| 81 | memory_set_bankptr(machine, "bank1", messram_get_ptr(m | |
| 82 | 82 | memory_install_read8_handler(space, 0x2800, 0x2fff, 0, 0, b2m_keyboard_r); |
| 83 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x10000); | |
| 84 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x7000); | |
| 83 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x10000); | |
| 84 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x7000); | |
| 85 | 85 | memory_set_bankptr(machine, "bank5", rom + 0x10000); |
| 86 | 86 | break; |
| 87 | 87 | case 3 : |
| 88 | 88 | memory_unmap_write(space, 0x2800, 0x2fff, 0, 0); |
| 89 | 89 | memory_unmap_write(space, 0xe000, 0xffff, 0, 0); |
| 90 | 90 | |
| 91 | memory_set_bankptr(machine, "bank1", messram_get_ptr( | |
| 91 | memory_set_bankptr(machine, "bank1", messram_get_ptr(m | |
| 92 | 92 | memory_install_read8_handler(space, 0x2800, 0x2fff, 0, 0, b2m_keyboard_r); |
| 93 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x14000); | |
| 94 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x7000); | |
| 93 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x14000); | |
| 94 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x7000); | |
| 95 | 95 | memory_set_bankptr(machine, "bank5", rom + 0x10000); |
| 96 | 96 | break; |
| 97 | 97 | case 4 : |
| 98 | 98 | memory_unmap_write(space, 0x2800, 0x2fff, 0, 0); |
| 99 | 99 | memory_unmap_write(space, 0xe000, 0xffff, 0, 0); |
| 100 | 100 | |
| 101 | memory_set_bankptr(machine, "bank1", messram_get_ptr( | |
| 101 | memory_set_bankptr(machine, "bank1", messram_get_ptr(m | |
| 102 | 102 | memory_install_read8_handler(space, 0x2800, 0x2fff, 0, 0, b2m_keyboard_r); |
| 103 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x18000); | |
| 104 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x7000); | |
| 103 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x18000); | |
| 104 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x7000); | |
| 105 | 105 | memory_set_bankptr(machine, "bank5", rom + 0x10000); |
| 106 | 106 | |
| 107 | 107 | break; |
| r8453 | r8454 | |
| 109 | 109 | memory_unmap_write(space, 0x2800, 0x2fff, 0, 0); |
| 110 | 110 | memory_unmap_write(space, 0xe000, 0xffff, 0, 0); |
| 111 | 111 | |
| 112 | memory_set_bankptr(machine, "bank1", messram_get_ptr( | |
| 112 | memory_set_bankptr(machine, "bank1", messram_get_ptr(m | |
| 113 | 113 | memory_install_read8_handler(space, 0x2800, 0x2fff, 0, 0, b2m_keyboard_r); |
| 114 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x1c000); | |
| 115 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x7000); | |
| 114 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x1c000); | |
| 115 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x7000); | |
| 116 | 116 | memory_set_bankptr(machine, "bank5", rom + 0x10000); |
| 117 | 117 | |
| 118 | 118 | break; |
| 119 | 119 | case 6 : |
| 120 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 121 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2800); | |
| 122 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x3000); | |
| 123 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x7000); | |
| 124 | memory_set_bankptr(machine, "bank5", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xe000); | |
| 120 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram"))); | |
| 121 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0x2800); | |
| 122 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x3000); | |
| 123 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x7000); | |
| 124 | memory_set_bankptr(machine, "bank5", messram_get_ptr(machine->device("messram")) + 0xe000); | |
| 125 | 125 | break; |
| 126 | 126 | case 7 : |
| 127 | 127 | memory_unmap_write(space, 0x0000, 0x27ff, 0, 0); |
| r8453 | r8454 | |
| 319 | 319 | MACHINE_START(b2m) |
| 320 | 320 | { |
| 321 | 321 | b2m_state *state = (b2m_state *)machine->driver_data; |
| 322 | state->pic = devtag_get_device(machine, "pic8259"); | |
| 323 | state->fdc = devtag_get_device(machine, "wd1793"); | |
| 324 | state->speaker = devtag_get_device(machine, "speaker"); | |
| 322 | state->pic = machine->device("pic8259"); | |
| 323 | state->fdc = machine->device("wd1793"); | |
| 324 | state->speaker = machine->device("speaker"); | |
| 325 | 325 | |
| 326 | 326 | wd17xx_set_pause_time(state->fdc,10); |
| 327 | 327 | |
| r8453 | r8454 | |
| 366 | 366 | state->b2m_side = 0; |
| 367 | 367 | state->b2m_drive = 0; |
| 368 | 368 | |
| 369 | cpu_set_irq_callback( | |
| 369 | cpu_set_irq_callback(m | |
| 370 | 370 | b2m_set_bank(machine, 7); |
| 371 | 371 | } |
| r8453 | r8454 | |
|---|---|---|
| 74 | 74 | |
| 75 | 75 | static void aim65_pia(running_machine *machine) |
| 76 | 76 | { |
| 77 | dl1416_update(devtag_get_device(machine, "ds1"), 0); | |
| 78 | dl1416_update(devtag_get_device(machine, "ds2"), 1); | |
| 79 | dl1416_update(devtag_get_device(machine, "ds3"), 2); | |
| 80 | dl1416_update(devtag_get_device(machine, "ds4"), 3); | |
| 81 | dl1416_update(devtag_get_device(machine, "ds5"), 4); | |
| 77 | dl1416_update(machine->device("ds1"), 0); | |
| 78 | dl1416_update(machine->device("ds2"), 1); | |
| 79 | dl1416_update(machine->device("ds3"), 2); | |
| 80 | dl1416_update(machine->device("ds4"), 3); | |
| 81 | dl1416_update(machine->device("ds5"), 4); | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | |
| r8453 | r8454 | |
| 168 | 168 | |
| 169 | 169 | MACHINE_START( aim65 ) |
| 170 | 170 | { |
| 171 | running_device *via_0 = devtag_get_device(machine, "via6522_0"); | |
| 172 | running_device *ram = devtag_get_device(machine, "messram"); | |
| 171 | running_device *via_0 = machine->device("via6522_0"); | |
| 172 | running_device *ram = machine->device("messram"); | |
| 173 | 173 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 174 | 174 | |
| 175 | 175 | /* Init RAM */ |
| r8453 | r8454 | |
|---|---|---|
| 47 | 47 | /********************* common cassette code ***************************/ |
| 48 | 48 | |
| 49 | 49 | INLINE running_device* thom_cassette_img( running_machine *machine ) |
| 50 | { return | |
| 50 | { return m | |
| 51 | 51 | |
| 52 | 52 | /*-------------- TO7 ------------*/ |
| 53 | 53 | |
| r8453 | r8454 | |
| 103 | 103 | if ( bitpos >= to7_k7_bitsize ) |
| 104 | 104 | bitpos = to7_k7_bitsize -1; |
| 105 | 105 | VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i\n", |
| 106 | cpu_get_previouspc( | |
| 106 | cpu_get_previouspc(m | |
| 107 | 107 | to7_k7_bits[ bitpos ] )); |
| 108 | 108 | return to7_k7_bits[ bitpos ]; |
| 109 | 109 | } |
| r8453 | r8454 | |
| 124 | 124 | } |
| 125 | 125 | k = ( chg >= 13 ) ? 1 : 0; |
| 126 | 126 | VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i (%i)\n", |
| 127 | cpu_get_previouspc( | |
| 127 | cpu_get_previouspc(m | |
| 128 | 128 | k, chg )); |
| 129 | 129 | return k; |
| 130 | 130 | } |
| r8453 | r8454 | |
| 152 | 152 | double pos = cassette_get_position(img); |
| 153 | 153 | |
| 154 | 154 | LOG (( "$%04x %f to7_set_cassette_motor: cassette motor %s bitpos=%i\n", |
| 155 | cpu_get_previouspc(dev | |
| 155 | cpu_get_previouspc(dev | |
| 156 | 156 | (int) (pos / TO7_BIT_LENGTH) )); |
| 157 | 157 | |
| 158 | 158 | if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !data && pos > 0.3 ) |
| r8453 | r8454 | |
| 203 | 203 | hbit = hbit >= 0; |
| 204 | 204 | |
| 205 | 205 | VLOG (( "$%04x %f mo5_get_cassette: state=$%X pos=%f hbitpos=%i hbit=%i\n", |
| 206 | cpu_get_previouspc( | |
| 206 | cpu_get_previouspc(m | |
| 207 | 207 | (int) (pos / MO5_HBIT_LENGTH), hbit )); |
| 208 | 208 | return hbit; |
| 209 | 209 | } |
| r8453 | r8454 | |
| 228 | 228 | double pos = cassette_get_position(img); |
| 229 | 229 | |
| 230 | 230 | LOG (( "$%04x %f mo5_set_cassette_motor: cassette motor %s hbitpos=%i\n", |
| 231 | cpu_get_previouspc(dev | |
| 231 | cpu_get_previouspc(dev | |
| 232 | 232 | (int) (pos / MO5_HBIT_LENGTH) )); |
| 233 | 233 | |
| 234 | 234 | if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !data && pos > 0.3 ) |
| r8453 | r8454 | |
| 394 | 394 | |
| 395 | 395 | static DEVICE_START( thom_serial_rf57232 ) |
| 396 | 396 | { |
| 397 | running_device *acia = dev | |
| 397 | running_device *acia = dev | |
| 398 | 398 | DEVICE_START_CALL(serial); |
| 399 | 399 | LOG(( "thom_serial_init: init RF 57-232 RS232 device\n" )); |
| 400 | 400 | acia_6551_connect_to_serial_device( acia, device ); |
| r8453 | r8454 | |
| 596 | 596 | |
| 597 | 597 | static WRITE8_DEVICE_HANDLER ( to7_timer_cp2_out ) |
| 598 | 598 | { |
| 599 | dac_data_w( dev | |
| 599 | dac_data_w( dev | |
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | |
| r8453 | r8454 | |
| 639 | 639 | |
| 640 | 640 | static void to7_lightpen_cb ( running_machine *machine, int step ) |
| 641 | 641 | { |
| 642 | running_device *sys_pia = | |
| 642 | running_device *sys_pia = m | |
| 643 | 643 | |
| 644 | 644 | if ( ! to7_lightpen ) |
| 645 | 645 | return; |
| r8453 | r8454 | |
| 658 | 658 | |
| 659 | 659 | static void to7_set_init ( running_machine *machine, int init ) |
| 660 | 660 | { |
| 661 | running_device *sys_pia = | |
| 661 | running_device *sys_pia = m | |
| 662 | 662 | /* INIT signal wired to system PIA 6821 */ |
| 663 | 663 | |
| 664 | 664 | LOG_VIDEO(( "%f to7_set_init: init=%i\n", attotime_to_double(timer_get_time(machine)), init )); |
| r8453 | r8454 | |
| 770 | 770 | */ |
| 771 | 771 | static to7_io_dev to7_io_mode( running_machine *machine ) |
| 772 | 772 | { |
| 773 | running_device *centronics = devtag_get_device(machine, "centronics"); | |
| 774 | device_image_interface *serial = dynamic_cast<device_image_interface *>(devtag_get_device(machine, "cc90232")); | |
| 773 | running_device *centronics = machine->device("centronics"); | |
| 774 | device_image_interface *serial = dynamic_cast<device_image_interface *>(machine->device("cc90232")); | |
| 775 | 775 | |
| 776 | 776 | if (centronics_pe_r(centronics) == TRUE) |
| 777 | 777 | return TO7_IO_CENTRONICS; |
| r8453 | r8454 | |
| 784 | 784 | |
| 785 | 785 | static WRITE_LINE_DEVICE_HANDLER( to7_io_ack ) |
| 786 | 786 | { |
| 787 | running_device *io_pia = dev | |
| 787 | running_device *io_pia = dev | |
| 788 | 788 | |
| 789 | 789 | pia6821_cb1_w( io_pia, 0, state); |
| 790 | 790 | //LOG_IO (( "%f to7_io_ack: CENTRONICS new state $%02X (ack=%i)\n", attotime_to_double(timer_get_time(machine)), data, ack )); |
| r8453 | r8454 | |
| 797 | 797 | int tx = data & 1; |
| 798 | 798 | int dtr = ( data & 2 ) ? 1 : 0; |
| 799 | 799 | |
| 800 | LOG_IO(( "$%04x %f to7_io_porta_out: tx=%i, dtr=%i\n", cpu_get_previouspc(dev | |
| 800 | LOG_IO(( "$%04x %f to7_io_porta_out: tx=%i, dtr=%i\n", cpu_get_previouspc(dev | |
| 801 | 801 | if ( dtr ) |
| 802 | 802 | to7_io_line.State |= SERIAL_STATE_DTR; |
| 803 | 803 | else |
| r8453 | r8454 | |
| 811 | 811 | |
| 812 | 812 | static READ8_DEVICE_HANDLER( to7_io_porta_in ) |
| 813 | 813 | { |
| 814 | running_device *printer = dev | |
| 814 | running_device *printer = dev | |
| 815 | 815 | int cts = 1; |
| 816 | 816 | int dsr = ( to7_io_line.input_state & SERIAL_STATE_DSR ) ? 0 : 1; |
| 817 | 817 | int rd = get_in_data_bit( to7_io_line.input_state ); |
| r8453 | r8454 | |
| 821 | 821 | else |
| 822 | 822 | cts = !centronics_busy_r(printer); |
| 823 | 823 | |
| 824 | LOG_IO(( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", cpu_get_previouspc(dev | |
| 824 | LOG_IO(( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", cpu_get_previouspc(dev | |
| 825 | 825 | |
| 826 | 826 | return (dsr ? 0x20 : 0) | (cts ? 0x40 : 0) | (rd ? 0x80: 0); |
| 827 | 827 | } |
| r8453 | r8454 | |
| 830 | 830 | |
| 831 | 831 | static WRITE8_DEVICE_HANDLER( to7_io_portb_out ) |
| 832 | 832 | { |
| 833 | running_device *printer = dev | |
| 833 | running_device *printer = dev | |
| 834 | 834 | |
| 835 | LOG_IO(( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc(dev | |
| 835 | LOG_IO(( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc(dev | |
| 836 | 836 | |
| 837 | 837 | /* set 8-bit data */ |
| 838 | 838 | centronics_data_w(printer, 0, data); |
| r8453 | r8454 | |
| 842 | 842 | |
| 843 | 843 | static WRITE8_DEVICE_HANDLER( to7_io_cb2_out ) |
| 844 | 844 | { |
| 845 | running_device *printer = dev | |
| 845 | running_device *printer = dev | |
| 846 | 846 | |
| 847 | LOG_IO(( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc(dev | |
| 847 | LOG_IO(( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc(dev | |
| 848 | 848 | |
| 849 | 849 | /* send STROBE to printer */ |
| 850 | 850 | centronics_strobe_w(printer, data); |
| r8453 | r8454 | |
| 890 | 890 | |
| 891 | 891 | static void to7_io_reset( running_machine *machine ) |
| 892 | 892 | { |
| 893 | running_device *io_pia = | |
| 893 | running_device *io_pia = m | |
| 894 | 894 | |
| 895 | 895 | LOG (( "to7_io_reset called\n" )); |
| 896 | 896 | |
| r8453 | r8454 | |
| 1018 | 1018 | { |
| 1019 | 1019 | if ( input_port_read(space->machine, "mconfig") & 1 ) |
| 1020 | 1020 | { |
| 1021 | running_device* device = | |
| 1021 | running_device* device = | |
| 1022 | 1022 | return mea8000_r( device, offset ); |
| 1023 | 1023 | } |
| 1024 | 1024 | else |
| 1025 | 1025 | { |
| 1026 | running_device* device = | |
| 1026 | running_device* device = | |
| 1027 | 1027 | switch (offset) { |
| 1028 | 1028 | case 0: return acia6850_stat_r( device, offset ); |
| 1029 | 1029 | case 1: return acia6850_data_r( device, offset ); |
| r8453 | r8454 | |
| 1038 | 1038 | { |
| 1039 | 1039 | if ( input_port_read(space->machine, "mconfig") & 1 ) |
| 1040 | 1040 | { |
| 1041 | running_device* device = | |
| 1041 | running_device* device = | |
| 1042 | 1042 | mea8000_w( device, offset, data ); |
| 1043 | 1043 | } |
| 1044 | 1044 | else |
| 1045 | 1045 | { |
| 1046 | running_device* device = | |
| 1046 | running_device* device = | |
| 1047 | 1047 | switch (offset) { |
| 1048 | 1048 | case 0: acia6850_ctrl_w( device, offset, data ); |
| 1049 | 1049 | case 1: acia6850_data_w( device, offset, data ); |
| r8453 | r8454 | |
| 1101 | 1101 | |
| 1102 | 1102 | static void to7_game_sound_update ( running_machine *machine ) |
| 1103 | 1103 | { |
| 1104 | dac_data_w( | |
| 1104 | dac_data_w( m | |
| 1105 | 1105 | } |
| 1106 | 1106 | |
| 1107 | 1107 | |
| r8453 | r8454 | |
| 1212 | 1212 | /* this should be called periodically */ |
| 1213 | 1213 | static TIMER_CALLBACK(to7_game_update_cb) |
| 1214 | 1214 | { |
| 1215 | running_device *game_pia = | |
| 1215 | running_device *game_pia = m | |
| 1216 | 1216 | |
| 1217 | 1217 | if ( input_port_read(machine, "config") & 1 ) |
| 1218 | 1218 | { |
| r8453 | r8454 | |
| 1256 | 1256 | |
| 1257 | 1257 | static void to7_game_reset ( running_machine *machine ) |
| 1258 | 1258 | { |
| 1259 | running_device *game_pia = | |
| 1259 | running_device *game_pia = m | |
| 1260 | 1260 | |
| 1261 | 1261 | LOG (( "to7_game_reset called\n" )); |
| 1262 | 1262 | pia6821_ca1_w( game_pia, 0, 0 ); |
| r8453 | r8454 | |
| 1355 | 1355 | /* bit 6: parity error (ignored) */ |
| 1356 | 1356 | /* bit 7: interrupt */ |
| 1357 | 1357 | LOG_MIDI(( "$%04x %f to7_midi_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, irq=%i)\n", |
| 1358 | cpu_get_previouspc( | |
| 1358 | cpu_get_previouspc( | |
| 1359 | 1359 | (to7_midi_status & ACIA_6850_RDRF) ? 1 : 0, |
| 1360 | 1360 | (to7_midi_status & ACIA_6850_TDRE) ? 1 : 0, |
| 1361 | 1361 | (to7_midi_status & ACIA_6850_OVRN) ? 1 : 0, |
| r8453 | r8454 | |
| 1373 | 1373 | to7_midi_status &= ~ACIA_6850_OVRN; |
| 1374 | 1374 | to7_midi_overrun = 0; |
| 1375 | 1375 | LOG_MIDI(( "$%04x %f to7_midi_r: read data $%02X\n", |
| 1376 | cpu_get_previouspc( | |
| 1376 | cpu_get_previouspc( | |
| 1377 | 1377 | to7_midi_update_irq( space->machine ); |
| 1378 | 1378 | return data; |
| 1379 | 1379 | } |
| r8453 | r8454 | |
| 1381 | 1381 | |
| 1382 | 1382 | default: |
| 1383 | 1383 | logerror( "$%04x to7_midi_r: invalid offset %i\n", |
| 1384 | cpu_get_previouspc( | |
| 1384 | cpu_get_previouspc( | |
| 1385 | 1385 | return 0; |
| 1386 | 1386 | } |
| 1387 | 1387 | } |
| r8453 | r8454 | |
| 1400 | 1400 | if ( (data & 3) == 3 ) |
| 1401 | 1401 | { |
| 1402 | 1402 | /* reset */ |
| 1403 | LOG_MIDI(( "$%04x %f to7_midi_w: reset (data=$%02X)\n", cpu_get_previouspc( | |
| 1403 | LOG_MIDI(( "$%04x %f to7_midi_w: reset (data=$%02X)\n", cpu_get_previouspc( | |
| 1404 | 1404 | to7_midi_overrun = 0; |
| 1405 | 1405 | to7_midi_status = 2; |
| 1406 | 1406 | to7_midi_intr = 0; |
| r8453 | r8454 | |
| 1417 | 1417 | static const int stop[8] = { 2,2,1,1,2,1,1,1 }; |
| 1418 | 1418 | static const char parity[8] = { 'e','o','e','o','-','-','e','o' }; |
| 1419 | 1419 | LOG_MIDI(( "$%04x %f to7_midi_w: set control to $%02X (bits=%i, stop=%i, parity=%c, intr in=%i out=%i)\n", |
| 1420 | cpu_get_previouspc( | |
| 1420 | cpu_get_previouspc( | |
| 1421 | 1421 | data, |
| 1422 | 1422 | bits[ (data >> 2) & 7 ], |
| 1423 | 1423 | stop[ (data >> 2) & 7 ], |
| r8453 | r8454 | |
| 1431 | 1431 | |
| 1432 | 1432 | |
| 1433 | 1433 | case 1: /* output data */ |
| 1434 | LOG_MIDI(( "$%04x %f to7_midi_w: write data $%02X\n", cpu_get_previouspc( | |
| 1434 | LOG_MIDI(( "$%04x %f to7_midi_w: write data $%02X\n", cpu_get_previouspc( | |
| 1435 | 1435 | if ( data == 0x55 ) |
| 1436 | 1436 | /* cable-detect: shortcut */ |
| 1437 | 1437 | chardev_fake_in( to7_midi_chardev, 0x55 ); |
| r8453 | r8454 | |
| 1445 | 1445 | |
| 1446 | 1446 | |
| 1447 | 1447 | default: |
| 1448 | logerror( "$%04x to7_midi_w: invalid offset %i (data=$%02X) \n", cpu_get_previouspc( | |
| 1448 | logerror( "$%04x to7_midi_w: invalid offset %i (data=$%02X) \n", cpu_get_previouspc( | |
| 1449 | 1449 | } |
| 1450 | 1450 | } |
| 1451 | 1451 | |
| r8453 | r8454 | |
| 1524 | 1524 | |
| 1525 | 1525 | MACHINE_RESET ( to7 ) |
| 1526 | 1526 | { |
| 1527 | running_device *sys_pia = | |
| 1527 | running_device *sys_pia = m | |
| 1528 | 1528 | |
| 1529 | 1529 | LOG (( "to7: machine reset called\n" )); |
| 1530 | 1530 | |
| r8453 | r8454 | |
| 1572 | 1572 | |
| 1573 | 1573 | /* memory */ |
| 1574 | 1574 | thom_cart_bank = 0; |
| 1575 | thom_vram = messram_get_ptr(devtag_get_device(machine, "messram")); | |
| 1576 | memory_configure_bank( machine, THOM_BASE_BANK, 0, 1, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000, 0x2000 ); | |
| 1575 | thom_vram = messram_get_ptr(machine->device("messram")); | |
| 1576 | memory_configure_bank( machine, THOM_BASE_BANK, 0, 1, messram_get_ptr(machine->device("messram")) + 0x4000, 0x2000 ); | |
| 1577 | 1577 | memory_configure_bank( machine, THOM_VRAM_BANK, 0, 2, thom_vram, 0x2000 ); |
| 1578 | 1578 | memory_configure_bank( machine, THOM_CART_BANK, 0, 4, mem + 0x10000, 0x4000 ); |
| 1579 | 1579 | memory_set_bank( machine, THOM_BASE_BANK, 0 ); |
| 1580 | 1580 | memory_set_bank( machine, THOM_VRAM_BANK, 0 ); |
| 1581 | 1581 | memory_set_bank( machine, THOM_CART_BANK, 0 ); |
| 1582 | 1582 | |
| 1583 | if ( messram_get_size( | |
| 1583 | if ( messram_get_size(m | |
| 1584 | 1584 | { |
| 1585 | 1585 | /* install 16 KB or 16 KB + 8 KB memory extensions */ |
| 1586 | 1586 | /* BASIC instruction to see free memory: ?FRE(0) */ |
| 1587 | int extram = messram_get_size( | |
| 1587 | int extram = messram_get_size(m | |
| 1588 | 1588 | memory_install_write_bank(space, 0x8000, 0x8000 + extram - 1, 0, 0, THOM_RAM_BANK); |
| 1589 | 1589 | memory_install_read_bank(space, 0x8000, 0x8000 + extram - 1, 0, 0, THOM_RAM_BANK ); |
| 1590 | memory_configure_bank( machine, THOM_RAM_BANK, 0, 1, messram_get_ptr( | |
| 1590 | memory_configure_bank( machine, THOM_RAM_BANK, 0, 1, messram_get_ptr(m | |
| 1591 | 1591 | memory_set_bank( machine, THOM_RAM_BANK, 0 ); |
| 1592 | 1592 | } |
| 1593 | 1593 | |
| r8453 | r8454 | |
| 1616 | 1616 | static WRITE8_DEVICE_HANDLER ( to770_sys_cb2_out ) |
| 1617 | 1617 | { |
| 1618 | 1618 | /* video overlay: black pixels are transparent and show TV image underneath */ |
| 1619 | LOG(( "$%04x to770_sys_cb2_out: video overlay %i\n", cpu_get_previouspc(dev | |
| 1619 | LOG(( "$%04x to770_sys_cb2_out: video overlay %i\n", cpu_get_previouspc(dev | |
| 1620 | 1620 | } |
| 1621 | 1621 | |
| 1622 | 1622 | |
| r8453 | r8454 | |
| 1637 | 1637 | |
| 1638 | 1638 | static void to770_update_ram_bank(running_machine *machine) |
| 1639 | 1639 | { |
| 1640 | running_device *sys_pia = | |
| 1640 | running_device *sys_pia = m | |
| 1641 | 1641 | const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 1642 | 1642 | UINT8 portb = pia6821_get_port_b_z_mask( sys_pia ); |
| 1643 | 1643 | int bank; |
| r8453 | r8454 | |
| 1665 | 1665 | if ( bank != old_ram_bank ) |
| 1666 | 1666 | LOG_BANK(( "to770_update_ram_bank: RAM bank change %i\n", bank )); |
| 1667 | 1667 | |
| 1668 | if ( messram_get_size( | |
| 1668 | if ( messram_get_size(m | |
| 1669 | 1669 | { |
| 1670 | 1670 | memory_set_bank( machine, THOM_RAM_BANK, bank ); |
| 1671 | 1671 | memory_install_write_bank(space, 0xa000, 0xdfff, 0, 0, THOM_RAM_BANK); |
| r8453 | r8454 | |
| 1759 | 1759 | case 2: return (lt3 << 7) | (inil << 6); |
| 1760 | 1760 | case 3: return (init << 7); |
| 1761 | 1761 | default: |
| 1762 | logerror( "$%04x to770_gatearray_r: invalid offset %i\n", cpu_get_previouspc( | |
| 1762 | logerror( "$%04x to770_gatearray_r: invalid offset %i\n", cpu_get_previouspc( | |
| 1763 | 1763 | return 0; |
| 1764 | 1764 | } |
| 1765 | 1765 | } |
| r8453 | r8454 | |
| 1780 | 1780 | |
| 1781 | 1781 | MACHINE_RESET( to770 ) |
| 1782 | 1782 | { |
| 1783 | running_device *sys_pia = | |
| 1783 | running_device *sys_pia = m | |
| 1784 | 1784 | |
| 1785 | 1785 | LOG (( "to770: machine reset called\n" )); |
| 1786 | 1786 | |
| r8453 | r8454 | |
| 1829 | 1829 | |
| 1830 | 1830 | /* memory */ |
| 1831 | 1831 | thom_cart_bank = 0; |
| 1832 | thom_vram = messram_get_ptr(devtag_get_device(machine, "messram")); | |
| 1833 | memory_configure_bank( machine, THOM_BASE_BANK, 0, 1, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000, 0x4000 ); | |
| 1834 | memory_configure_bank( machine, THOM_RAM_BANK, 0, 6, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x8000, 0x4000 ); | |
| 1832 | thom_vram = messram_get_ptr(machine->device("messram")); | |
| 1833 | memory_configure_bank( machine, THOM_BASE_BANK, 0, 1, messram_get_ptr(machine->device("messram")) + 0x4000, 0x4000 ); | |
| 1834 | memory_configure_bank( machine, THOM_RAM_BANK, 0, 6, messram_get_ptr(machine->device("messram")) + 0x8000, 0x4000 ); | |
| 1835 | 1835 | memory_configure_bank( machine, THOM_VRAM_BANK, 0, 2, thom_vram, 0x2000 ); |
| 1836 | 1836 | memory_configure_bank( machine, THOM_CART_BANK, 0, 4, mem + 0x10000, 0x4000 ); |
| 1837 | 1837 | memory_set_bank( machine, THOM_BASE_BANK, 0 ); |
| r8453 | r8454 | |
| 1861 | 1861 | |
| 1862 | 1862 | static void mo5_lightpen_cb ( running_machine *machine, int step ) |
| 1863 | 1863 | { |
| 1864 | running_device *sys_pia = | |
| 1864 | running_device *sys_pia = m | |
| 1865 | 1865 | |
| 1866 | 1866 | /* MO5 signals ca1 (TO7 signals cb1) */ |
| 1867 | 1867 | if ( ! to7_lightpen ) |
| r8453 | r8454 | |
| 1887 | 1887 | |
| 1888 | 1888 | static TIMER_CALLBACK(mo5_periodic_cb) |
| 1889 | 1889 | { |
| 1890 | running_device *sys_pia = | |
| 1890 | running_device *sys_pia = m | |
| 1891 | 1891 | |
| 1892 | 1892 | /* pulse */ |
| 1893 | 1893 | pia6821_cb1_w( sys_pia, 0, 1 ); |
| r8453 | r8454 | |
| 1929 | 1929 | |
| 1930 | 1930 | static WRITE8_DEVICE_HANDLER ( mo5_sys_portb_out ) |
| 1931 | 1931 | { |
| 1932 | dac_data_w( dev | |
| 1932 | dac_data_w( dev | |
| 1933 | 1933 | } |
| 1934 | 1934 | |
| 1935 | 1935 | |
| r8453 | r8454 | |
| 1991 | 1991 | case 2: return (lt3 << 7) | (inil << 6); |
| 1992 | 1992 | case 3: return (init << 7); |
| 1993 | 1993 | default: |
| 1994 | logerror( "$%04x mo5_gatearray_r: invalid offset %i\n", cpu_get_previouspc( | |
| 1994 | logerror( "$%04x mo5_gatearray_r: invalid offset %i\n", cpu_get_previouspc( | |
| 1995 | 1995 | return 0; |
| 1996 | 1996 | } |
| 1997 | 1997 | } |
| r8453 | r8454 | |
| 2153 | 2153 | |
| 2154 | 2154 | MACHINE_RESET( mo5 ) |
| 2155 | 2155 | { |
| 2156 | running_device *sys_pia = | |
| 2156 | running_device *sys_pia = m | |
| 2157 | 2157 | |
| 2158 | 2158 | LOG (( "mo5: machine reset called\n" )); |
| 2159 | 2159 | |
| r8453 | r8454 | |
| 2204 | 2204 | /* memory */ |
| 2205 | 2205 | thom_cart_bank = 0; |
| 2206 | 2206 | mo5_reg_cart = 0; |
| 2207 | thom_vram = messram_get_ptr(devtag_get_device(machine, "messram")); | |
| 2208 | memory_configure_bank( machine, THOM_BASE_BANK, 0, 1, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000, 0x8000 ); | |
| 2207 | thom_vram = messram_get_ptr(machine->device("messram")); | |
| 2208 | memory_configure_bank( machine, THOM_BASE_BANK, 0, 1, messram_get_ptr(machine->device("messram")) + 0x4000, 0x8000 ); | |
| 2209 | 2209 | memory_configure_bank( machine, THOM_CART_BANK, 0, 4, mem + 0x10000, 0x4000 ); |
| 2210 | memory_configure_bank( machine, THOM_CART_BANK, 4, 4, messram_get_ptr( | |
| 2210 | memory_configure_bank( machine, THOM_CART_BANK, 4, 4, messram_get_ptr(m | |
| 2211 | 2211 | memory_configure_bank( machine, THOM_VRAM_BANK, 0, 2, thom_vram, 0x2000 ); |
| 2212 | 2212 | memory_set_bank( machine, THOM_BASE_BANK, 0 ); |
| 2213 | 2213 | memory_set_bank( machine, THOM_CART_BANK, 0 ); |
| r8453 | r8454 | |
| 2239 | 2239 | |
| 2240 | 2240 | WRITE8_HANDLER ( to9_ieee_w ) |
| 2241 | 2241 | { |
| 2242 | logerror( "$%04x %f to9_ieee_w: unhandled write $%02X to register %i\n", cpu_get_previouspc( | |
| 2242 | logerror( "$%04x %f to9_ieee_w: unhandled write $%02X to register %i\n", cpu_get_previouspc( | |
| 2243 | 2243 | } |
| 2244 | 2244 | |
| 2245 | 2245 | |
| 2246 | 2246 | |
| 2247 | 2247 | READ8_HANDLER ( to9_ieee_r ) |
| 2248 | 2248 | { |
| 2249 | logerror( "$%04x %f to9_ieee_r: unhandled read from register %i\n", cpu_get_previouspc( | |
| 2249 | logerror( "$%04x %f to9_ieee_r: unhandled read from register %i\n", cpu_get_previouspc( | |
| 2250 | 2250 | return 0; |
| 2251 | 2251 | } |
| 2252 | 2252 | |
| r8453 | r8454 | |
| 2277 | 2277 | case 2: return (lt3 << 7) | (inil << 6); |
| 2278 | 2278 | case 3: return (v.init << 7) | (init << 6); /* != TO7/70 */ |
| 2279 | 2279 | default: |
| 2280 | logerror( "$%04x to9_gatearray_r: invalid offset %i\n", cpu_get_previouspc( | |
| 2280 | logerror( "$%04x to9_gatearray_r: invalid offset %i\n", cpu_get_previouspc( | |
| 2281 | 2281 | return 0; |
| 2282 | 2282 | } |
| 2283 | 2283 | } |
| r8453 | r8454 | |
| 2372 | 2372 | |
| 2373 | 2373 | WRITE8_HANDLER ( to9_vreg_w ) |
| 2374 | 2374 | { |
| 2375 | LOG_VIDEO(( "$%04x %f to9_vreg_w: off=%i ($%04X) data=$%02X\n", cpu_get_previouspc( | |
| 2375 | LOG_VIDEO(( "$%04x %f to9_vreg_w: off=%i ($%04X) data=$%02X\n", cpu_get_previouspc( | |
| 2376 | 2376 | |
| 2377 | 2377 | switch ( offset ) |
| 2378 | 2378 | { |
| r8453 | r8454 | |
| 2429 | 2429 | { |
| 2430 | 2430 | const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 2431 | 2431 | int bank = 0; |
| 2432 | int slot = ( mc6846_get_output_port( | |
| 2432 | int slot = ( mc6846_get_output_port(m | |
| 2433 | 2433 | |
| 2434 | 2434 | /* reset cartridge read handler */ |
| 2435 | 2435 | memory_install_read_bank( space, 0x0000, 0x0003, 0, 0, THOM_CART_BANK ); |
| r8453 | r8454 | |
| 2482 | 2482 | /* write signal to 0000-1fff generates a bank switch */ |
| 2483 | 2483 | WRITE8_HANDLER ( to9_cartridge_w ) |
| 2484 | 2484 | { |
| 2485 | int slot = ( mc6846_get_output_port( | |
| 2485 | int slot = ( mc6846_get_output_port( | |
| 2486 | 2486 | |
| 2487 | 2487 | if ( offset >= 0x2000 ) |
| 2488 | 2488 | return; |
| r8453 | r8454 | |
| 2510 | 2510 | |
| 2511 | 2511 | static void to9_update_ram_bank (running_machine *machine) |
| 2512 | 2512 | { |
| 2513 | running_device *sys_pia = | |
| 2513 | running_device *sys_pia = m | |
| 2514 | 2514 | const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 2515 | UINT8 port = mc6846_get_output_port( | |
| 2515 | UINT8 port = mc6846_get_output_port(m | |
| 2516 | 2516 | UINT8 portb = pia6821_get_port_b_z_mask( sys_pia ); |
| 2517 | 2517 | UINT8 disk = ((port >> 2) & 1) | ((port >> 5) & 2); /* bits 6,2: RAM bank */ |
| 2518 | 2518 | int bank; |
| r8453 | r8454 | |
| 2541 | 2541 | if ( old_ram_bank != bank ) |
| 2542 | 2542 | LOG_BANK(( "to9_update_ram_bank: bank %i selected (pia=$%02X disk=%i)\n", bank, portb & 0xf8, disk )); |
| 2543 | 2543 | |
| 2544 | if ( messram_get_size( | |
| 2544 | if ( messram_get_size(m | |
| 2545 | 2545 | { |
| 2546 | 2546 | memory_set_bank( machine, THOM_RAM_BANK, bank ); |
| 2547 | 2547 | memory_install_write_bank( space, 0xa000, 0xdfff, 0, 0, THOM_RAM_BANK); |
| r8453 | r8454 | |
| 2670 | 2670 | /* bit 7: interrupt */ |
| 2671 | 2671 | |
| 2672 | 2672 | LOG_KBD(( "$%04x %f to9_kbd_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, pe=%i, irq=%i)\n", |
| 2673 | cpu_get_previouspc( | |
| 2673 | cpu_get_previouspc( | |
| 2674 | 2674 | (to9_kbd_status & ACIA_6850_RDRF) ? 1 : 0, |
| 2675 | 2675 | (to9_kbd_status & ACIA_6850_TDRE) ? 1 : 0, |
| 2676 | 2676 | (to9_kbd_status & ACIA_6850_OVRN) ? 1 : 0, |
| r8453 | r8454 | |
| 2685 | 2685 | else |
| 2686 | 2686 | to9_kbd_status &= ~(ACIA_6850_OVRN | ACIA_6850_RDRF); |
| 2687 | 2687 | to9_kbd_overrun = 0; |
| 2688 | LOG_KBD(( "$%04x %f to9_kbd_r: read data $%02X\n", cpu_get_previouspc( | |
| 2688 | LOG_KBD(( "$%04x %f to9_kbd_r: read data $%02X\n", cpu_get_previouspc( | |
| 2689 | 2689 | to9_kbd_update_irq(space->machine); |
| 2690 | 2690 | return to9_kbd_in; |
| 2691 | 2691 | |
| 2692 | 2692 | default: |
| 2693 | logerror( "$%04x to9_kbd_r: invalid offset %i\n", cpu_get_previouspc( | |
| 2693 | logerror( "$%04x to9_kbd_r: invalid offset %i\n", cpu_get_previouspc( | |
| 2694 | 2694 | return 0; |
| 2695 | 2695 | } |
| 2696 | 2696 | } |
| r8453 | r8454 | |
| 2712 | 2712 | to9_kbd_overrun = 0; |
| 2713 | 2713 | to9_kbd_status = ACIA_6850_TDRE; |
| 2714 | 2714 | to9_kbd_intr = 0; |
| 2715 | LOG_KBD(( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", cpu_get_previouspc( | |
| 2715 | LOG_KBD(( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", cpu_get_previouspc( | |
| 2716 | 2716 | } |
| 2717 | 2717 | else |
| 2718 | 2718 | { |
| r8453 | r8454 | |
| 2726 | 2726 | to9_kbd_intr = data >> 5; |
| 2727 | 2727 | |
| 2728 | 2728 | LOG_KBD(( "$%04x %f to9_kbd_w: set control to $%02X (parity=%i, intr in=%i out=%i)\n", |
| 2729 | cpu_get_previouspc( | |
| 2729 | cpu_get_previouspc( | |
| 2730 | 2730 | data, to9_kbd_parity, to9_kbd_intr >> 2, |
| 2731 | 2731 | (to9_kbd_intr & 3) ? 1 : 0 )); |
| 2732 | 2732 | } |
| r8453 | r8454 | |
| 2757 | 2757 | case 0xFE: to9_kbd_periph = 0; break; |
| 2758 | 2758 | |
| 2759 | 2759 | default: |
| 2760 | logerror( "$%04x %f to9_kbd_w: unknown kbd command %02X\n", cpu_get_previouspc( | |
| 2760 | logerror( "$%04x %f to9_kbd_w: unknown kbd command %02X\n", cpu_get_previouspc( | |
| 2761 | 2761 | } |
| 2762 | 2762 | |
| 2763 | 2763 | thom_set_caps_led( space->machine, !to9_kbd_caps ); |
| 2764 | 2764 | |
| 2765 | 2765 | LOG(( "$%04x %f to9_kbd_w: kbd command %02X (caps=%i, pad=%i, periph=%i)\n", |
| 2766 | cpu_get_previouspc( | |
| 2766 | cpu_get_previouspc( | |
| 2767 | 2767 | to9_kbd_caps, to9_kbd_pad, to9_kbd_periph )); |
| 2768 | 2768 | |
| 2769 | 2769 | break; |
| 2770 | 2770 | |
| 2771 | 2771 | default: |
| 2772 | logerror( "$%04x to9_kbd_w: invalid offset %i (data=$%02X) \n", cpu_get_previouspc( | |
| 2772 | logerror( "$%04x to9_kbd_w: invalid offset %i (data=$%02X) \n", cpu_get_previouspc( | |
| 2773 | 2773 | } |
| 2774 | 2774 | } |
| 2775 | 2775 | |
| r8453 | r8454 | |
| 3047 | 3047 | |
| 3048 | 3048 | static WRITE8_DEVICE_HANDLER ( to9_sys_porta_out ) |
| 3049 | 3049 | { |
| 3050 | running_device *printer = dev | |
| 3050 | running_device *printer = dev | |
| 3051 | 3051 | centronics_data_w(printer, 0, data & 0xfe); |
| 3052 | 3052 | } |
| 3053 | 3053 | |
| r8453 | r8454 | |
| 3055 | 3055 | |
| 3056 | 3056 | static WRITE8_DEVICE_HANDLER ( to9_sys_portb_out ) |
| 3057 | 3057 | { |
| 3058 | running_device *printer = dev | |
| 3058 | running_device *printer = dev | |
| 3059 | 3059 | |
| 3060 | 3060 | centronics_d0_w(printer, BIT(data, 0)); |
| 3061 | 3061 | centronics_strobe_w(printer, BIT(data, 1)); |
| r8453 | r8454 | |
| 3116 | 3116 | |
| 3117 | 3117 | MACHINE_RESET ( to9 ) |
| 3118 | 3118 | { |
| 3119 | running_device *sys_pia = | |
| 3119 | running_device *sys_pia = m | |
| 3120 | 3120 | |
| 3121 | 3121 | LOG (( "to9: machine reset called\n" )); |
| 3122 | 3122 | |
| r8453 | r8454 | |
| 3166 | 3166 | to7_midi_init(machine); |
| 3167 | 3167 | |
| 3168 | 3168 | /* memory */ |
| 3169 | thom_vram = messram_get_ptr( | |
| 3169 | thom_vram = messram_get_ptr(m | |
| 3170 | 3170 | thom_cart_bank = 0; |
| 3171 | 3171 | memory_configure_bank( machine, THOM_VRAM_BANK, 0, 2, thom_vram, 0x2000 ); |
| 3172 | 3172 | memory_configure_bank( machine, THOM_CART_BANK, 0, 12, mem + 0x10000, 0x4000 ); |
| 3173 | memory_configure_bank( machine, THOM_BASE_BANK, 0, 1, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000, 0x4000 ); | |
| 3174 | memory_configure_bank( machine, THOM_RAM_BANK, 0, 10, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x8000, 0x4000 ); | |
| 3173 | memory_configure_bank( machine, THOM_BASE_BANK, 0, 1, messram_get_ptr(machine->device("messram")) + 0x4000, 0x4000 ); | |
| 3174 | memory_configure_bank( machine, THOM_RAM_BANK, 0, 10, messram_get_ptr(machine->device("messram")) + 0x8000, 0x4000 ); | |
| 3175 | 3175 | memory_set_bank( machine, THOM_VRAM_BANK, 0 ); |
| 3176 | 3176 | memory_set_bank( machine, THOM_CART_BANK, 0 ); |
| 3177 | 3177 | memory_set_bank( machine, THOM_BASE_BANK, 0 ); |
| r8453 | r8454 | |
| 3367 | 3367 | (helps avoiding CPU lock) |
| 3368 | 3368 | */ |
| 3369 | 3369 | if ( ! to8_kbd_ack ) |
| 3370 | mc6846_set_input_cp1( devtag_get_device(machine, "mc6846"), 0 ); | |
| 3371 | mc6846_set_input_cp1( devtag_get_device(machine, "mc6846"), 1 ); | |
| 3370 | mc6846_set_input_cp1( machine->device("mc6846"), 0 ); | |
| 3371 | mc6846_set_input_cp1( machine->device("mc6846"), 1 ); | |
| 3372 | 3372 | |
| 3373 | 3373 | if ( k == -1 ) |
| 3374 | 3374 | d = TO8_KBD_POLL_PERIOD; |
| r8453 | r8454 | |
| 3387 | 3387 | to8_kbd_last_key = 0xff; |
| 3388 | 3388 | to8_kbd_key_count = 0; |
| 3389 | 3389 | to8_kbd_step = 0; |
| 3390 | mc6846_set_input_cp1( | |
| 3390 | mc6846_set_input_cp1( m | |
| 3391 | 3391 | d = TO8_KBD_POLL_PERIOD; |
| 3392 | 3392 | } |
| 3393 | 3393 | else if ( to8_kbd_step == 1 ) |
| 3394 | 3394 | { |
| 3395 | 3395 | /* schedule timeout waiting for ack to go down */ |
| 3396 | mc6846_set_input_cp1( | |
| 3396 | mc6846_set_input_cp1( m | |
| 3397 | 3397 | to8_kbd_step = 255; |
| 3398 | 3398 | d = TO8_KBD_TIMEOUT; |
| 3399 | 3399 | } |
| 3400 | 3400 | else if ( to8_kbd_step == 117 ) |
| 3401 | 3401 | { |
| 3402 | 3402 | /* schedule timeout waiting for ack to go up */ |
| 3403 | mc6846_set_input_cp1( | |
| 3403 | mc6846_set_input_cp1( m | |
| 3404 | 3404 | to8_kbd_step = 255; |
| 3405 | 3405 | d = TO8_KBD_TIMEOUT; |
| 3406 | 3406 | } |
| 3407 | 3407 | else if ( to8_kbd_step & 1 ) |
| 3408 | 3408 | { |
| 3409 | 3409 | /* send silence between bits */ |
| 3410 | mc6846_set_input_cp1( | |
| 3410 | mc6846_set_input_cp1( m | |
| 3411 | 3411 | d = ATTOTIME_IN_USEC( 100 ); |
| 3412 | 3412 | to8_kbd_step++; |
| 3413 | 3413 | } |
| r8453 | r8454 | |
| 3416 | 3416 | /* send bit */ |
| 3417 | 3417 | int bpos = 8 - ( (to8_kbd_step - 100) / 2); |
| 3418 | 3418 | int bit = (to8_kbd_data >> bpos) & 1; |
| 3419 | mc6846_set_input_cp1( | |
| 3419 | mc6846_set_input_cp1( m | |
| 3420 | 3420 | d = ATTOTIME_IN_USEC( bit ? 56 : 38 ); |
| 3421 | 3421 | to8_kbd_step++; |
| 3422 | 3422 | } |
| r8453 | r8454 | |
| 3568 | 3568 | |
| 3569 | 3569 | static void to8_update_ram_bank (running_machine *machine) |
| 3570 | 3570 | { |
| 3571 | running_device *sys_pia = | |
| 3571 | running_device *sys_pia = m | |
| 3572 | 3572 | const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 3573 | 3573 | UINT8 bank = 0; |
| 3574 | 3574 | |
| r8453 | r8454 | |
| 3608 | 3608 | undistorted space, such as cartridge, page 0 (video), or page 1 |
| 3609 | 3609 | */ |
| 3610 | 3610 | to8_data_vpage = bank; |
| 3611 | if ( messram_get_size( | |
| 3611 | if ( messram_get_size(m | |
| 3612 | 3612 | { |
| 3613 | 3613 | memory_set_bank( machine, TO8_DATA_LO, to8_data_vpage ); |
| 3614 | 3614 | memory_set_bank( machine, TO8_DATA_HI, to8_data_vpage ); |
| r8453 | r8454 | |
| 3650 | 3650 | /* RAM space */ |
| 3651 | 3651 | to8_cart_vpage = to8_reg_cart & 31; |
| 3652 | 3652 | bank = 8 + to8_cart_vpage; |
| 3653 | if ((to8_cart_vpage < 8 || messram_get_size( | |
| 3653 | if ((to8_cart_vpage < 8 || messram_get_size(m | |
| 3654 | 3654 | if (to8_cart_vpage <= 4) { |
| 3655 | 3655 | memory_install_write8_handler( space, 0x0000, 0x3fff, 0, 0,to8_vcart_w); |
| 3656 | 3656 | } else { |
| r8453 | r8454 | |
| 3688 | 3688 | } |
| 3689 | 3689 | } |
| 3690 | 3690 | |
| 3691 | if ( messram_get_size( | |
| 3691 | if ( messram_get_size(m | |
| 3692 | 3692 | { |
| 3693 | 3693 | memory_set_bank( machine, THOM_CART_BANK, bank ); |
| 3694 | 3694 | } |
| r8453 | r8454 | |
| 3834 | 3834 | break; |
| 3835 | 3835 | |
| 3836 | 3836 | default: |
| 3837 | logerror( "$%04x to8_gatearray_r: invalid offset %i\n", cpu_get_previouspc( | |
| 3837 | logerror( "$%04x to8_gatearray_r: invalid offset %i\n", cpu_get_previouspc( | |
| 3838 | 3838 | res = 0; |
| 3839 | 3839 | } |
| 3840 | 3840 | |
| 3841 | 3841 | LOG_VIDEO(( "$%04x %f to8_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n", |
| 3842 | cpu_get_previouspc( | |
| 3842 | cpu_get_previouspc( | |
| 3843 | 3843 | offset, 0xe7e4 + offset, res, to7_lightpen )); |
| 3844 | 3844 | |
| 3845 | 3845 | return res; |
| r8453 | r8454 | |
| 3850 | 3850 | WRITE8_HANDLER ( to8_gatearray_w ) |
| 3851 | 3851 | { |
| 3852 | 3852 | LOG_VIDEO(( "$%04x %f to8_gatearray_w: off=%i ($%04X) data=$%02X\n", |
| 3853 | cpu_get_previouspc( | |
| 3853 | cpu_get_previouspc( | |
| 3854 | 3854 | offset, 0xe7e4 + offset, data )); |
| 3855 | 3855 | |
| 3856 | 3856 | switch ( offset ) |
| r8453 | r8454 | |
| 3882 | 3882 | |
| 3883 | 3883 | default: |
| 3884 | 3884 | logerror( "$%04x to8_gatearray_w: invalid offset %i (data=$%02X)\n", |
| 3885 | cpu_get_previouspc( | |
| 3885 | cpu_get_previouspc( | |
| 3886 | 3886 | } |
| 3887 | 3887 | } |
| 3888 | 3888 | |
| r8453 | r8454 | |
| 3931 | 3931 | WRITE8_HANDLER ( to8_vreg_w ) |
| 3932 | 3932 | { |
| 3933 | 3933 | LOG_VIDEO(( "$%04x %f to8_vreg_w: off=%i ($%04X) data=$%02X\n", |
| 3934 | cpu_get_previouspc( | |
| 3934 | cpu_get_previouspc( | |
| 3935 | 3935 | offset, 0xe7da + offset, data )); |
| 3936 | 3936 | |
| 3937 | 3937 | switch ( offset ) |
| r8453 | r8454 | |
| 3987 | 3987 | { |
| 3988 | 3988 | int ktest = to8_kbd_ktest (device->machine); |
| 3989 | 3989 | |
| 3990 | LOG_KBD(( "$%04x %f: to8_sys_porta_in ktest=%i\n", cpu_get_previouspc(dev | |
| 3990 | LOG_KBD(( "$%04x %f: to8_sys_porta_in ktest=%i\n", cpu_get_previouspc(dev | |
| 3991 | 3991 | |
| 3992 | 3992 | return ktest; |
| 3993 | 3993 | } |
| r8453 | r8454 | |
| 3996 | 3996 | |
| 3997 | 3997 | static WRITE8_DEVICE_HANDLER ( to8_sys_portb_out ) |
| 3998 | 3998 | { |
| 3999 | running_device *printer = dev | |
| 3999 | running_device *printer = dev | |
| 4000 | 4000 | |
| 4001 | 4001 | centronics_d0_w(printer, BIT(data, 0)); |
| 4002 | 4002 | centronics_strobe_w(printer, BIT(data, 1)); |
| r8453 | r8454 | |
| 4033 | 4033 | |
| 4034 | 4034 | static READ8_DEVICE_HANDLER ( to8_timer_port_in ) |
| 4035 | 4035 | { |
| 4036 | running_device *printer = dev | |
| 4036 | running_device *printer = dev | |
| 4037 | 4037 | int lightpen = (input_port_read(device->machine, "lightpen_button") & 1) ? 2 : 0; |
| 4038 | 4038 | int cass = to7_get_cassette(device->machine) ? 0x80 : 0; |
| 4039 | 4039 | int dtr = centronics_busy_r(printer) << 6; |
| r8453 | r8454 | |
| 4098 | 4098 | |
| 4099 | 4099 | MACHINE_RESET ( to8 ) |
| 4100 | 4100 | { |
| 4101 | running_device *sys_pia = | |
| 4101 | running_device *sys_pia = m | |
| 4102 | 4102 | LOG (( "to8: machine reset called\n" )); |
| 4103 | 4103 | |
| 4104 | 4104 | /* subsystems */ |
| r8453 | r8454 | |
| 4160 | 4160 | |
| 4161 | 4161 | /* memory */ |
| 4162 | 4162 | thom_cart_bank = 0; |
| 4163 | thom_vram = messram_get_ptr( | |
| 4163 | thom_vram = messram_get_ptr(m | |
| 4164 | 4164 | memory_configure_bank( machine, THOM_CART_BANK, 0, 8, mem + 0x10000, 0x4000 ); |
| 4165 | memory_configure_bank( machine, THOM_CART_BANK, 8, 32, messram_get_ptr(devtag_get_device(machine, "messram")), 0x4000 ); | |
| 4166 | memory_configure_bank( machine, THOM_VRAM_BANK, 0, 2, messram_get_ptr(devtag_get_device(machine, "messram")), 0x2000 ); | |
| 4167 | memory_configure_bank( machine, TO8_SYS_LO, 0, 1, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x6000, 0x4000 ); | |
| 4168 | memory_configure_bank( machine, TO8_SYS_HI, 0, 1, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000, 0x4000 ); | |
| 4169 | memory_configure_bank( machine, TO8_DATA_LO, 0, 32, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000, 0x4000 ); | |
| 4170 | memory_configure_bank( machine, TO8_DATA_HI, 0, 32, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x0000, 0x4000 ); | |
| 4165 | memory_configure_bank( machine, THOM_CART_BANK, 8, 32, messram_get_ptr(machine->device("messram")), 0x4000 ); | |
| 4166 | memory_configure_bank( machine, THOM_VRAM_BANK, 0, 2, messram_get_ptr(machine->device("messram")), 0x2000 ); | |
| 4167 | memory_configure_bank( machine, TO8_SYS_LO, 0, 1, messram_get_ptr(machine->device("messram")) + 0x6000, 0x4000 ); | |
| 4168 | memory_configure_bank( machine, TO8_SYS_HI, 0, 1, messram_get_ptr(machine->device("messram")) + 0x4000, 0x4000 ); | |
| 4169 | memory_configure_bank( machine, TO8_DATA_LO, 0, 32, messram_get_ptr(machine->device("messram")) + 0x2000, 0x4000 ); | |
| 4170 | memory_configure_bank( machine, TO8_DATA_HI, 0, 32, messram_get_ptr(machine->device("messram")) + 0x0000, 0x4000 ); | |
| 4171 | 4171 | memory_configure_bank( machine, TO8_BIOS_BANK, 0, 2, mem + 0x30800, 0x2000 ); |
| 4172 | 4172 | memory_set_bank( machine, THOM_CART_BANK, 0 ); |
| 4173 | 4173 | memory_set_bank( machine, THOM_VRAM_BANK, 0 ); |
| r8453 | r8454 | |
| 4232 | 4232 | |
| 4233 | 4233 | static READ8_DEVICE_HANDLER ( to9p_timer_port_in ) |
| 4234 | 4234 | { |
| 4235 | running_device *printer = dev | |
| 4235 | running_device *printer = dev | |
| 4236 | 4236 | int lightpen = (input_port_read(device->machine, "lightpen_button") & 1) ? 2 : 0; |
| 4237 | 4237 | int cass = to7_get_cassette(device->machine) ? 0x80 : 0; |
| 4238 | 4238 | int dtr = centronics_busy_r(printer) << 6; |
| r8453 | r8454 | |
| 4268 | 4268 | |
| 4269 | 4269 | MACHINE_RESET ( to9p ) |
| 4270 | 4270 | { |
| 4271 | running_device *sys_pia = | |
| 4271 | running_device *sys_pia = m | |
| 4272 | 4272 | LOG (( "to9p: machine reset called\n" )); |
| 4273 | 4273 | |
| 4274 | 4274 | /* subsystems */ |
| r8453 | r8454 | |
| 4330 | 4330 | |
| 4331 | 4331 | /* memory */ |
| 4332 | 4332 | thom_cart_bank = 0; |
| 4333 | thom_vram = messram_get_ptr( | |
| 4333 | thom_vram = messram_get_ptr(m | |
| 4334 | 4334 | memory_configure_bank( machine, THOM_CART_BANK, 0, 8, mem + 0x10000, 0x4000 ); |
| 4335 | memory_configure_bank( machine, THOM_CART_BANK, 8, 32, messram_get_ptr(devtag_get_device(machine, "messram")), 0x4000 ); | |
| 4336 | memory_configure_bank( machine, THOM_VRAM_BANK, 0, 2, messram_get_ptr(devtag_get_device(machine, "messram")), 0x2000 ); | |
| 4337 | memory_configure_bank( machine, TO8_SYS_LO, 0, 1, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x6000, 0x4000 ); | |
| 4338 | memory_configure_bank( machine, TO8_SYS_HI, 0, 1, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000, 0x4000 ); | |
| 4339 | memory_configure_bank( machine, TO8_DATA_LO, 0, 32, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000, 0x4000 ); | |
| 4340 | memory_configure_bank( machine, TO8_DATA_HI, 0, 32, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x0000, 0x4000 ); | |
| 4335 | memory_configure_bank( machine, THOM_CART_BANK, 8, 32, messram_get_ptr(machine->device("messram")), 0x4000 ); | |
| 4336 | memory_configure_bank( machine, THOM_VRAM_BANK, 0, 2, messram_get_ptr(machine->device("messram")), 0x2000 ); | |
| 4337 | memory_configure_bank( machine, TO8_SYS_LO, 0, 1, messram_get_ptr(machine->device("messram")) + 0x6000, 0x4000 ); | |
| 4338 | memory_configure_bank( machine, TO8_SYS_HI, 0, 1, messram_get_ptr(machine->device("messram")) + 0x4000, 0x4000 ); | |
| 4339 | memory_configure_bank( machine, TO8_DATA_LO, 0, 32, messram_get_ptr(machine->device("messram")) + 0x2000, 0x4000 ); | |
| 4340 | memory_configure_bank( machine, TO8_DATA_HI, 0, 32, messram_get_ptr(machine->device("messram")) + 0x0000, 0x4000 ); | |
| 4341 | 4341 | memory_configure_bank( machine, TO8_BIOS_BANK, 0, 2, mem + 0x30800, 0x2000 ); |
| 4342 | 4342 | memory_set_bank( machine, THOM_CART_BANK, 0 ); |
| 4343 | 4343 | memory_set_bank( machine, THOM_VRAM_BANK, 0 ); |
| r8453 | r8454 | |
| 4404 | 4404 | |
| 4405 | 4405 | static void mo6_update_cart_bank (running_machine *machine) |
| 4406 | 4406 | { |
| 4407 | running_device *sys_pia = | |
| 4407 | running_device *sys_pia = m | |
| 4408 | 4408 | const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 4409 | 4409 | int b = (pia6821_get_output_a( sys_pia ) >> 5) & 1; |
| 4410 | 4410 | int bank = 0; |
| r8453 | r8454 | |
| 4536 | 4536 | |
| 4537 | 4537 | static WRITE_LINE_DEVICE_HANDLER( mo6_centronics_busy ) |
| 4538 | 4538 | { |
| 4539 | running_device *game_pia = dev | |
| 4539 | running_device *game_pia = dev | |
| 4540 | 4540 | pia6821_cb1_w(game_pia, 0, state); |
| 4541 | 4541 | } |
| 4542 | 4542 | |
| r8453 | r8454 | |
| 4552 | 4552 | |
| 4553 | 4553 | static WRITE8_DEVICE_HANDLER ( mo6_game_porta_out ) |
| 4554 | 4554 | { |
| 4555 | running_device *printer = dev | |
| 4555 | running_device *printer = dev | |
| 4556 | 4556 | |
| 4557 | LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc(dev | |
| 4557 | LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc(dev | |
| 4558 | 4558 | |
| 4559 | 4559 | /* centronics data */ |
| 4560 | 4560 | centronics_data_w(printer, 0, data); |
| r8453 | r8454 | |
| 4564 | 4564 | |
| 4565 | 4565 | static WRITE8_DEVICE_HANDLER ( mo6_game_cb2_out ) |
| 4566 | 4566 | { |
| 4567 | running_device *printer = dev | |
| 4567 | running_device *printer = dev | |
| 4568 | 4568 | |
| 4569 | LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc(dev | |
| 4569 | LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc(dev | |
| 4570 | 4570 | |
| 4571 | 4571 | /* centronics strobe */ |
| 4572 | 4572 | centronics_strobe_w(printer, data); |
| r8453 | r8454 | |
| 4594 | 4594 | |
| 4595 | 4595 | static TIMER_CALLBACK(mo6_game_update_cb) |
| 4596 | 4596 | { |
| 4597 | running_device *game_pia = | |
| 4597 | running_device *game_pia = m | |
| 4598 | 4598 | |
| 4599 | 4599 | /* unlike the TO8, CB1 & CB2 are not connected to buttons */ |
| 4600 | 4600 | if ( input_port_read(machine, "config") & 1 ) |
| r8453 | r8454 | |
| 4627 | 4627 | |
| 4628 | 4628 | static void mo6_game_reset ( running_machine *machine ) |
| 4629 | 4629 | { |
| 4630 | running_device *game_pia = | |
| 4630 | running_device *game_pia = m | |
| 4631 | 4631 | LOG (( "mo6_game_reset called\n" )); |
| 4632 | 4632 | pia6821_ca1_w( game_pia, 0, 0 ); |
| 4633 | 4633 | to7_game_sound = 0; |
| r8453 | r8454 | |
| 4688 | 4688 | |
| 4689 | 4689 | static WRITE8_DEVICE_HANDLER ( mo6_sys_portb_out ) |
| 4690 | 4690 | { |
| 4691 | dac_data_w( dev | |
| 4691 | dac_data_w( dev | |
| 4692 | 4692 | } |
| 4693 | 4693 | |
| 4694 | 4694 | |
| r8453 | r8454 | |
| 4769 | 4769 | break; |
| 4770 | 4770 | |
| 4771 | 4771 | default: |
| 4772 | logerror( "$%04x mo6_gatearray_r: invalid offset %i\n", cpu_get_previouspc( | |
| 4772 | logerror( "$%04x mo6_gatearray_r: invalid offset %i\n", cpu_get_previouspc( | |
| 4773 | 4773 | res = 0; |
| 4774 | 4774 | } |
| 4775 | 4775 | |
| 4776 | 4776 | LOG_VIDEO(( "$%04x %f mo6_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n", |
| 4777 | cpu_get_previouspc( | |
| 4777 | cpu_get_previouspc( | |
| 4778 | 4778 | offset, 0xa7e4 + offset, res, to7_lightpen )); |
| 4779 | 4779 | |
| 4780 | 4780 | return res; |
| r8453 | r8454 | |
| 4785 | 4785 | WRITE8_HANDLER ( mo6_gatearray_w ) |
| 4786 | 4786 | { |
| 4787 | 4787 | LOG_VIDEO(( "$%04x %f mo6_gatearray_w: off=%i ($%04X) data=$%02X\n", |
| 4788 | cpu_get_previouspc( | |
| 4788 | cpu_get_previouspc( | |
| 4789 | 4789 | offset, 0xa7e4 + offset, data )); |
| 4790 | 4790 | |
| 4791 | 4791 | switch ( offset ) |
| r8453 | r8454 | |
| 4815 | 4815 | break; |
| 4816 | 4816 | |
| 4817 | 4817 | default: |
| 4818 | logerror( "$%04x mo6_gatearray_w: invalid offset %i (data=$%02X)\n", cpu_get_previouspc( | |
| 4818 | logerror( "$%04x mo6_gatearray_w: invalid offset %i (data=$%02X)\n", cpu_get_previouspc( | |
| 4819 | 4819 | } |
| 4820 | 4820 | } |
| 4821 | 4821 | |
| r8453 | r8454 | |
| 4852 | 4852 | WRITE8_HANDLER ( mo6_vreg_w ) |
| 4853 | 4853 | { |
| 4854 | 4854 | LOG_VIDEO(( "$%04x %f mo6_vreg_w: off=%i ($%04X) data=$%02X\n", |
| 4855 | cpu_get_previouspc( | |
| 4855 | cpu_get_previouspc( | |
| 4856 | 4856 | offset, 0xa7da + offset, data )); |
| 4857 | 4857 | |
| 4858 | 4858 | switch ( offset ) |
| r8453 | r8454 | |
| 4896 | 4896 | |
| 4897 | 4897 | MACHINE_RESET ( mo6 ) |
| 4898 | 4898 | { |
| 4899 | running_device *sys_pia = | |
| 4899 | running_device *sys_pia = m | |
| 4900 | 4900 | LOG (( "mo6: machine reset called\n" )); |
| 4901 | 4901 | |
| 4902 | 4902 | /* subsystems */ |
| r8453 | r8454 | |
| 4954 | 4954 | /* memory */ |
| 4955 | 4955 | thom_cart_bank = 0; |
| 4956 | 4956 | mo5_reg_cart = 0; |
| 4957 | thom_vram = messram_get_ptr( | |
| 4957 | thom_vram = messram_get_ptr(m | |
| 4958 | 4958 | memory_configure_bank( machine, THOM_CART_BANK, 0, 4, mem + 0x10000, 0x4000 ); |
| 4959 | 4959 | memory_configure_bank( machine, THOM_CART_BANK, 4, 2, mem + 0x1f000, 0x4000 ); |
| 4960 | 4960 | memory_configure_bank( machine, THOM_CART_BANK, 6, 2, mem + 0x28000, 0x4000 ); |
| 4961 | memory_configure_bank( machine, THOM_CART_BANK, 8, 8, messram_get_ptr(devtag_get_device(machine, "messram")), 0x4000 ); | |
| 4962 | memory_configure_bank( machine, THOM_VRAM_BANK, 0, 2, messram_get_ptr(devtag_get_device(machine, "messram")), 0x2000 ); | |
| 4963 | memory_configure_bank( machine, TO8_SYS_LO, 0, 1, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x6000, 0x4000 ); | |
| 4964 | memory_configure_bank( machine, TO8_SYS_HI, 0, 1, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000, 0x4000 ); | |
| 4965 | memory_configure_bank( machine, TO8_DATA_LO, 0, 8, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000, 0x4000 ); | |
| 4966 | memory_configure_bank( machine, TO8_DATA_HI, 0, 8, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x0000, 0x4000 ); | |
| 4961 | memory_configure_bank( machine, THOM_CART_BANK, 8, 8, messram_get_ptr(machine->device("messram")), 0x4000 ); | |
| 4962 | memory_configure_bank( machine, THOM_VRAM_BANK, 0, 2, messram_get_ptr(machine->device("messram")), 0x2000 ); | |
| 4963 | memory_configure_bank( machine, TO8_SYS_LO, 0, 1, messram_get_ptr(machine->device("messram")) + 0x6000, 0x4000 ); | |
| 4964 | memory_configure_bank( machine, TO8_SYS_HI, 0, 1, messram_get_ptr(machine->device("messram")) + 0x4000, 0x4000 ); | |
| 4965 | memory_configure_bank( machine, TO8_DATA_LO, 0, 8, messram_get_ptr(machine->device("messram")) + 0x2000, 0x4000 ); | |
| 4966 | memory_configure_bank( machine, TO8_DATA_HI, 0, 8, messram_get_ptr(machine->device("messram")) + 0x0000, 0x4000 ); | |
| 4967 | 4967 | memory_configure_bank( machine, TO8_BIOS_BANK, 0, 2, mem + 0x23000, 0x4000 ); |
| 4968 | 4968 | memory_set_bank( machine, THOM_CART_BANK, 0 ); |
| 4969 | 4969 | memory_set_bank( machine, THOM_VRAM_BANK, 0 ); |
| r8453 | r8454 | |
| 5006 | 5006 | if ( to7_controller_type ) |
| 5007 | 5007 | return to7_floppy_r ( space, offset ); |
| 5008 | 5008 | |
| 5009 | logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", cpu_get_previouspc( | |
| 5009 | logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", cpu_get_previouspc( | |
| 5010 | 5010 | |
| 5011 | 5011 | return 0; |
| 5012 | 5012 | } |
| r8453 | r8454 | |
| 5019 | 5019 | to7_floppy_w ( space, offset, data ); |
| 5020 | 5020 | else |
| 5021 | 5021 | logerror( "$%04x %f mo5nr_net_w: write $%02X to reg %i\n", |
| 5022 | cpu_get_previouspc( | |
| 5022 | cpu_get_previouspc( | |
| 5023 | 5023 | } |
| 5024 | 5024 | |
| 5025 | 5025 | |
| r8453 | r8454 | |
| 5032 | 5032 | |
| 5033 | 5033 | READ8_HANDLER( mo5nr_prn_r ) |
| 5034 | 5034 | { |
| 5035 | running_device *printer = | |
| 5035 | running_device *printer = | |
| 5036 | 5036 | UINT8 result = 0; |
| 5037 | 5037 | |
| 5038 | 5038 | result |= !centronics_busy_r(printer) << 7; |
| r8453 | r8454 | |
| 5043 | 5043 | |
| 5044 | 5044 | WRITE8_HANDLER( mo5nr_prn_w ) |
| 5045 | 5045 | { |
| 5046 | running_device *printer = | |
| 5046 | running_device *printer = | |
| 5047 | 5047 | |
| 5048 | 5048 | /* TODO: understand other bits */ |
| 5049 | 5049 | centronics_strobe_w(printer, BIT(data, 3)); |
| r8453 | r8454 | |
| 5140 | 5140 | |
| 5141 | 5141 | static void mo5nr_game_reset ( running_machine* machine ) |
| 5142 | 5142 | { |
| 5143 | running_device *game_pia = | |
| 5143 | running_device *game_pia = m | |
| 5144 | 5144 | LOG (( "mo5nr_game_reset called\n" )); |
| 5145 | 5145 | pia6821_ca1_w( game_pia, 0, 0 ); |
| 5146 | 5146 | to7_game_sound = 0; |
| r8453 | r8454 | |
| 5156 | 5156 | |
| 5157 | 5157 | MACHINE_RESET ( mo5nr ) |
| 5158 | 5158 | { |
| 5159 | running_device *sys_pia = | |
| 5159 | running_device *sys_pia = m | |
| 5160 | 5160 | LOG (( "mo5nr: machine reset called\n" )); |
| 5161 | 5161 | |
| 5162 | 5162 | /* subsystems */ |
| r8453 | r8454 | |
| 5214 | 5214 | /* memory */ |
| 5215 | 5215 | thom_cart_bank = 0; |
| 5216 | 5216 | mo5_reg_cart = 0; |
| 5217 | thom_vram = messram_get_ptr( | |
| 5217 | thom_vram = messram_get_ptr(m | |
| 5218 | 5218 | memory_configure_bank( machine, THOM_CART_BANK, 0, 4, mem + 0x10000, 0x4000 ); |
| 5219 | 5219 | memory_configure_bank( machine, THOM_CART_BANK, 4, 2, mem + 0x1f000, 0x4000 ); |
| 5220 | 5220 | memory_configure_bank( machine, THOM_CART_BANK, 6, 2, mem + 0x28000, 0x4000 ); |
| 5221 | memory_configure_bank( machine, THOM_CART_BANK, 8, 8, messram_get_ptr(devtag_get_device(machine, "messram")), 0x4000 ); | |
| 5222 | memory_configure_bank( machine, THOM_VRAM_BANK, 0, 2, messram_get_ptr(devtag_get_device(machine, "messram")), 0x2000 ); | |
| 5223 | memory_configure_bank( machine, TO8_SYS_LO, 0, 1, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x6000, 0x4000 ); | |
| 5224 | memory_configure_bank( machine, TO8_SYS_HI, 0, 1, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000, 0x4000 ); | |
| 5225 | memory_configure_bank( machine, TO8_DATA_LO, 0, 8, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000, 0x4000 ); | |
| 5226 | memory_configure_bank( machine, TO8_DATA_HI, 0, 8, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x0000, 0x4000 ); | |
| 5221 | memory_configure_bank( machine, THOM_CART_BANK, 8, 8, messram_get_ptr(machine->device("messram")), 0x4000 ); | |
| 5222 | memory_configure_bank( machine, THOM_VRAM_BANK, 0, 2, messram_get_ptr(machine->device("messram")), 0x2000 ); | |
| 5223 | memory_configure_bank( machine, TO8_SYS_LO, 0, 1, messram_get_ptr(machine->device("messram")) + 0x6000, 0x4000 ); | |
| 5224 | memory_configure_bank( machine, TO8_SYS_HI, 0, 1, messram_get_ptr(machine->device("messram")) + 0x4000, 0x4000 ); | |
| 5225 | memory_configure_bank( machine, TO8_DATA_LO, 0, 8, messram_get_ptr(machine->device("messram")) + 0x2000, 0x4000 ); | |
| 5226 | memory_configure_bank( machine, TO8_DATA_HI, 0, 8, messram_get_ptr(machine->device("messram")) + 0x0000, 0x4000 ); | |
| 5227 | 5227 | memory_configure_bank( machine, TO8_BIOS_BANK, 0, 2, mem + 0x23000, 0x4000 ); |
| 5228 | 5228 | memory_set_bank( machine, THOM_CART_BANK, 0 ); |
| 5229 | 5229 | memory_set_bank( machine, THOM_VRAM_BANK, 0 ); |
| r8453 | r8454 | |
|---|---|---|
| 55 | 55 | |
| 56 | 56 | memory_set_bankptr(machine, "bank1", mem + 0x010000); |
| 57 | 57 | memory_set_bankptr(machine, "bank3", mem + 0x010000); |
| 58 | memory_set_bankptr(machine, "bank5", messram_get_ptr( | |
| 58 | memory_set_bankptr(machine, "bank5", messram_get_ptr(m | |
| 59 | 59 | |
| 60 | 60 | memory_set_bankptr(machine, "bank6", mem + 0x010000); |
| 61 | 61 | memory_set_bankptr(machine, "bank7", mem + 0x010000); |
| 62 | memory_set_bankptr(machine, "bank8", messram_get_ptr( | |
| 62 | memory_set_bankptr(machine, "bank8", messram_get_ptr(m | |
| 63 | 63 | } |
| 64 | 64 | else |
| 65 | 65 | { |
| r8453 | r8454 | |
| 72 | 72 | memory_install_read_bank(space, 0x1000, 0x1fff, 0, 0, "bank2"); |
| 73 | 73 | memory_install_read_bank(space, 0x3000, 0x3fff, 0, 0, "bank4"); |
| 74 | 74 | |
| 75 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 76 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x1000); | |
| 77 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000); | |
| 78 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x3000); | |
| 79 | memory_set_bankptr(machine, "bank5", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 75 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram"))); | |
| 76 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0x1000); | |
| 77 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x2000); | |
| 78 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x3000); | |
| 79 | memory_set_bankptr(machine, "bank5", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | |
| r8453 | r8454 | |
| 92 | 92 | memory_unmap_write(space, 0x2000, 0x2fff, 0, 0); |
| 93 | 93 | |
| 94 | 94 | memory_set_bankptr(machine, "bank1", mem + 0x010000); |
| 95 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 95 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 96 | 96 | memory_set_bankptr(machine, "bank3", mem + 0x010000); |
| 97 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xb000); | |
| 98 | memory_set_bankptr(machine, "bank5", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xc000); | |
| 97 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0xb000); | |
| 98 | memory_set_bankptr(machine, "bank5", messram_get_ptr(machine->device("messram")) + 0xc000); | |
| 99 | 99 | memory_set_bankptr(machine, "bank6", mem + 0x010000); |
| 100 | memory_set_bankptr(machine, "bank7", messram_get_ptr( | |
| 100 | memory_set_bankptr(machine, "bank7", messram_get_ptr(m | |
| 101 | 101 | memory_set_bankptr(machine, "bank8", mem + 0x010000); |
| 102 | memory_set_bankptr(machine, "bank9", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xb000); | |
| 103 | memory_set_bankptr(machine, "bank10", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xc000); | |
| 102 | memory_set_bankptr(machine, "bank9", messram_get_ptr(machine->device("messram")) + 0xb000); | |
| 103 | memory_set_bankptr(machine, "bank10", messram_get_ptr(machine->device("messram")) + 0xc000); | |
| 104 | 104 | |
| 105 | 105 | } |
| 106 | 106 | else |
| r8453 | r8454 | |
| 108 | 108 | memory_install_write_bank(space, 0x0000, 0x0fff, 0, 0, "bank1"); |
| 109 | 109 | memory_install_write_bank(space, 0x2000, 0x2fff, 0, 0, "bank3"); |
| 110 | 110 | |
| 111 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 112 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x1000); | |
| 113 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000); | |
| 114 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x5000); | |
| 115 | memory_set_bankptr(machine, "bank5", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 111 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram"))); | |
| 112 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0x1000); | |
| 113 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x2000); | |
| 114 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x5000); | |
| 115 | memory_set_bankptr(machine, "bank5", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
| r8453 | r8454 | |
| 130 | 130 | memory_set_bankptr(machine, "bank6", mem + 0x010000); |
| 131 | 131 | memory_set_bankptr(machine, "bank7", mem + 0x010000); |
| 132 | 132 | memory_set_bankptr(machine, "bank8", mem + 0x010000); |
| 133 | memory_set_bankptr(machine, "bank9", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 134 | memory_set_bankptr(machine, "bank10", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000); | |
| 135 | memory_set_bankptr(machine, "bank11", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 136 | memory_set_bankptr(machine, "bank12", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x6000); | |
| 137 | memory_set_bankptr(machine, "bank13", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x8000); | |
| 138 | memory_set_bankptr(machine, "bank14", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xa000); | |
| 139 | memory_set_bankptr(machine, "bank15", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xc000); | |
| 140 | memory_set_bankptr(machine, "bank16", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xe000); | |
| 133 | memory_set_bankptr(machine, "bank9", messram_get_ptr(machine->device("messram"))); | |
| 134 | memory_set_bankptr(machine, "bank10", messram_get_ptr(machine->device("messram")) + 0x2000); | |
| 135 | memory_set_bankptr(machine, "bank11", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 136 | memory_set_bankptr(machine, "bank12", messram_get_ptr(machine->device("messram")) + 0x6000); | |
| 137 | memory_set_bankptr(machine, "bank13", messram_get_ptr(machine->device("messram")) + 0x8000); | |
| 138 | memory_set_bankptr(machine, "bank14", messram_get_ptr(machine->device("messram")) + 0xa000); | |
| 139 | memory_set_bankptr(machine, "bank15", messram_get_ptr(machine->device("messram")) + 0xc000); | |
| 140 | memory_set_bankptr(machine, "bank16", messram_get_ptr(machine->device("messram")) + 0xe000); | |
| 141 | 141 | } |
| 142 | 142 | else |
| 143 | 143 | { |
| 144 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 145 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000); | |
| 146 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 147 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x6000); | |
| 148 | memory_set_bankptr(machine, "bank5", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x8000); | |
| 149 | memory_set_bankptr(machine, "bank6", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xa000); | |
| 150 | memory_set_bankptr(machine, "bank7", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xc000); | |
| 151 | memory_set_bankptr(machine, "bank8", pmd853_memory_mapping ? memory_region(machine, "maincpu") + 0x010000 : messram_get_ptr(devtag_get_device(machine, "messram")) + 0xe000); | |
| 144 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram"))); | |
| 145 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0x2000); | |
| 146 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 147 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x6000); | |
| 148 | memory_set_bankptr(machine, "bank5", messram_get_ptr(machine->device("messram")) + 0x8000); | |
| 149 | memory_set_bankptr(machine, "bank6", messram_get_ptr(machine->device("messram")) + 0xa000); | |
| 150 | memory_set_bankptr(machine, "bank7", messram_get_ptr(machine->device("messram")) + 0xc000); | |
| 151 | memory_set_bankptr(machine, "bank8", pmd853_memory_mapping ? memory_region(machine, "maincpu") + 0x010000 : messram_get_ptr(machine->device("messram")) + 0xe000); | |
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | |
| r8453 | r8454 | |
| 166 | 166 | |
| 167 | 167 | memory_set_bankptr(machine, "bank1", mem + 0x010000); |
| 168 | 168 | memory_set_bankptr(machine, "bank2", mem + 0x011000); |
| 169 | memory_set_bankptr(machine, "bank4", messram_get_ptr( | |
| 169 | memory_set_bankptr(machine, "bank4", messram_get_ptr(m | |
| 170 | 170 | memory_set_bankptr(machine, "bank5", mem + 0x010000); |
| 171 | 171 | memory_set_bankptr(machine, "bank6", mem + 0x011000); |
| 172 | memory_set_bankptr(machine, "bank7", messram_get_ptr( | |
| 172 | memory_set_bankptr(machine, "bank7", messram_get_ptr(m | |
| 173 | 173 | } |
| 174 | 174 | else |
| 175 | 175 | { |
| r8453 | r8454 | |
| 177 | 177 | memory_install_write_bank(space, 0x1000, 0x33ff, 0, 0, "bank2"); |
| 178 | 178 | memory_install_write_bank(space, 0x3400, 0x3fff, 0, 0, "bank3"); |
| 179 | 179 | |
| 180 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 181 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x1000); | |
| 182 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x3400); | |
| 183 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 180 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram"))); | |
| 181 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0x1000); | |
| 182 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x3400); | |
| 183 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
| r8453 | r8454 | |
| 195 | 195 | memory_unmap_write(space, 0x0000, 0x3fff, 0, 0); |
| 196 | 196 | |
| 197 | 197 | memory_set_bankptr(machine, "bank1", mem + 0x010000); |
| 198 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 198 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 199 | 199 | memory_set_bankptr(machine, "bank3", mem + 0x010000); |
| 200 | memory_set_bankptr(machine, "bank4", messram_get_ptr( | |
| 200 | memory_set_bankptr(machine, "bank4", messram_get_ptr(m | |
| 201 | 201 | } |
| 202 | 202 | else |
| 203 | 203 | { |
| 204 | 204 | memory_install_write_bank(space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 205 | 205 | |
| 206 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 207 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 206 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram"))); | |
| 207 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 208 | 208 | } |
| 209 | 209 | } |
| 210 | 210 | |
| r8453 | r8454 | |
| 218 | 218 | memory_unmap_write(space, 0x0000, 0x3fff, 0, 0); |
| 219 | 219 | |
| 220 | 220 | memory_set_bankptr(machine, "bank1", mem + 0x010000); |
| 221 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 221 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 222 | 222 | memory_set_bankptr(machine, "bank3", mem + 0x010000); |
| 223 | memory_set_bankptr(machine, "bank4", messram_get_ptr( | |
| 223 | memory_set_bankptr(machine, "bank4", messram_get_ptr(m | |
| 224 | 224 | } |
| 225 | 225 | else |
| 226 | 226 | { |
| 227 | 227 | memory_install_write_bank(space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 228 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 229 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 228 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram"))); | |
| 229 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | |
| r8453 | r8454 | |
| 513 | 513 | switch (offset & 0x80) |
| 514 | 514 | { |
| 515 | 515 | case 0x80: /* Motherboard 8255 */ |
| 516 | return i8255a_r( | |
| 516 | return i8255a_r( | |
| 517 | 517 | } |
| 518 | 518 | break; |
| 519 | 519 | case 0x08: /* ROM module connector */ |
| r8453 | r8454 | |
| 529 | 529 | switch (offset & 0x80) |
| 530 | 530 | { |
| 531 | 531 | case 0x80: /* ROM module 8255 */ |
| 532 | return i8255a_r( | |
| 532 | return i8255a_r( | |
| 533 | 533 | } |
| 534 | 534 | } |
| 535 | 535 | break; |
| r8453 | r8454 | |
| 544 | 544 | case 0x10: /* 8251 (casette recorder, V24) */ |
| 545 | 545 | switch (offset & 0x01) |
| 546 | 546 | { |
| 547 | case 0x00: return msm8251_data_r(devtag_get_device(space->machine, "uart"), offset & 0x01); | |
| 548 | case 0x01: return msm8251_status_r(devtag_get_device(space->machine, "uart"), offset & 0x01); | |
| 547 | case 0x00: return msm8251_data_r(space->machine->device("uart"), offset & 0x01); | |
| 548 | case 0x01: return msm8251_status_r(space->machine->device("uart"), offset & 0x01); | |
| 549 | 549 | } |
| 550 | 550 | break; |
| 551 | 551 | case 0x40: /* 8255 (GPIO/0, GPIO/1) */ |
| 552 | return i8255a_r( | |
| 552 | return i8255a_r( | |
| 553 | 553 | case 0x50: /* 8253 */ |
| 554 | return pit8253_r( | |
| 554 | return pit8253_r( | |
| 555 | 555 | case 0x70: /* 8255 (IMS-2) */ |
| 556 | return i8255a_r( | |
| 556 | return i8255a_r( | |
| 557 | 557 | } |
| 558 | 558 | break; |
| 559 | 559 | case 0x80: /* external interfaces */ |
| r8453 | r8454 | |
| 580 | 580 | switch (offset & 0x80) |
| 581 | 581 | { |
| 582 | 582 | case 0x80: /* Motherboard 8255 */ |
| 583 | i8255a_w( | |
| 583 | i8255a_w( | |
| 584 | 584 | /* PMD-85.3 memory banking */ |
| 585 | 585 | if ((offset & 0x03) == 0x03) |
| 586 | 586 | { |
| r8453 | r8454 | |
| 603 | 603 | switch (offset & 0x80) |
| 604 | 604 | { |
| 605 | 605 | case 0x80: /* ROM module 8255 */ |
| 606 | i8255a_w( | |
| 606 | i8255a_w( | |
| 607 | 607 | break; |
| 608 | 608 | } |
| 609 | 609 | } |
| r8453 | r8454 | |
| 619 | 619 | case 0x10: /* 8251 (casette recorder, V24) */ |
| 620 | 620 | switch (offset & 0x01) |
| 621 | 621 | { |
| 622 | case 0x00: msm8251_data_w(devtag_get_device(space->machine, "uart"), offset & 0x01, data); break; | |
| 623 | case 0x01: msm8251_control_w(devtag_get_device(space->machine, "uart"), offset & 0x01, data); break; | |
| 622 | case 0x00: msm8251_data_w(space->machine->device("uart"), offset & 0x01, data); break; | |
| 623 | case 0x01: msm8251_control_w(space->machine->device("uart"), offset & 0x01, data); break; | |
| 624 | 624 | } |
| 625 | 625 | break; |
| 626 | 626 | case 0x40: /* 8255 (GPIO/0, GPIO/0) */ |
| 627 | i8255a_w( | |
| 627 | i8255a_w( | |
| 628 | 628 | break; |
| 629 | 629 | case 0x50: /* 8253 */ |
| 630 | pit8253_w( | |
| 630 | pit8253_w( | |
| 631 | 631 | logerror ("8253 writing. Address: %02x, Data: %02x\n", offset, data); |
| 632 | 632 | break; |
| 633 | 633 | case 0x70: /* 8255 (IMS-2) */ |
| 634 | i8255a_w( | |
| 634 | i8255a_w( | |
| 635 | 635 | break; |
| 636 | 636 | } |
| 637 | 637 | break; |
| r8453 | r8454 | |
| 665 | 665 | switch (offset & 0x80) |
| 666 | 666 | { |
| 667 | 667 | case 0x80: /* Motherboard 8255 */ |
| 668 | return i8255a_r( | |
| 668 | return i8255a_r( | |
| 669 | 669 | } |
| 670 | 670 | break; |
| 671 | 671 | } |
| r8453 | r8454 | |
| 688 | 688 | switch (offset & 0x80) |
| 689 | 689 | { |
| 690 | 690 | case 0x80: /* Motherboard 8255 */ |
| 691 | i8255a_w( | |
| 691 | i8255a_w( | |
| 692 | 692 | break; |
| 693 | 693 | } |
| 694 | 694 | break; |
| r8453 | r8454 | |
| 784 | 784 | if (!(input_port_read(machine, "DSW0") & 0x02)) /* V.24 / Tape Switch */ |
| 785 | 785 | { |
| 786 | 786 | /* tape reading */ |
| 787 | if (cassette_get_state( | |
| 787 | if (cassette_get_state(m | |
| 788 | 788 | { |
| 789 | 789 | switch (pmd85_model) |
| 790 | 790 | { |
| 791 | 791 | case PMD85_1: |
| 792 | 792 | if (clk_level_tape) |
| 793 | 793 | { |
| 794 | previous_level = (cassette_input( | |
| 794 | previous_level = (cassette_input(m | |
| 795 | 795 | clk_level_tape = 0; |
| 796 | 796 | } |
| 797 | 797 | else |
| 798 | 798 | { |
| 799 | current_level = (cassette_input( | |
| 799 | current_level = (cassette_input(m | |
| 800 | 800 | |
| 801 | 801 | if (previous_level!=current_level) |
| 802 | 802 | { |
| r8453 | r8454 | |
| 804 | 804 | |
| 805 | 805 | set_out_data_bit(pmd85_cassette_serial_connection.State, data); |
| 806 | 806 | serial_connection_out(machine, &pmd85_cassette_serial_connection); |
| 807 | msm8251_receive_clock( | |
| 807 | msm8251_receive_clock(m | |
| 808 | 808 | |
| 809 | 809 | clk_level_tape = 1; |
| 810 | 810 | } |
| r8453 | r8454 | |
| 821 | 821 | } |
| 822 | 822 | |
| 823 | 823 | /* tape writing */ |
| 824 | if (cassette_get_state( | |
| 824 | if (cassette_get_state(m | |
| 825 | 825 | { |
| 826 | 826 | data = get_in_data_bit(pmd85_cassette_serial_connection.input_state); |
| 827 | 827 | data ^= clk_level_tape; |
| 828 | cassette_output( | |
| 828 | cassette_output(m | |
| 829 | 829 | |
| 830 | 830 | if (!clk_level_tape) |
| 831 | msm8251_transmit_clock( | |
| 831 | msm8251_transmit_clock(m | |
| 832 | 832 | |
| 833 | 833 | clk_level_tape = clk_level_tape ? 0 : 1; |
| 834 | 834 | |
| r8453 | r8454 | |
| 838 | 838 | clk_level_tape = 1; |
| 839 | 839 | |
| 840 | 840 | if (!clk_level) |
| 841 | msm8251_transmit_clock( | |
| 841 | msm8251_transmit_clock(m | |
| 842 | 842 | clk_level = clk_level ? 0 : 1; |
| 843 | 843 | } |
| 844 | 844 | } |
| r8453 | r8454 | |
| 911 | 911 | { |
| 912 | 912 | if (pmd85_model != MATO) |
| 913 | 913 | { |
| 914 | msm8251_connect( | |
| 914 | msm8251_connect(m | |
| 915 | 915 | } |
| 916 | 916 | } |
| 917 | 917 | |
| r8453 | r8454 | |
| 939 | 939 | pmd85_ppi_port_outputs[i][j] = 0; |
| 940 | 940 | |
| 941 | 941 | /* memory initialization */ |
| 942 | memset(messram_get_ptr( | |
| 942 | memset(messram_get_ptr(m | |
| 943 | 943 | pmd85_startup_mem_map = 1; |
| 944 | 944 | pmd85_update_memory(machine); |
| 945 | 945 |
| r8453 | r8454 | |
|---|---|---|
| 275 | 275 | /* disable CapsLock LED initially */ |
| 276 | 276 | set_led_status(machine, 1, 1); |
| 277 | 277 | set_led_status(machine, 1, 0); |
| 278 | kay_kbd_beeper = | |
| 278 | kay_kbd_beeper = m | |
| 279 | 279 | beep_on = 1; |
| 280 | 280 | control_status = 0x14; |
| 281 | 281 | beep_set_state(kay_kbd_beeper, 0); |
| r8453 | r8454 | |
|---|---|---|
| 223 | 223 | logerror("sam_m6847_get_video_ram(): scanline=%d video_position=0x%04X\n", scanline, video_position); |
| 224 | 224 | |
| 225 | 225 | /* return actual position */ |
| 226 | ram_base = sam->intf->get_rambase ? sam->intf->get_rambase(device) : messram_get_ptr(dev | |
| 226 | ram_base = sam->intf->get_rambase ? sam->intf->get_rambase(device) : messram_get_ptr(dev | |
| 227 | 227 | return &ram_base[video_position]; |
| 228 | 228 | } |
| 229 | 229 |
| r8453 | r8454 | |
|---|---|---|
| 329 | 329 | if (data & 0100) |
| 330 | 330 | { |
| 331 | 331 | /* read current AC */ |
| 332 | ac = cpu_get_reg( | |
| 332 | ac = cpu_get_reg(m | |
| 333 | 333 | /* cycle right */ |
| 334 | 334 | ac = (ac >> 1) | ((ac & 1) << 17); |
| 335 | 335 | /* shuffle and insert data into AC */ |
| 336 | 336 | ac = (ac /*& 0333333*/) | ((data & 001) << 17) | ((data & 002) << 13) | ((data & 004) << 9) | ((data & 010) << 5) | ((data & 020) << 1) | ((data & 040) >> 3); |
| 337 | 337 | /* write modified AC */ |
| 338 | cpu_set_reg( | |
| 338 | cpu_set_reg(m | |
| 339 | 339 | |
| 340 | 340 | tape_reader.rc = (tape_reader.rc+1) & 3; |
| 341 | 341 | |
| 342 | 342 | if (tape_reader.rc == 0) |
| 343 | 343 | { /* IO complete */ |
| 344 | 344 | tape_reader.rcl = 0; |
| 345 | cpu_set_reg( | |
| 345 | cpu_set_reg(m | |
| 346 | 346 | } |
| 347 | 347 | } |
| 348 | 348 | } |
| r8453 | r8454 | |
| 360 | 360 | */ |
| 361 | 361 | static TIMER_CALLBACK(puncher_callback) |
| 362 | 362 | { |
| 363 | cpu_set_reg( | |
| 363 | cpu_set_reg(m | |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | /* |
| r8453 | r8454 | |
| 448 | 448 | */ |
| 449 | 449 | static TIMER_CALLBACK(prt_callback) |
| 450 | 450 | { |
| 451 | cpu_set_reg( | |
| 451 | cpu_set_reg(m | |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | /* |
| r8453 | r8454 | |
| 474 | 474 | */ |
| 475 | 475 | static TIMER_CALLBACK(dis_callback) |
| 476 | 476 | { |
| 477 | cpu_set_reg( | |
| 477 | cpu_set_reg(m | |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | /* |
| r8453 | r8454 | |
| 588 | 588 | if ((magtape.state == MTS_SELECTED) || ((magtape.state == MTS_SELECTING) && (magtape.command == 2))) |
| 589 | 589 | { /* unit has become unavailable */ |
| 590 | 590 | magtape.state = MTS_UNSELECTING; |
| 591 | cpu_set_reg( | |
| 591 | cpu_set_reg( | |
| 592 | 592 | schedule_unselect(); |
| 593 | 593 | } |
| 594 | 594 | } |
| r8453 | r8454 | |
| 1130 | 1130 | previous LR */ |
| 1131 | 1131 | lr = (1 << 17) | ((charcode & 040) << 10) | ((charcode & 020) << 8) | ((charcode & 010) << 6) | ((charcode & 004) << 4) | ((charcode & 002) << 2) | ((charcode & 001) << 1); |
| 1132 | 1132 | /* write modified LR */ |
| 1133 | cpu_set_reg( | |
| 1133 | cpu_set_reg(m | |
| 1134 | 1134 | tx0_typewriter_drawchar(machine, charcode); /* we want to echo input */ |
| 1135 | 1135 | break; |
| 1136 | 1136 | } |
| r8453 | r8454 | |
| 1166 | 1166 | |
| 1167 | 1167 | if (control_transitions & tx0_stop_cyc0) |
| 1168 | 1168 | { |
| 1169 | cpu_set_reg(dev | |
| 1169 | cpu_set_reg(dev | |
| 1170 | 1170 | } |
| 1171 | 1171 | if (control_transitions & tx0_stop_cyc1) |
| 1172 | 1172 | { |
| 1173 | cpu_set_reg(dev | |
| 1173 | cpu_set_reg(dev | |
| 1174 | 1174 | } |
| 1175 | 1175 | if (control_transitions & tx0_gbl_cm_sel) |
| 1176 | 1176 | { |
| 1177 | cpu_set_reg(dev | |
| 1177 | cpu_set_reg(dev | |
| 1178 | 1178 | } |
| 1179 | 1179 | if (control_transitions & tx0_stop) |
| 1180 | 1180 | { |
| 1181 | cpu_set_reg(devtag_get_device(device->machine, "maincpu"), TX0_RUN, (UINT64)0); | |
| 1182 | cpu_set_reg(devtag_get_device(device->machine, "maincpu"), TX0_RIM, (UINT64)0); | |
| 1181 | cpu_set_reg(device->machine->device("maincpu"), TX0_RUN, (UINT64)0); | |
| 1182 | cpu_set_reg(device->machine->device("maincpu"), TX0_RIM, (UINT64)0); | |
| 1183 | 1183 | } |
| 1184 | 1184 | if (control_transitions & tx0_restart) |
| 1185 | 1185 | { |
| 1186 | cpu_set_reg(devtag_get_device(device->machine, "maincpu"), TX0_RUN, 1); | |
| 1187 | cpu_set_reg(devtag_get_device(device->machine, "maincpu"), TX0_RIM, (UINT64)0); | |
| 1186 | cpu_set_reg(device->machine->device("maincpu"), TX0_RUN, 1); | |
| 1187 | cpu_set_reg(device->machine->device("maincpu"), TX0_RIM, (UINT64)0); | |
| 1188 | 1188 | } |
| 1189 | 1189 | if (control_transitions & tx0_read_in) |
| 1190 | 1190 | { /* set cpu to read instructions from perforated tape */ |
| 1191 | cpu_set_reg(devtag_get_device(device->machine, "maincpu"), TX0_RESET, (UINT64)0); | |
| 1192 | cpu_set_reg(devtag_get_device(device->machine, "maincpu"), TX0_RUN, (UINT64)0); | |
| 1193 | cpu_set_reg(devtag_get_device(device->machine, "maincpu"), TX0_RIM, 1); | |
| 1191 | cpu_set_reg(device->machine->device("maincpu"), TX0_RESET, (UINT64)0); | |
| 1192 | cpu_set_reg(device->machine->device("maincpu"), TX0_RUN, (UINT64)0); | |
| 1193 | cpu_set_reg(device->machine->device("maincpu"), TX0_RIM, 1); | |
| 1194 | 1194 | } |
| 1195 | 1195 | if (control_transitions & tx0_toggle_dn) |
| 1196 | 1196 | { |
| r8453 | r8454 | |
| 1208 | 1208 | { |
| 1209 | 1209 | if (tsr_index >= 2) |
| 1210 | 1210 | { |
| 1211 | UINT32 cm_sel = (UINT32) cpu_get_reg(devtag_get_device(device->machine, "maincpu"), TX0_CM_SEL); | |
| 1212 | cpu_set_reg(devtag_get_device(device->machine, "maincpu"), TX0_CM_SEL, cm_sel ^ (1 << (tsr_index - 2))); | |
| 1211 | UINT32 cm_sel = (UINT32) cpu_get_reg(device->machine->device("maincpu"), TX0_CM_SEL); | |
| 1212 | cpu_set_reg(device->machine->device("maincpu"), TX0_CM_SEL, cm_sel ^ (1 << (tsr_index - 2))); | |
| 1213 | 1213 | } |
| 1214 | 1214 | } |
| 1215 | 1215 | if (control_transitions & tx0_lr_sel) |
| 1216 | 1216 | { |
| 1217 | 1217 | if (tsr_index >= 2) |
| 1218 | 1218 | { |
| 1219 | UINT32 lr_sel = (UINT32) cpu_get_reg(devtag_get_device(device->machine, "maincpu"), TX0_LR_SEL); | |
| 1220 | cpu_set_reg(devtag_get_device(device->machine, "maincpu"), TX0_LR_SEL, (lr_sel ^ (1 << (tsr_index - 2)))); | |
| 1219 | UINT32 lr_sel = (UINT32) cpu_get_reg(device->machine->device("maincpu"), TX0_LR_SEL); | |
| 1220 | cpu_set_reg(device->machine->device("maincpu"), TX0_LR_SEL, (lr_sel ^ (1 << (tsr_index - 2)))); | |
| 1221 | 1221 | } |
| 1222 | 1222 | } |
| 1223 | 1223 | |
| r8453 | r8454 | |
| 1233 | 1233 | |
| 1234 | 1234 | /* update toggle switch register */ |
| 1235 | 1235 | if (tsr_transitions) |
| 1236 | cpu_set_reg(dev | |
| 1236 | cpu_set_reg(dev | |
| 1237 | 1237 | |
| 1238 | 1238 | /* remember new state of toggle switch register keys */ |
| 1239 | 1239 | old_tsr_keys = tsr_keys; |
| r8453 | r8454 | |
|---|---|---|
| 111 | 111 | static void c128_nmi( running_machine *machine ) |
| 112 | 112 | { |
| 113 | 113 | static int nmilevel = 0; |
| 114 | running_device *cia_1 = | |
| 114 | running_device *cia_1 = m | |
| 115 | 115 | int cia1irq = mos6526_irq_r(cia_1); |
| 116 | 116 | |
| 117 | 117 | if (nmilevel != (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq) /* KEY_RESTORE */ |
| r8453 | r8454 | |
| 148 | 148 | |
| 149 | 149 | static READ8_DEVICE_HANDLER( c128_cia0_port_a_r ) |
| 150 | 150 | { |
| 151 | UINT8 cia0portb = mos6526_pb_r(dev | |
| 151 | UINT8 cia0portb = mos6526_pb_r(dev | |
| 152 | 152 | |
| 153 | 153 | return cbm_common_cia0_port_a_r(device, cia0portb); |
| 154 | 154 | } |
| r8453 | r8454 | |
| 156 | 156 | static READ8_DEVICE_HANDLER( c128_cia0_port_b_r ) |
| 157 | 157 | { |
| 158 | 158 | UINT8 value = 0xff; |
| 159 | UINT8 cia0porta = mos6526_pa_r(devtag_get_device(device->machine, "cia_0"), 0); | |
| 160 | running_device *vic2e = devtag_get_device(device->machine, "vic2e"); | |
| 159 | UINT8 cia0porta = mos6526_pa_r(device->machine->device("cia_0"), 0); | |
| 160 | running_device *vic2e = device->machine->device("vic2e"); | |
| 161 | 161 | |
| 162 | 162 | value &= cbm_common_cia0_port_b_r(device, cia0porta); |
| 163 | 163 | |
| r8453 | r8454 | |
| 173 | 173 | |
| 174 | 174 | static WRITE8_DEVICE_HANDLER( c128_cia0_port_b_w ) |
| 175 | 175 | { |
| 176 | running_device *vic2e = dev | |
| 176 | running_device *vic2e = dev | |
| 177 | 177 | vic2_lightpen_write(vic2e, data & 0x10); |
| 178 | 178 | } |
| 179 | 179 | |
| r8453 | r8454 | |
| 205 | 205 | |
| 206 | 206 | void c128_vic_interrupt( running_machine *machine, int level ) |
| 207 | 207 | { |
| 208 | running_device *cia_0 = | |
| 208 | running_device *cia_0 = m | |
| 209 | 209 | #if 1 |
| 210 | 210 | if (level != vicirq) |
| 211 | 211 | { |
| r8453 | r8454 | |
| 217 | 217 | |
| 218 | 218 | static void c128_iec_data_out_w(running_machine *machine) |
| 219 | 219 | { |
| 220 | running_device *cia_1 = devtag_get_device(machine, "cia_1"); | |
| 221 | running_device *iec = devtag_get_device(machine, "iec"); | |
| 220 | running_device *cia_1 = machine->device("cia_1"); | |
| 221 | running_device *iec = machine->device("iec"); | |
| 222 | 222 | int data = !c128_data_out; |
| 223 | 223 | |
| 224 | 224 | /* fast serial data */ |
| r8453 | r8454 | |
| 229 | 229 | |
| 230 | 230 | static void c128_iec_srq_out_w(running_machine *machine) |
| 231 | 231 | { |
| 232 | running_device *cia_1 = devtag_get_device(machine, "cia_1"); | |
| 233 | running_device *iec = devtag_get_device(machine, "iec"); | |
| 232 | running_device *cia_1 = machine->device("cia_1"); | |
| 233 | running_device *iec = machine->device("iec"); | |
| 234 | 234 | int srq = 1; |
| 235 | 235 | |
| 236 | 236 | /* fast serial clock */ |
| r8453 | r8454 | |
| 322 | 322 | static READ8_DEVICE_HANDLER( c128_cia1_port_a_r ) |
| 323 | 323 | { |
| 324 | 324 | UINT8 value = 0xff; |
| 325 | running_device *serbus = dev | |
| 325 | running_device *serbus = dev | |
| 326 | 326 | |
| 327 | 327 | if (!cbm_iec_clk_r(serbus)) |
| 328 | 328 | value &= ~0x40; |
| r8453 | r8454 | |
| 336 | 336 | static WRITE8_DEVICE_HANDLER( c128_cia1_port_a_w ) |
| 337 | 337 | { |
| 338 | 338 | static const int helper[4] = {0xc000, 0x8000, 0x4000, 0x0000}; |
| 339 | running_device *serbus = dev | |
| 339 | running_device *serbus = dev | |
| 340 | 340 | |
| 341 | 341 | c128_data_out = BIT(data, 5); |
| 342 | 342 | c128_iec_data_out_w(device->machine); |
| r8453 | r8454 | |
| 398 | 398 | |
| 399 | 399 | WRITE8_HANDLER( c128_write_d000 ) |
| 400 | 400 | { |
| 401 | running_device *cia_0 = devtag_get_device(space->machine, "cia_0"); | |
| 402 | running_device *cia_1 = devtag_get_device(space->machine, "cia_1"); | |
| 403 | running_device *sid = devtag_get_device(space->machine, "sid6581"); | |
| 404 | running_device *vic2e = devtag_get_device(space->machine, "vic2e"); | |
| 405 | running_device *vdc8563 = devtag_get_device(space->machine, "vdc8563"); | |
| 401 | running_device *cia_0 = space->machine->device("cia_0"); | |
| 402 | running_device *cia_1 = space->machine->device("cia_1"); | |
| 403 | running_device *sid = space->machine->device("sid6581"); | |
| 404 | running_device *vic2e = space->machine->device("vic2e"); | |
| 405 | running_device *vdc8563 = space->machine->device("vdc8563"); | |
| 406 | 406 | |
| 407 | 407 | UINT8 c64_port6510 = m6510_get_port(space->machine->device<legacy_cpu_device>("m8502")); |
| 408 | 408 | |
| r8453 | r8454 | |
| 455 | 455 | |
| 456 | 456 | static READ8_HANDLER( c128_read_io ) |
| 457 | 457 | { |
| 458 | running_device *cia_0 = devtag_get_device(space->machine, "cia_0"); | |
| 459 | running_device *cia_1 = devtag_get_device(space->machine, "cia_1"); | |
| 460 | running_device *sid = devtag_get_device(space->machine, "sid6581"); | |
| 461 | running_device *vic2e= devtag_get_device(space->machine, "vic2e"); | |
| 462 | running_device *vdc8563 = devtag_get_device(space->machine, "vdc8563"); | |
| 458 | running_device *cia_0 = space->machine->device("cia_0"); | |
| 459 | running_device *cia_1 = space->machine->device("cia_1"); | |
| 460 | running_device *sid = space->machine->device("sid6581"); | |
| 461 | running_device *vic2e= space->machine->device("vic2e"); | |
| 462 | running_device *vdc8563 = space->machine->device("vdc8563"); | |
| 463 | 463 | |
| 464 | 464 | if (offset < 0x400) |
| 465 | 465 | return vic2_port_r(vic2e, offset & 0x3ff); |
| r8453 | r8454 | |
| 522 | 522 | |
| 523 | 523 | if ((!c64_game && c64_exrom) || (charen && (loram || hiram))) |
| 524 | 524 | { |
| 525 | memory_install_read8_handler(cpu_get_address_space( | |
| 525 | memory_install_read8_handler(cpu_get_address_space(m | |
| 526 | 526 | c128_write_io = 1; |
| 527 | 527 | } |
| 528 | 528 | else |
| 529 | 529 | { |
| 530 | memory_install_read_bank(cpu_get_address_space( | |
| 530 | memory_install_read_bank(cpu_get_address_space(m | |
| 531 | 531 | c128_write_io = 0; |
| 532 | 532 | if ((!charen && (loram || hiram))) |
| 533 | 533 | memory_set_bankptr(machine, "bank13", c64_chargen); |
| r8453 | r8454 | |
| 706 | 706 | else |
| 707 | 707 | c128_ram_top = 0x10000; |
| 708 | 708 | |
| 709 | memory_install_read8_handler(cpu_get_address_space( | |
| 709 | memory_install_read8_handler(cpu_get_address_space(m | |
| 710 | 710 | |
| 711 | 711 | if (MMU_IO_ON) |
| 712 | 712 | { |
| 713 | 713 | c128_write_io = 1; |
| 714 | memory_install_read8_handler(cpu_get_address_space( | |
| 714 | memory_install_read8_handler(cpu_get_address_space(m | |
| 715 | 715 | } |
| 716 | 716 | else |
| 717 | 717 | { |
| 718 | 718 | c128_write_io = 0; |
| 719 | memory_install_read_bank(cpu_get_address_space( | |
| 719 | memory_install_read_bank(cpu_get_address_space(m | |
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | |
| r8453 | r8454 | |
| 828 | 828 | * driver used to work with this behavior, so I am doing this hack |
| 829 | 829 | * where I set CPU #1's PC to 0x1100 on reset. |
| 830 | 830 | */ |
| 831 | if (cpu_get_reg(devtag_get_device(machine, "m8502"), STATE_GENPC) == 0x0000) | |
| 832 | cpu_set_reg(devtag_get_device(machine, "m8502"), STATE_GENPC, 0x1100); | |
| 831 | if (cpu_get_reg(machine->device("m8502"), STATE_GENPC) == 0x0000) | |
| 832 | cpu_set_reg(machine->device("m8502"), STATE_GENPC, 0x1100); | |
| 833 | 833 | } |
| 834 | 834 | mmu_cpu = MMU_CPU8502; |
| 835 | 835 | return; |
| r8453 | r8454 | |
| 1086 | 1086 | { |
| 1087 | 1087 | if (direction & 0x08) |
| 1088 | 1088 | { |
| 1089 | cassette_output(dev | |
| 1089 | cassette_output(dev | |
| 1090 | 1090 | } |
| 1091 | 1091 | |
| 1092 | 1092 | if (direction & 0x20) |
| 1093 | 1093 | { |
| 1094 | 1094 | if (!(data & 0x20)) |
| 1095 | 1095 | { |
| 1096 | cassette_change_state(dev | |
| 1096 | cassette_change_state(dev | |
| 1097 | 1097 | timer_adjust_periodic(datasette_timer, attotime_zero, 0, ATTOTIME_IN_HZ(44100)); |
| 1098 | 1098 | } |
| 1099 | 1099 | else |
| 1100 | 1100 | { |
| 1101 | cassette_change_state(dev | |
| 1101 | cassette_change_state(dev | |
| 1102 | 1102 | timer_reset(datasette_timer, attotime_never); |
| 1103 | 1103 | } |
| 1104 | 1104 | } |
| r8453 | r8454 | |
| 1114 | 1114 | { |
| 1115 | 1115 | UINT8 data = c64_port_data; |
| 1116 | 1116 | |
| 1117 | if ((cassette_get_state(dev | |
| 1117 | if ((cassette_get_state(dev | |
| 1118 | 1118 | data &= ~0x10; |
| 1119 | 1119 | else |
| 1120 | 1120 | data |= 0x10; |
| r8453 | r8454 | |
| 1161 | 1161 | |
| 1162 | 1162 | DRIVER_INIT( c128 ) |
| 1163 | 1163 | { |
| 1164 | running_device *vic2e = devtag_get_device(machine, "vic2e"); | |
| 1165 | running_device *vdc8563 = devtag_get_device(machine, "vdc8563"); | |
| 1164 | running_device *vic2e = machine->device("vic2e"); | |
| 1165 | running_device *vdc8563 = machine->device("vdc8563"); | |
| 1166 | 1166 | |
| 1167 | 1167 | c64_tape_on = 1; |
| 1168 | 1168 | c64_pal = 0; |
| r8453 | r8454 | |
| 1173 | 1173 | |
| 1174 | 1174 | DRIVER_INIT( c128pal ) |
| 1175 | 1175 | { |
| 1176 | running_device *vic2e = devtag_get_device(machine, "vic2e"); | |
| 1177 | running_device *vdc8563 = devtag_get_device(machine, "vdc8563"); | |
| 1176 | running_device *vic2e = machine->device("vic2e"); | |
| 1177 | running_device *vdc8563 = machine->device("vdc8563"); | |
| 1178 | 1178 | |
| 1179 | 1179 | c64_tape_on = 1; |
| 1180 | 1180 | c64_pal = 1; |
| r8453 | r8454 | |
| 1231 | 1231 | static int monitor = -1; |
| 1232 | 1232 | static const char *const c128ports[] = { "KP0", "KP1", "KP2" }; |
| 1233 | 1233 | int i, value; |
| 1234 | running_device *vic2e = devtag_get_device(device->machine, "vic2e"); | |
| 1235 | running_device *vdc8563 = devtag_get_device(device->machine, "vdc8563"); | |
| 1234 | running_device *vic2e = device->machine->device("vic2e"); | |
| 1235 | running_device *vdc8563 = device->machine->device("vdc8563"); | |
| 1236 | 1236 | |
| 1237 | 1237 | c128_nmi(device->machine); |
| 1238 | 1238 | |
| r8453 | r8454 | |
| 1276 | 1276 | |
| 1277 | 1277 | VIDEO_UPDATE( c128 ) |
| 1278 | 1278 | { |
| 1279 | running_device *vic2e = devtag_get_device(screen->machine, "vic2e"); | |
| 1280 | running_device *vdc8563 = devtag_get_device(screen->machine, "vdc8563"); | |
| 1279 | running_device *vic2e = screen->machine->device("vic2e"); | |
| 1280 | running_device *vdc8563 = screen->machine->device("vdc8563"); | |
| 1281 | 1281 | |
| 1282 | 1282 | vdc8563_video_update(vdc8563, bitmap, cliprect); |
| 1283 | 1283 | vic2_video_update(vic2e, bitmap, cliprect); |
| r8453 | r8454 | |
|---|---|---|
| 139 | 139 | */ |
| 140 | 140 | WRITE8_HANDLER ( p2000t_port_505f_w ) |
| 141 | 141 | { |
| 142 | running_device *speaker = | |
| 142 | running_device *speaker = | |
| 143 | 143 | speaker_level_w(speaker, BIT(data,0)); |
| 144 | 144 | } |
| 145 | 145 |
| r8453 | r8454 | |
|---|---|---|
| 300 | 300 | /* find devices */ |
| 301 | 301 | vic1112->via0 = device->subdevice(M6522_0_TAG); |
| 302 | 302 | vic1112->via1 = device->subdevice(M6522_1_TAG); |
| 303 | vic1112->bus = dev | |
| 303 | vic1112->bus = dev | |
| 304 | 304 | |
| 305 | 305 | /* set VIA clocks */ |
| 306 | 306 | vic1112->via0->set_unscaled_clock(cpu_get_clock(device->machine->firstcpu)); |
| r8453 | r8454 | |
|---|---|---|
| 1516 | 1516 | c2040->riot1 = device->subdevice(M6532_1_TAG); |
| 1517 | 1517 | c2040->miot = device->subdevice(M6530_TAG); |
| 1518 | 1518 | c2040->via = device->subdevice(M6522_TAG); |
| 1519 | c2040->bus = dev | |
| 1519 | c2040->bus = dev | |
| 1520 | 1520 | c2040->unit[0].image = device->subdevice(FLOPPY_0); |
| 1521 | 1521 | c2040->unit[1].image = device->subdevice(FLOPPY_1); |
| 1522 | 1522 |
| r8453 | r8454 | |
|---|---|---|
| 71 | 71 | |
| 72 | 72 | */ |
| 73 | 73 | |
| 74 | running_device *ieeebus = dev | |
| 74 | running_device *ieeebus = dev | |
| 75 | 75 | UINT8 data = 0; |
| 76 | 76 | |
| 77 | 77 | /* key */ |
| 78 | 78 | data |= pet_keyline_select; |
| 79 | 79 | |
| 80 | 80 | /* #1 cassette switch */ |
| 81 | data |= ((cassette_get_state(dev | |
| 81 | data |= ((cassette_get_state(dev | |
| 82 | 82 | |
| 83 | 83 | /* #2 cassette switch */ |
| 84 | data |= ((cassette_get_state(dev | |
| 84 | data |= ((cassette_get_state(dev | |
| 85 | 85 | |
| 86 | 86 | /* end or identify in */ |
| 87 | 87 | data |= ieee488_eoi_r(ieeebus) << 6; |
| r8453 | r8454 | |
| 180 | 180 | static READ8_DEVICE_HANDLER( cass1_r ) |
| 181 | 181 | { |
| 182 | 182 | // cassette 1 read |
| 183 | return (cassette_input(dev | |
| 183 | return (cassette_input(dev | |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | static WRITE8_DEVICE_HANDLER( eoi_w ) |
| 187 | 187 | { |
| 188 | running_device *ieeebus = dev | |
| 188 | running_device *ieeebus = dev | |
| 189 | 189 | |
| 190 | 190 | ieee488_eoi_w(ieeebus, device, data); |
| 191 | 191 | } |
| r8453 | r8454 | |
| 194 | 194 | { |
| 195 | 195 | if (!data) |
| 196 | 196 | { |
| 197 | cassette_change_state(dev | |
| 197 | cassette_change_state(dev | |
| 198 | 198 | timer_adjust_periodic(datasette1_timer, attotime_zero, 0, ATTOTIME_IN_HZ(48000)); // I put 48000 because I was given some .wav with this freq |
| 199 | 199 | } |
| 200 | 200 | else |
| 201 | 201 | { |
| 202 | cassette_change_state(dev | |
| 202 | cassette_change_state(dev | |
| 203 | 203 | timer_reset(datasette1_timer, attotime_never); |
| 204 | 204 | } |
| 205 | 205 | } |
| r8453 | r8454 | |
| 272 | 272 | |
| 273 | 273 | */ |
| 274 | 274 | |
| 275 | running_device *ieeebus = dev | |
| 275 | running_device *ieeebus = dev | |
| 276 | 276 | |
| 277 | 277 | ieee488_dio_w(ieeebus, device, data); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | static WRITE8_DEVICE_HANDLER( ndac_w ) |
| 281 | 281 | { |
| 282 | running_device *ieeebus = dev | |
| 282 | running_device *ieeebus = dev | |
| 283 | 283 | |
| 284 | 284 | ieee488_ndac_w(ieeebus, device, data); |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | static WRITE8_DEVICE_HANDLER( dav_w ) |
| 288 | 288 | { |
| 289 | running_device *ieeebus = dev | |
| 289 | running_device *ieeebus = dev | |
| 290 | 290 | |
| 291 | 291 | ieee488_dav_w(ieeebus, device, data); |
| 292 | 292 | } |
| r8453 | r8454 | |
| 351 | 351 | |
| 352 | 352 | */ |
| 353 | 353 | |
| 354 | running_device *ieeebus = dev | |
| 354 | running_device *ieeebus = dev | |
| 355 | 355 | UINT8 data = 0; |
| 356 | 356 | |
| 357 | 357 | /* not data accepted in */ |
| r8453 | r8454 | |
| 371 | 371 | static READ_LINE_DEVICE_HANDLER( cass2_r ) |
| 372 | 372 | { |
| 373 | 373 | // cassette 2 read |
| 374 | return (cassette_input(dev | |
| 374 | return (cassette_input(dev | |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | static WRITE8_DEVICE_HANDLER( via_pb_w ) |
| r8453 | r8454 | |
| 391 | 391 | |
| 392 | 392 | */ |
| 393 | 393 | |
| 394 | running_device *ieeebus = dev | |
| 394 | running_device *ieeebus = dev | |
| 395 | 395 | |
| 396 | 396 | /* not ready for data out */ |
| 397 | 397 | ieee488_nrfd_w(ieeebus, device, BIT(data, 1)); |
| r8453 | r8454 | |
| 400 | 400 | ieee488_atn_w(ieeebus, device, BIT(data, 2)); |
| 401 | 401 | |
| 402 | 402 | /* cassette write */ |
| 403 | cassette_output(devtag_get_device(device->machine, "cassette1"), BIT(data, 3) ? -(0x5a9e >> 1) : +(0x5a9e >> 1)); | |
| 404 | cassette_output(devtag_get_device(device->machine, "cassette2"), BIT(data, 3) ? -(0x5a9e >> 1) : +(0x5a9e >> 1)); | |
| 403 | cassette_output(device->machine->device("cassette1"), BIT(data, 3) ? -(0x5a9e >> 1) : +(0x5a9e >> 1)); | |
| 404 | cassette_output(device->machine->device("cassette2"), BIT(data, 3) ? -(0x5a9e >> 1) : +(0x5a9e >> 1)); | |
| 405 | 405 | |
| 406 | 406 | /* #2 cassette motor */ |
| 407 | 407 | if (BIT(data, 4)) |
| 408 | 408 | { |
| 409 | cassette_change_state(dev | |
| 409 | cassette_change_state(dev | |
| 410 | 410 | timer_adjust_periodic(datasette2_timer, attotime_zero, 0, ATTOTIME_IN_HZ(48000)); // I put 48000 because I was given some .wav with this freq |
| 411 | 411 | } |
| 412 | 412 | else |
| 413 | 413 | { |
| 414 | cassette_change_state(dev | |
| 414 | cassette_change_state(dev | |
| 415 | 415 | timer_reset(datasette2_timer, attotime_never); |
| 416 | 416 | } |
| 417 | 417 | } |
| r8453 | r8454 | |
| 457 | 457 | |
| 458 | 458 | static WRITE8_HANDLER( cbm8096_io_w ) |
| 459 | 459 | { |
| 460 | running_device *via_0 = devtag_get_device(space->machine, "via6522_0"); | |
| 461 | running_device *pia_0 = devtag_get_device(space->machine, "pia_0"); | |
| 462 | running_device *pia_1 = devtag_get_device(space->machine, "pia_1"); | |
| 463 | running_device *mc6845 = devtag_get_device(space->machine, "crtc"); | |
| 460 | running_device *via_0 = space->machine->device("via6522_0"); | |
| 461 | running_device *pia_0 = space->machine->device("pia_0"); | |
| 462 | running_device *pia_1 = space->machine->device("pia_1"); | |
| 463 | running_device *mc6845 = space->machine->device("crtc"); | |
| 464 | 464 | |
| 465 | 465 | if (offset < 0x10) ; |
| 466 | 466 | else if (offset < 0x14) pia6821_w(pia_0, offset & 3, data); |
| r8453 | r8454 | |
| 475 | 475 | |
| 476 | 476 | static READ8_HANDLER( cbm8096_io_r ) |
| 477 | 477 | { |
| 478 | running_device *via_0 = devtag_get_device(space->machine, "via6522_0"); | |
| 479 | running_device *pia_0 = devtag_get_device(space->machine, "pia_0"); | |
| 480 | running_device *pia_1 = devtag_get_device(space->machine, "pia_1"); | |
| 481 | running_device *mc6845 = devtag_get_device(space->machine, "crtc"); | |
| 478 | running_device *via_0 = space->machine->device("via6522_0"); | |
| 479 | running_device *pia_0 = space->machine->device("pia_0"); | |
| 480 | running_device *pia_1 = space->machine->device("pia_1"); | |
| 481 | running_device *mc6845 = space->machine->device("crtc"); | |
| 482 | 482 | |
| 483 | 483 | int data = 0xff; |
| 484 | 484 | if (offset < 0x10) ; |
| r8453 | r8454 | |
| 669 | 669 | |
| 670 | 670 | static TIMER_CALLBACK( pet_interrupt ) |
| 671 | 671 | { |
| 672 | running_device *pia_0 = | |
| 672 | running_device *pia_0 = m | |
| 673 | 673 | static int level = 0; |
| 674 | 674 | |
| 675 | 675 | pia6821_cb1_w(pia_0, 0, level); |
| r8453 | r8454 | |
| 679 | 679 | |
| 680 | 680 | static TIMER_CALLBACK( pet_tape1_timer ) |
| 681 | 681 | { |
| 682 | running_device *pia_0 = | |
| 682 | running_device *pia_0 = m | |
| 683 | 683 | // cassette 1 |
| 684 | UINT8 data = (cassette_input( | |
| 684 | UINT8 data = (cassette_input(m | |
| 685 | 685 | pia6821_ca1_w(pia_0, 0, data); |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | static TIMER_CALLBACK( pet_tape2_timer ) |
| 689 | 689 | { |
| 690 | running_device *via_0 = | |
| 690 | running_device *via_0 = m | |
| 691 | 691 | // cassette 2 |
| 692 | UINT8 data = (cassette_input( | |
| 692 | UINT8 data = (cassette_input(m | |
| 693 | 693 | via_cb1_w(via_0, data); |
| 694 | 694 | } |
| 695 | 695 | |
| r8453 | r8454 | |
| 705 | 705 | state->superpet = 0; |
| 706 | 706 | state->cbm8096 = 0; |
| 707 | 707 | |
| 708 | memory_install_readwrite_bank(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, messram_get_size( | |
| 708 | memory_install_readwrite_bank(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, messram_get_size(m | |
| 709 | 709 | memory_set_bankptr(machine, "bank10", pet_memory); |
| 710 | 710 | |
| 711 | if (messram_get_size( | |
| 711 | if (messram_get_size(m | |
| 712 | 712 | { |
| 713 | memory_nop_readwrite(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), messram_get_size( | |
| 713 | memory_nop_readwrite(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), messram_get_size(m | |
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | /* 2114 poweron ? 64 x 0xff, 64x 0, and so on */ |
| 717 | for (i = 0; i < messram_get_size( | |
| 717 | for (i = 0; i < messram_get_size(m | |
| 718 | 718 | { |
| 719 | 719 | memset (pet_memory + i, i & 0x40 ? 0 : 0xff, 0x40); |
| 720 | 720 | } |
| r8453 | r8454 | |
| 731 | 731 | DRIVER_INIT( pet2001 ) |
| 732 | 732 | { |
| 733 | 733 | pet_state *state = (pet_state *)machine->driver_data; |
| 734 | pet_memory = messram_get_ptr( | |
| 734 | pet_memory = messram_get_ptr(m | |
| 735 | 735 | pet_common_driver_init(machine); |
| 736 | 736 | state->pet_basic1 = 1; |
| 737 | 737 | pet_vh_init(machine); |
| r8453 | r8454 | |
| 739 | 739 | |
| 740 | 740 | DRIVER_INIT( pet ) |
| 741 | 741 | { |
| 742 | pet_memory = messram_get_ptr( | |
| 742 | pet_memory = messram_get_ptr(m | |
| 743 | 743 | pet_common_driver_init(machine); |
| 744 | 744 | pet_vh_init(machine); |
| 745 | 745 | } |
| r8453 | r8454 | |
| 760 | 760 | DRIVER_INIT( superpet ) |
| 761 | 761 | { |
| 762 | 762 | pet_state *state = (pet_state *)machine->driver_data; |
| 763 | pet_memory = messram_get_ptr( | |
| 763 | pet_memory = messram_get_ptr(m | |
| 764 | 764 | pet_common_driver_init(machine); |
| 765 | 765 | state->superpet = 1; |
| 766 | 766 | |
| r8453 | r8454 | |
| 775 | 775 | MACHINE_RESET( pet ) |
| 776 | 776 | { |
| 777 | 777 | pet_state *state = (pet_state *)machine->driver_data; |
| 778 | running_device *ieeebus = devtag_get_device(machine, "ieee_bus"); | |
| 779 | running_device *scapegoat = devtag_get_device(machine, "pia_0"); | |
| 778 | running_device *ieeebus = machine->device("ieee_bus"); | |
| 779 | running_device *scapegoat = machine->device("pia_0"); | |
| 780 | 780 | |
| 781 | 781 | if (state->superpet) |
| 782 | 782 | { |
| r8453 | r8454 | |
| 810 | 810 | |
| 811 | 811 | //removed cbm_drive_0_config (input_port_read(machine, "CFG") & 2 ? IEEE : 0, 8); |
| 812 | 812 | //removed cbm_drive_1_config (input_port_read(machine, "CFG") & 1 ? IEEE : 0, 9); |
| 813 | | |
| 813 | m | |
| 814 | 814 | |
| 815 | 815 | ieee488_ren_w(ieeebus, scapegoat, 0); |
| 816 | 816 | ieee488_ifc_w(ieeebus, scapegoat, 0); |
| r8453 | r8454 | |
|---|---|---|
| 171 | 171 | /* if psg is in read register state return reg data */ |
| 172 | 172 | if (oric_psg_control==0x01) |
| 173 | 173 | { |
| 174 | return ay8910_r( | |
| 174 | return ay8910_r( | |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /* return high-impedance */ |
| r8453 | r8454 | |
| 214 | 214 | /* write register data */ |
| 215 | 215 | case 2: |
| 216 | 216 | { |
| 217 | running_device *ay8912 = | |
| 217 | running_device *ay8912 = m | |
| 218 | 218 | ay8910_data_w(ay8912, 0, oric_via_port_a_data); |
| 219 | 219 | } |
| 220 | 220 | break; |
| 221 | 221 | /* write register index */ |
| 222 | 222 | case 3: |
| 223 | 223 | { |
| 224 | running_device *ay8912 = | |
| 224 | running_device *ay8912 = m | |
| 225 | 225 | ay8910_address_w(ay8912, 0, oric_via_port_a_data); |
| 226 | 226 | } |
| 227 | 227 | break; |
| r8453 | r8454 | |
| 244 | 244 | if (oric_psg_control==0) |
| 245 | 245 | { |
| 246 | 246 | /* if psg not selected, write to printer */ |
| 247 | running_device *printer = dev | |
| 247 | running_device *printer = dev | |
| 248 | 248 | centronics_data_w(printer, 0, data); |
| 249 | 249 | } |
| 250 | 250 | } |
| r8453 | r8454 | |
| 273 | 273 | |
| 274 | 274 | static running_device *cassette_device_image(running_machine *machine) |
| 275 | 275 | { |
| 276 | return | |
| 276 | return m | |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | /* not called yet - this will update the via with the state of the tape data. |
| r8453 | r8454 | |
| 282 | 282 | { |
| 283 | 283 | int data; |
| 284 | 284 | int input_port_9; |
| 285 | running_device *via_0 = | |
| 285 | running_device *via_0 = m | |
| 286 | 286 | |
| 287 | 287 | data = 0; |
| 288 | 288 | |
| r8453 | r8454 | |
| 308 | 308 | static unsigned char previous_portb_data = 0; |
| 309 | 309 | static WRITE8_DEVICE_HANDLER ( oric_via_out_b_func ) |
| 310 | 310 | { |
| 311 | running_device *printer = dev | |
| 311 | running_device *printer = dev | |
| 312 | 312 | |
| 313 | 313 | /* KEYBOARD */ |
| 314 | 314 | oric_keyboard_line = data & 0x07; |
| r8453 | r8454 | |
| 462 | 462 | |
| 463 | 463 | static void oric_install_apple2_interface(running_machine *machine) |
| 464 | 464 | { |
| 465 | running_device *fdc = | |
| 465 | running_device *fdc = m | |
| 466 | 466 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 467 | 467 | |
| 468 | 468 | if (oric_is_telestrat) |
| r8453 | r8454 | |
| 584 | 584 | /* APPLE 2 INTERFACE V2 */ |
| 585 | 585 | static void oric_install_apple2_v2_interface(running_machine *machine) |
| 586 | 586 | { |
| 587 | running_device *fdc = | |
| 587 | running_device *fdc = m | |
| 588 | 588 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 589 | 589 | |
| 590 | 590 | memory_install_read8_handler(space, 0x0300, 0x030f, 0, 0, oric_IO_r); |
| r8453 | r8454 | |
| 705 | 705 | |
| 706 | 706 | static READ8_HANDLER (oric_jasmin_r) |
| 707 | 707 | { |
| 708 | running_device *via_0 = devtag_get_device(space->machine, "via6522_0"); | |
| 709 | running_device *fdc = devtag_get_device(space->machine, "wd179x"); | |
| 708 | running_device *via_0 = space->machine->device("via6522_0"); | |
| 709 | running_device *fdc = space->machine->device("wd179x"); | |
| 710 | 710 | unsigned char data = 0x0ff; |
| 711 | 711 | |
| 712 | 712 | switch (offset & 0x0f) |
| r8453 | r8454 | |
| 736 | 736 | |
| 737 | 737 | static WRITE8_HANDLER(oric_jasmin_w) |
| 738 | 738 | { |
| 739 | running_device *via_0 = devtag_get_device(space->machine, "via6522_0"); | |
| 740 | running_device *fdc = devtag_get_device(space->machine, "wd179x"); | |
| 739 | running_device *via_0 = space->machine->device("via6522_0"); | |
| 740 | running_device *fdc = space->machine->device("wd179x"); | |
| 741 | 741 | switch (offset & 0x0f) |
| 742 | 742 | { |
| 743 | 743 | /* microdisc floppy disc interface */ |
| r8453 | r8454 | |
| 762 | 762 | wd17xx_reset(fdc); |
| 763 | 763 | break; |
| 764 | 764 | case 0x0a: |
| 765 | //logerror("jasmin overlay ram w: %02x PC: %04x\n", data, cpu_get_pc( | |
| 765 | //logerror("jasmin overlay ram w: %02x PC: %04x\n", data, cpu_get_pc( | |
| 766 | 766 | port_3fa_w = data; |
| 767 | 767 | oric_jasmin_set_mem_0x0c000(space->machine); |
| 768 | 768 | break; |
| 769 | 769 | case 0x0b: |
| 770 | //logerror("jasmin romdis w: %02x PC: %04x\n", data, cpu_get_pc( | |
| 770 | //logerror("jasmin romdis w: %02x PC: %04x\n", data, cpu_get_pc( | |
| 771 | 771 | port_3fb_w = data; |
| 772 | 772 | oric_jasmin_set_mem_0x0c000(space->machine); |
| 773 | 773 | break; |
| r8453 | r8454 | |
| 924 | 924 | READ8_HANDLER (oric_microdisc_r) |
| 925 | 925 | { |
| 926 | 926 | unsigned char data = 0x0ff; |
| 927 | running_device *fdc = | |
| 927 | running_device *fdc = | |
| 928 | 928 | |
| 929 | 929 | switch (offset & 0x0ff) |
| 930 | 930 | { |
| r8453 | r8454 | |
| 952 | 952 | |
| 953 | 953 | default: |
| 954 | 954 | { |
| 955 | running_device *via_0 = | |
| 955 | running_device *via_0 = | |
| 956 | 956 | data = via_r(via_0, offset & 0x0f); |
| 957 | 957 | } |
| 958 | 958 | break; |
| r8453 | r8454 | |
| 964 | 964 | |
| 965 | 965 | WRITE8_HANDLER(oric_microdisc_w) |
| 966 | 966 | { |
| 967 | running_device *fdc = | |
| 967 | running_device *fdc = | |
| 968 | 968 | switch (offset & 0x0ff) |
| 969 | 969 | { |
| 970 | 970 | /* microdisc floppy disc interface */ |
| r8453 | r8454 | |
| 1001 | 1001 | |
| 1002 | 1002 | default: |
| 1003 | 1003 | { |
| 1004 | running_device *via_0 = | |
| 1004 | running_device *via_0 = | |
| 1005 | 1005 | via_w(via_0, offset & 0x0f, data); |
| 1006 | 1006 | } |
| 1007 | 1007 | break; |
| r8453 | r8454 | |
| 1140 | 1140 | } |
| 1141 | 1141 | break; |
| 1142 | 1142 | } |
| 1143 | | |
| 1143 | m | |
| 1144 | 1144 | } |
| 1145 | 1145 | |
| 1146 | 1146 | |
| 1147 | 1147 | READ8_HANDLER ( oric_IO_r ) |
| 1148 | 1148 | { |
| 1149 | running_device *via_0 = | |
| 1149 | running_device *via_0 = | |
| 1150 | 1150 | switch (input_port_read(space->machine, "FLOPPY") & 0x07) |
| 1151 | 1151 | { |
| 1152 | 1152 | default: |
| r8453 | r8454 | |
| 1175 | 1175 | { |
| 1176 | 1176 | if ((offset & 0x0f)!=0x0d) |
| 1177 | 1177 | { |
| 1178 | //logerror("via 0 r: %04x %04x\n",offset, (unsigned) cpu_get_reg( | |
| 1178 | //logerror("via 0 r: %04x %04x\n",offset, (unsigned) cpu_get_reg( | |
| 1179 | 1179 | } |
| 1180 | 1180 | } |
| 1181 | 1181 | /* it is repeated */ |
| r8453 | r8454 | |
| 1184 | 1184 | |
| 1185 | 1185 | WRITE8_HANDLER ( oric_IO_w ) |
| 1186 | 1186 | { |
| 1187 | running_device *via_0 = | |
| 1187 | running_device *via_0 = | |
| 1188 | 1188 | switch (input_port_read(space->machine, "FLOPPY") & 0x07) |
| 1189 | 1189 | { |
| 1190 | 1190 | default: |
| r8453 | r8454 | |
| 1214 | 1214 | } |
| 1215 | 1215 | if (enable_logging) |
| 1216 | 1216 | { |
| 1217 | //logerror("via 0 w: %04x %02x %04x\n", offset, data,(unsigned) cpu_get_reg( | |
| 1217 | //logerror("via 0 w: %04x %02x %04x\n", offset, data,(unsigned) cpu_get_reg( | |
| 1218 | 1218 | } |
| 1219 | 1219 | |
| 1220 | 1220 | via_w(via_0, offset & 0x0f, data); |
| r8453 | r8454 | |
|---|---|---|
| 120 | 120 | case 4: |
| 121 | 121 | switch(data & 0xc0) |
| 122 | 122 | { |
| 123 | case 0x00: cpu_set_clockscale(devtag_get_device(space->machine, "maincpu"), 1.0 / 2); break; | |
| 124 | case 0x40: cpu_set_clockscale(devtag_get_device(space->machine, "maincpu"), 3.0 / 4); break; | |
| 125 | default: cpu_set_clockscale(devtag_get_device(space->machine, "maincpu"), 1); break; | |
| 123 | case 0x00: cpu_set_clockscale(space->machine->device("maincpu"), 1.0 / 2); break; | |
| 124 | case 0x40: cpu_set_clockscale(space->machine->device("maincpu"), 3.0 / 4); break; | |
| 125 | default: cpu_set_clockscale(space->machine->device("maincpu"), 1); break; | |
| 126 | 126 | } |
| 127 | 127 | break; |
| 128 | 128 | case 0xa: |
| r8453 | r8454 | |
| 178 | 178 | europc_pio.port61=data; |
| 179 | 179 | // if (data == 0x30) pc1640.port62 = (pc1640.port65 & 0x10) >> 4; |
| 180 | 180 | // else if (data == 0x34) pc1640.port62 = pc1640.port65 & 0xf; |
| 181 | pit8253_gate2_w( | |
| 181 | pit8253_gate2_w( | |
| 182 | 182 | pc_speaker_set_spkrdata(space->machine, BIT(data, 1)); |
| 183 | 183 | pc_keyb_set_clock(BIT(data, 6)); |
| 184 | 184 | break; |
| r8453 | r8454 | |
| 201 | 201 | data = europc_pio.port61; |
| 202 | 202 | break; |
| 203 | 203 | case 2: |
| 204 | if (pit8253_get_output( | |
| 204 | if (pit8253_get_output( | |
| 205 | 205 | data |= 0x20; |
| 206 | 206 | break; |
| 207 | 207 | } |
| r8453 | r8454 | |
|---|---|---|
| 57 | 57 | case 0x03FF : return input_port_read(space->machine, "LINE19"); |
| 58 | 58 | /* Tape */ |
| 59 | 59 | case 0x07FF : |
| 60 | level = cassette_input( | |
| 60 | level = cassette_input( | |
| 61 | 61 | if (level < 0) { |
| 62 | 62 | return 0x00; |
| 63 | 63 | } |
| r8453 | r8454 | |
| 73 | 73 | { |
| 74 | 74 | if (offset == 0x0800) |
| 75 | 75 | { |
| 76 | running_device *dac_device = | |
| 76 | running_device *dac_device = | |
| 77 | 77 | dac_data_w(dac_device, data); //beeper |
| 78 | 78 | } |
| 79 | 79 | } |
| r8453 | r8454 | |
|---|---|---|
| 17 | 17 | MACHINE_RESET( rt1715 ) |
| 18 | 18 | { |
| 19 | 19 | memory_set_bankptr(machine, "bank1", memory_region(machine, "maincpu") + 0x10000); |
| 20 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x0800); | |
| 21 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 20 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0x0800); | |
| 21 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram"))); | |
| 22 | 22 | } |
| r8453 | r8454 | |
|---|---|---|
| 77 | 77 | |
| 78 | 78 | static void at_speaker_set_spkrdata(running_machine *machine, UINT8 data) |
| 79 | 79 | { |
| 80 | running_device *speaker = | |
| 80 | running_device *speaker = m | |
| 81 | 81 | at_spkrdata = data ? 1 : 0; |
| 82 | 82 | speaker_level_w( speaker, at_speaker_get_spk() ); |
| 83 | 83 | } |
| r8453 | r8454 | |
| 85 | 85 | |
| 86 | 86 | static void at_speaker_set_input(running_machine *machine, UINT8 data) |
| 87 | 87 | { |
| 88 | running_device *speaker = | |
| 88 | running_device *speaker = m | |
| 89 | 89 | at_speaker_input = data ? 1 : 0; |
| 90 | 90 | speaker_level_w( speaker, at_speaker_get_spk() ); |
| 91 | 91 | } |
| r8453 | r8454 | |
| 174 | 174 | soundblaster_config(&soundblaster); |
| 175 | 175 | kbdc8042_init(machine, at8042); |
| 176 | 176 | |
| 177 | if (messram_get_size( | |
| 177 | if (messram_get_size(m | |
| 178 | 178 | { |
| 179 | offs_t ram_limit = 0x100000 + messram_get_size( | |
| 179 | offs_t ram_limit = 0x100000 + messram_get_size(m | |
| 180 | 180 | memory_install_read_bank(space, 0x100000, ram_limit - 1, 0, 0, "bank1"); |
| 181 | 181 | memory_install_write_bank(space, 0x100000, ram_limit - 1, 0, 0, "bank1"); |
| 182 | memory_set_bankptr(machine, "bank1", messram_get_ptr( | |
| 182 | memory_set_bankptr(machine, "bank1", messram_get_ptr(m | |
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | |
| r8453 | r8454 | |
| 233 | 233 | if (LOG_PORT80 && (offset == 0)) |
| 234 | 234 | { |
| 235 | 235 | logerror(" at_page8_w(): Port 80h <== 0x%02x (PC=0x%08x)\n", data, |
| 236 | (unsigned) cpu_get_reg( | |
| 236 | (unsigned) cpu_get_reg( | |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | switch(offset % 8) { |
| r8453 | r8454 | |
| 421 | 421 | { |
| 422 | 422 | at_state *st = (at_state *)machine->driver_data; |
| 423 | 423 | pic8259_ir6_w(st->pic8259_master, state); |
| 424 | //if ( messram_get_ptr(devtag_get_device(machine, "messram"))[0x0490] == 0x74 ) | |
| 425 | // messram_get_ptr(devtag_get_device(machine, "messram"))[0x0490] = 0x54; | |
| 424 | //if ( messram_get_ptr(machine->device("messram"))[0x0490] == 0x74 ) | |
| 425 | // messram_get_ptr(machine->device("messram"))[0x0490] = 0x54; | |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | |
| r8453 | r8454 | |
| 434 | 434 | |
| 435 | 435 | static running_device *at_get_device(running_machine *machine) |
| 436 | 436 | { |
| 437 | return | |
| 437 | return m | |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | static const struct pc_fdc_interface fdc_interface = |
| r8453 | r8454 | |
| 497 | 497 | |
| 498 | 498 | static READ8_HANDLER( at_kbdc8042_p1_r ) |
| 499 | 499 | { |
| 500 | //logerror("%04x: reading P1\n", cpu_get_pc( | |
| 500 | //logerror("%04x: reading P1\n", cpu_get_pc( | |
| 501 | 501 | return 0xFF; |
| 502 | 502 | } |
| 503 | 503 | |
| r8453 | r8454 | |
| 511 | 511 | static WRITE8_HANDLER( at_kbdc8042_p2_w ) |
| 512 | 512 | { |
| 513 | 513 | at_state *st = (at_state *)space->machine->driver_data; |
| 514 | running_device *keyboard = | |
| 514 | running_device *keyboard = | |
| 515 | 515 | |
| 516 | //logerror("%04x: writing $%02x to P2\n", cpu_get_pc( | |
| 516 | //logerror("%04x: writing $%02x to P2\n", cpu_get_pc( | |
| 517 | 517 | |
| 518 | 518 | at_set_gate_a20( space->machine, ( data & 0x02 ) ? 1 : 0 ); |
| 519 | 519 | |
| r8453 | r8454 | |
| 577 | 577 | switch ( offset ) |
| 578 | 578 | { |
| 579 | 579 | case 0: /* A2 is wired to 8042 A0 */ |
| 580 | data = upi41_master_r( | |
| 580 | data = upi41_master_r( | |
| 581 | 581 | break; |
| 582 | 582 | |
| 583 | 583 | case 1: |
| r8453 | r8454 | |
| 606 | 606 | break; |
| 607 | 607 | |
| 608 | 608 | case 4: /* A2 is wired to 8042 A0 */ |
| 609 | data = upi41_master_r( | |
| 609 | data = upi41_master_r( | |
| 610 | 610 | break; |
| 611 | 611 | } |
| 612 | 612 | |
| r8453 | r8454 | |
| 624 | 624 | |
| 625 | 625 | switch (offset) { |
| 626 | 626 | case 0: /* A2 is wired to 8042 A0 */ |
| 627 | upi41_master_w( | |
| 627 | upi41_master_w( | |
| 628 | 628 | break; |
| 629 | 629 | |
| 630 | 630 | case 1: |
| r8453 | r8454 | |
| 635 | 635 | |
| 636 | 636 | case 4: /* A2 is wired to 8042 A0 */ |
| 637 | 637 | //printf("8042 command %02x\n", data ); |
| 638 | upi41_master_w( | |
| 638 | upi41_master_w( | |
| 639 | 639 | break; |
| 640 | 640 | } |
| 641 | 641 | } |
| r8453 | r8454 | |
| 765 | 765 | |
| 766 | 766 | MACHINE_START( at ) |
| 767 | 767 | { |
| 768 | cpu_set_irq_callback( | |
| 768 | cpu_set_irq_callback(m | |
| 769 | 769 | /* FDC/HDC hardware */ |
| 770 | 770 | pc_fdc_init( machine, &fdc_interface ); |
| 771 | 771 | pc_hdc_setup(machine, pc_set_irq_line); |
| r8453 | r8454 | |
| 776 | 776 | MACHINE_RESET( at ) |
| 777 | 777 | { |
| 778 | 778 | at_state *st = (at_state *)machine->driver_data; |
| 779 | st->maincpu = devtag_get_device(machine, "maincpu"); | |
| 780 | st->pic8259_master = devtag_get_device(machine, "pic8259_master"); | |
| 781 | st->pic8259_slave = devtag_get_device(machine, "pic8259_slave"); | |
| 782 | st->dma8237_1 = devtag_get_device(machine, "dma8237_1"); | |
| 783 | st->dma8237_2 = devtag_get_device(machine, "dma8237_2"); | |
| 784 | st->pit8254 = devtag_get_device(machine, "pit8254"); | |
| 785 | pc_mouse_set_serial_port( devtag_get_device(machine, "ns16450_0") ); | |
| 779 | st->maincpu = machine->device("maincpu"); | |
| 780 | st->pic8259_master = machine->device("pic8259_master"); | |
| 781 | st->pic8259_slave = machine->device("pic8259_slave"); | |
| 782 | st->dma8237_1 = machine->device("dma8237_1"); | |
| 783 | st->dma8237_2 = machine->device("dma8237_2"); | |
| 784 | st->pit8254 = machine->device("pit8254"); | |
| 785 | pc_mouse_set_serial_port( machine->device("ns16450_0") ); | |
| 786 | 786 | pc_hdc_set_dma8237_device( st->dma8237_1 ); |
| 787 | 787 | poll_delay = 4; |
| 788 | 788 | } |
| r8453 | r8454 | |
|---|---|---|
| 36 | 36 | |
| 37 | 37 | static READ8_DEVICE_HANDLER (vector06_8255_portc_r ) |
| 38 | 38 | { |
| 39 | double level = cassette_input(dev | |
| 39 | double level = cassette_input(dev | |
| 40 | 40 | UINT8 retVal = input_port_read(device->machine, "LINE8"); |
| 41 | 41 | if (level > 0) { |
| 42 | 42 | retVal |= 0x10; |
| r8453 | r8454 | |
| 119 | 119 | }; |
| 120 | 120 | |
| 121 | 121 | READ8_HANDLER(vector06_8255_1_r) { |
| 122 | return i8255a_r( | |
| 122 | return i8255a_r( | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | WRITE8_HANDLER(vector06_8255_1_w) { |
| 126 | i8255a_w( | |
| 126 | i8255a_w( | |
| 127 | 127 | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | READ8_HANDLER(vector06_8255_2_r) { |
| 131 | return i8255a_r( | |
| 131 | return i8255a_r( | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | WRITE8_HANDLER(vector06_8255_2_w) { |
| 135 | i8255a_w( | |
| 135 | i8255a_w( | |
| 136 | 136 | |
| 137 | 137 | } |
| 138 | 138 | |
| r8453 | r8454 | |
| 156 | 156 | UINT8 val = input_port_read(machine, "RESET"); |
| 157 | 157 | if ((val & 1)==1) { |
| 158 | 158 | memory_set_bankptr(machine, "bank1", memory_region(machine, "maincpu") + 0x10000); |
| 159 | | |
| 159 | m | |
| 160 | 160 | } |
| 161 | 161 | if ((val & 2)==2) { |
| 162 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x0000); | |
| 163 | devtag_get_device(machine, "maincpu")->reset(); | |
| 162 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram")) + 0x0000); | |
| 163 | machine->device("maincpu")->reset(); | |
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | WRITE8_HANDLER(vector06_disc_w) |
| 168 | 168 | { |
| 169 | running_device *fdc = | |
| 169 | running_device *fdc = | |
| 170 | 170 | wd17xx_set_side (fdc,((data & 4) >> 2) ^ 1); |
| 171 | 171 | wd17xx_set_drive(fdc,data & 1); |
| 172 | 172 | } |
| r8453 | r8454 | |
| 180 | 180 | { |
| 181 | 181 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 182 | 182 | |
| 183 | cpu_set_irq_callback( | |
| 183 | cpu_set_irq_callback(m | |
| 184 | 184 | memory_install_read_bank (space, 0x0000, 0x7fff, 0, 0, "bank1"); |
| 185 | 185 | memory_install_write_bank(space, 0x0000, 0x7fff, 0, 0, "bank2"); |
| 186 | 186 | memory_install_read_bank (space, 0x8000, 0xffff, 0, 0, "bank3"); |
| 187 | 187 | memory_install_write_bank(space, 0x8000, 0xffff, 0, 0, "bank4"); |
| 188 | 188 | |
| 189 | 189 | memory_set_bankptr(machine, "bank1", memory_region(machine, "maincpu") + 0x10000); |
| 190 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x0000); | |
| 191 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x8000); | |
| 192 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x8000); | |
| 190 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0x0000); | |
| 191 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x8000); | |
| 192 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x8000); | |
| 193 | 193 | |
| 194 | 194 | vector06_keyboard_mask = 0; |
| 195 | 195 | vector06_color_index = 0; |
| r8453 | r8454 | |
|---|---|---|
| 85 | 85 | */ |
| 86 | 86 | int ti99_usbsm_reset(running_machine *machine, int in_tms9995_mode) |
| 87 | 87 | { |
| 88 | expansion_box = | |
| 88 | expansion_box = m | |
| 89 | 89 | ti99_peb_set_card_handlers(expansion_box, 0x1600, & usbsm_handlers); |
| 90 | 90 | |
| 91 | 91 | feeprom_page = 0; |
| r8453 | r8454 | |
| 103 | 103 | static int usbsm_cru_r(running_machine *machine, int offset) |
| 104 | 104 | { |
| 105 | 105 | int reply = 0; |
| 106 | running_device *smartmedia = | |
| 106 | running_device *smartmedia =m | |
| 107 | 107 | offset &= 3; |
| 108 | 108 | |
| 109 | 109 | switch (offset) |
| r8453 | r8454 | |
| 227 | 227 | static UINT16 usbsm_mem_16_r(const address_space* space,offs_t offset) |
| 228 | 228 | { |
| 229 | 229 | UINT16 reply = 0; |
| 230 | running_device *smartmedia = | |
| 230 | running_device *smartmedia = | |
| 231 | 231 | if (offset < 0x800) |
| 232 | 232 | { /* 0x4000-0x4fff range */ |
| 233 | 233 | if ((cru_register & cru_reg_io_regs_enable) && (offset >= 0x7f8)) |
| r8453 | r8454 | |
| 260 | 260 | */ |
| 261 | 261 | static void usbsm_mem_16_w(const address_space* space,offs_t offset, UINT16 data) |
| 262 | 262 | { |
| 263 | running_device *smartmedia = | |
| 263 | running_device *smartmedia = | |
| 264 | 264 | if (offset < 0x800) |
| 265 | 265 | { /* 0x4000-0x4fff range */ |
| 266 | 266 | if ((cru_register & cru_reg_io_regs_enable) && (offset >= 0x7f8)) |
| r8453 | r8454 | |
|---|---|---|
| 17 | 17 | |
| 18 | 18 | static running_device *cassette_device_image( running_machine *machine ) |
| 19 | 19 | { |
| 20 | return | |
| 20 | return m | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | static void electron_tape_start( void ) |
| r8453 | r8454 | |
| 179 | 179 | |
| 180 | 180 | WRITE8_HANDLER( electron_ula_w ) |
| 181 | 181 | { |
| 182 | running_device *speaker = | |
| 182 | running_device *speaker = | |
| 183 | 183 | int i = electron_palette_offset[(( offset >> 1 ) & 0x03)]; |
| 184 | 184 | logerror( "ULA: write offset %02x <- %02x\n", offset & 0x0f, data ); |
| 185 | 185 | switch( offset & 0x0f ) |
| r8453 | r8454 | |
| 317 | 317 | |
| 318 | 318 | static TIMER_CALLBACK(setup_beep) |
| 319 | 319 | { |
| 320 | running_device *speaker = | |
| 320 | running_device *speaker = m | |
| 321 | 321 | beep_set_state( speaker, 0 ); |
| 322 | 322 | beep_set_frequency( speaker, 300 ); |
| 323 | 323 | } |
| r8453 | r8454 | |
|---|---|---|
| 231 | 231 | switch( id ) |
| 232 | 232 | { |
| 233 | 233 | case 0: |
| 234 | img = dynamic_cast<device_image_interface *>( | |
| 234 | img = dynamic_cast<device_image_interface *>(m | |
| 235 | 235 | break; |
| 236 | 236 | case 1: |
| 237 | img = dynamic_cast<device_image_interface *>( | |
| 237 | img = dynamic_cast<device_image_interface *>(m | |
| 238 | 238 | break; |
| 239 | 239 | case 2: |
| 240 | img = dynamic_cast<device_image_interface *>( | |
| 240 | img = dynamic_cast<device_image_interface *>(m | |
| 241 | 241 | break; |
| 242 | 242 | case 3: |
| 243 | img = dynamic_cast<device_image_interface *>( | |
| 243 | img = dynamic_cast<device_image_interface *>(m | |
| 244 | 244 | break; |
| 245 | 245 | } |
| 246 | 246 |
| r8453 | r8454 | |
|---|---|---|
| 69 | 69 | |
| 70 | 70 | READ8_HANDLER ( orion128_system_r ) |
| 71 | 71 | { |
| 72 | return i8255a_r( | |
| 72 | return i8255a_r( | |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | WRITE8_HANDLER ( orion128_system_w ) |
| 76 | 76 | { |
| 77 | i8255a_w( | |
| 77 | i8255a_w( | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | READ8_HANDLER ( orion128_romdisk_r ) |
| 81 | 81 | { |
| 82 | return i8255a_r( | |
| 82 | return i8255a_r( | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | WRITE8_HANDLER ( orion128_romdisk_w ) |
| 86 | 86 | { |
| 87 | i8255a_w( | |
| 87 | i8255a_w( | |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | static void orion_set_video_mode(running_machine *machine, int width) |
| r8453 | r8454 | |
| 159 | 159 | { |
| 160 | 160 | if (data!=orion128_memory_page ) |
| 161 | 161 | { |
| 162 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr( | |
| 162 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr( | |
| 163 | 163 | orion128_memory_page = (data & 3); |
| 164 | 164 | } |
| 165 | 165 | } |
| r8453 | r8454 | |
| 170 | 170 | orion128_video_mode = 0; |
| 171 | 171 | orion128_memory_page = -1; |
| 172 | 172 | memory_set_bankptr(machine, "bank1", memory_region(machine, "maincpu") + 0xf800); |
| 173 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 173 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 174 | 174 | orion128_video_width = SCREEN_WIDTH_384; |
| 175 | 175 | orion_set_video_mode(machine,384); |
| 176 | 176 | radio86_init_keyboard(); |
| r8453 | r8454 | |
| 178 | 178 | |
| 179 | 179 | static WRITE8_HANDLER ( orion_disk_control_w ) |
| 180 | 180 | { |
| 181 | running_device *fdc = | |
| 181 | running_device *fdc = | |
| 182 | 182 | |
| 183 | 183 | wd17xx_set_side(fdc,((data & 0x10) >> 4) ^ 1); |
| 184 | 184 | wd17xx_set_drive(fdc,data & 3); |
| r8453 | r8454 | |
| 186 | 186 | |
| 187 | 187 | READ8_HANDLER ( orion128_floppy_r ) |
| 188 | 188 | { |
| 189 | running_device *fdc = | |
| 189 | running_device *fdc = | |
| 190 | 190 | |
| 191 | 191 | switch(offset) |
| 192 | 192 | { |
| r8453 | r8454 | |
| 204 | 204 | |
| 205 | 205 | WRITE8_HANDLER ( orion128_floppy_w ) |
| 206 | 206 | { |
| 207 | running_device *fdc = | |
| 207 | running_device *fdc = | |
| 208 | 208 | |
| 209 | 209 | switch(offset) |
| 210 | 210 | { |
| r8453 | r8454 | |
| 255 | 255 | static UINT8 orion_speaker; |
| 256 | 256 | WRITE8_HANDLER ( orionz80_sound_w ) |
| 257 | 257 | { |
| 258 | running_device *speaker = | |
| 258 | running_device *speaker = | |
| 259 | 259 | if (orion_speaker == 0) |
| 260 | 260 | { |
| 261 | 261 | orion_speaker = data; |
| r8453 | r8454 | |
| 270 | 270 | |
| 271 | 271 | static WRITE8_HANDLER ( orionz80_sound_fe_w ) |
| 272 | 272 | { |
| 273 | running_device *speaker = | |
| 273 | running_device *speaker = | |
| 274 | 274 | speaker_level_w(speaker,(data>>4) & 0x01); |
| 275 | 275 | } |
| 276 | 276 | |
| r8453 | r8454 | |
| 287 | 287 | memory_install_write_bank(space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 288 | 288 | if ((orionz80_dispatcher & 0x80)==0) |
| 289 | 289 | { // dispatcher on |
| 290 | memory_set_bankptr(machine, "bank1", messram_get_ptr( | |
| 290 | memory_set_bankptr(machine, "bank1", messram_get_ptr(m | |
| 291 | 291 | } |
| 292 | 292 | else |
| 293 | 293 | { // dispatcher off |
| 294 | memory_set_bankptr(machine, "bank1", messram_get_ptr( | |
| 294 | memory_set_bankptr(machine, "bank1", messram_get_ptr(m | |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 297 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 298 | 298 | |
| 299 | 299 | if ((orionz80_dispatcher & 0x20) == 0) |
| 300 | 300 | { |
| r8453 | r8454 | |
| 312 | 312 | memory_unmap_write(space, 0xfc00, 0xfeff, 0, 0); |
| 313 | 313 | memory_install_write8_handler(space, 0xff00, 0xffff, 0, 0, orionz80_sound_w); |
| 314 | 314 | |
| 315 | memory_set_bankptr(machine, "bank3", messram_get_ptr( | |
| 315 | memory_set_bankptr(machine, "bank3", messram_get_ptr(m | |
| 316 | 316 | memory_set_bankptr(machine, "bank5", memory_region(machine, "maincpu") + 0xf800); |
| 317 | 317 | |
| 318 | 318 | } |
| 319 | 319 | else |
| 320 | 320 | { |
| 321 | 321 | /* if it is full memory access */ |
| 322 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xf000 + 0x10000 * orionz80_memory_page); | |
| 323 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xf400 + 0x10000 * orionz80_memory_page); | |
| 324 | memory_set_bankptr(machine, "bank5", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xf800 + 0x10000 * orionz80_memory_page); | |
| 322 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0xf000 + 0x10000 * orionz80_memory_page); | |
| 323 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0xf400 + 0x10000 * orionz80_memory_page); | |
| 324 | memory_set_bankptr(machine, "bank5", messram_get_ptr(machine->device("messram")) + 0xf800 + 0x10000 * orionz80_memory_page); | |
| 325 | 325 | } |
| 326 | 326 | } |
| 327 | 327 | |
| r8453 | r8454 | |
| 361 | 361 | |
| 362 | 362 | |
| 363 | 363 | memory_set_bankptr(machine, "bank1", memory_region(machine, "maincpu") + 0xf800); |
| 364 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 365 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xf000); | |
| 364 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 365 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0xf000); | |
| 366 | 366 | memory_set_bankptr(machine, "bank5", memory_region(machine, "maincpu") + 0xf800); |
| 367 | 367 | |
| 368 | 368 | |
| r8453 | r8454 | |
| 388 | 388 | { |
| 389 | 389 | if (offset == 0xFFFD) |
| 390 | 390 | { |
| 391 | return ay8910_r ( | |
| 391 | return ay8910_r ( | |
| 392 | 392 | } |
| 393 | 393 | return 0xff; |
| 394 | 394 | } |
| r8453 | r8454 | |
| 406 | 406 | } |
| 407 | 407 | switch(offset) |
| 408 | 408 | { |
| 409 | case 0xfffd : ay8910_address_w( | |
| 409 | case 0xfffd : ay8910_address_w( | |
| 410 | 410 | break; |
| 411 | 411 | case 0xbffd : |
| 412 | case 0xbefd : ay8910_data_w( | |
| 412 | case 0xbefd : ay8910_data_w( | |
| 413 | 413 | break; |
| 414 | 414 | } |
| 415 | 415 | } |
| r8453 | r8454 | |
| 449 | 449 | |
| 450 | 450 | if ((orionpro_dispatcher & 0x01)==0x00) |
| 451 | 451 | { // RAM0 segment disabled |
| 452 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x10000 * page); | |
| 453 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x10000 * page + 0x2000); | |
| 452 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram")) + 0x10000 * page); | |
| 453 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0x10000 * page + 0x2000); | |
| 454 | 454 | } |
| 455 | 455 | else |
| 456 | 456 | { |
| 457 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram")) + (orionpro_ram0_segment & 31) * 0x4000); | |
| 458 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + (orionpro_ram0_segment & 31) * 0x4000 + 0x2000); | |
| 457 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram")) + (orionpro_ram0_segment & 31) * 0x4000); | |
| 458 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + (orionpro_ram0_segment & 31) * 0x4000 + 0x2000); | |
| 459 | 459 | } |
| 460 | 460 | if ((orionpro_dispatcher & 0x10)==0x10) |
| 461 | 461 | { // ROM1 enabled |
| r8453 | r8454 | |
| 470 | 470 | |
| 471 | 471 | if ((orionpro_dispatcher & 0x02)==0x00) |
| 472 | 472 | { // RAM1 segment disabled |
| 473 | memory_set_bankptr(machine, "bank3", messram_get_ptr( | |
| 473 | memory_set_bankptr(machine, "bank3", messram_get_ptr(m | |
| 474 | 474 | } |
| 475 | 475 | else |
| 476 | 476 | { |
| 477 | memory_set_bankptr(machine, "bank3", messram_get_ptr( | |
| 477 | memory_set_bankptr(machine, "bank3", messram_get_ptr(m | |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | if ((orionpro_dispatcher & 0x04)==0x00) |
| 481 | 481 | { // RAM2 segment disabled |
| 482 | memory_set_bankptr(machine, "bank4", messram_get_ptr( | |
| 482 | memory_set_bankptr(machine, "bank4", messram_get_ptr(m | |
| 483 | 483 | } |
| 484 | 484 | else |
| 485 | 485 | { |
| 486 | memory_set_bankptr(machine, "bank4", messram_get_ptr( | |
| 486 | memory_set_bankptr(machine, "bank4", messram_get_ptr(m | |
| 487 | 487 | } |
| 488 | 488 | |
| 489 | memory_set_bankptr(machine, "bank5", messram_get_ptr( | |
| 489 | memory_set_bankptr(machine, "bank5", messram_get_ptr(m | |
| 490 | 490 | |
| 491 | 491 | if (is128) |
| 492 | 492 | { |
| 493 | memory_set_bankptr(machine, "bank6", messram_get_ptr( | |
| 493 | memory_set_bankptr(machine, "bank6", messram_get_ptr(m | |
| 494 | 494 | |
| 495 | 495 | memory_install_write8_handler(space, 0xf400, 0xf4ff, 0, 0, orion128_system_w); |
| 496 | 496 | memory_install_write8_handler(space, 0xf500, 0xf5ff, 0, 0, orion128_romdisk_w); |
| r8453 | r8454 | |
| 508 | 508 | memory_install_write8_handler(space, 0xff00, 0xffff, 0, 0, orionz80_sound_w); |
| 509 | 509 | |
| 510 | 510 | |
| 511 | memory_set_bankptr(machine, "bank8", messram_get_ptr( | |
| 511 | memory_set_bankptr(machine, "bank8", messram_get_ptr(m | |
| 512 | 512 | } |
| 513 | 513 | else |
| 514 | 514 | { |
| 515 | 515 | if ((orionpro_dispatcher & 0x40)==0x40) |
| 516 | 516 | { // FIX F000 enabled |
| 517 | memory_set_bankptr(machine, "bank6", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x10000 * 0 + 0xf000); | |
| 518 | memory_set_bankptr(machine, "bank7", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x10000 * 0 + 0xf400); | |
| 519 | memory_set_bankptr(machine, "bank8", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x10000 * 0 + 0xf800); | |
| 517 | memory_set_bankptr(machine, "bank6", messram_get_ptr(machine->device("messram")) + 0x10000 * 0 + 0xf000); | |
| 518 | memory_set_bankptr(machine, "bank7", messram_get_ptr(machine->device("messram")) + 0x10000 * 0 + 0xf400); | |
| 519 | memory_set_bankptr(machine, "bank8", messram_get_ptr(machine->device("messram")) + 0x10000 * 0 + 0xf800); | |
| 520 | 520 | } |
| 521 | 521 | else |
| 522 | 522 | { |
| 523 | memory_set_bankptr(machine, "bank6", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x10000 * page + 0xf000); | |
| 524 | memory_set_bankptr(machine, "bank7", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x10000 * page + 0xf400); | |
| 525 | memory_set_bankptr(machine, "bank8", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x10000 * page + 0xf800); | |
| 523 | memory_set_bankptr(machine, "bank6", messram_get_ptr(machine->device("messram")) + 0x10000 * page + 0xf000); | |
| 524 | memory_set_bankptr(machine, "bank7", messram_get_ptr(machine->device("messram")) + 0x10000 * page + 0xf400); | |
| 525 | memory_set_bankptr(machine, "bank8", messram_get_ptr(machine->device("messram")) + 0x10000 * page + 0xf800); | |
| 526 | 526 | } |
| 527 | 527 | } |
| 528 | 528 | } |
| r8453 | r8454 | |
| 560 | 560 | |
| 561 | 561 | READ8_HANDLER ( orionpro_io_r ) |
| 562 | 562 | { |
| 563 | running_device *fdc = | |
| 563 | running_device *fdc = | |
| 564 | 564 | |
| 565 | 565 | switch (offset & 0xff) |
| 566 | 566 | { |
| r8453 | r8454 | |
| 587 | 587 | } |
| 588 | 588 | if (offset == 0xFFFD) |
| 589 | 589 | { |
| 590 | return ay8910_r ( | |
| 590 | return ay8910_r ( | |
| 591 | 591 | } |
| 592 | 592 | return 0xff; |
| 593 | 593 | } |
| 594 | 594 | |
| 595 | 595 | WRITE8_HANDLER ( orionpro_io_w ) |
| 596 | 596 | { |
| 597 | running_device *fdc = | |
| 597 | running_device *fdc = | |
| 598 | 598 | |
| 599 | 599 | switch (offset & 0xff) |
| 600 | 600 | { |
| r8453 | r8454 | |
| 627 | 627 | } |
| 628 | 628 | switch(offset) |
| 629 | 629 | { |
| 630 | case 0xfffd : ay8910_address_w( | |
| 630 | case 0xfffd : ay8910_address_w( | |
| 631 | 631 | break; |
| 632 | 632 | case 0xbffd : |
| 633 | case 0xbefd : ay8910_data_w( | |
| 633 | case 0xbefd : ay8910_data_w( | |
| 634 | 634 | break; |
| 635 | 635 | } |
| 636 | 636 | } |
| r8453 | r8454 | |
|---|---|---|
| 663 | 663 | amiga_fdc_t *fdc = get_safe_token((running_device*)ptr); |
| 664 | 664 | |
| 665 | 665 | /* Issue a index pulse when a disk revolution completes */ |
| 666 | cia = | |
| 666 | cia = m | |
| 667 | 667 | mos6526_flag_w(cia, 0); |
| 668 | 668 | mos6526_flag_w(cia, 1); |
| 669 | 669 |
| r8453 | r8454 | |
|---|---|---|
| 84 | 84 | |
| 85 | 85 | MACHINE_RESET( bk0010 ) |
| 86 | 86 | { |
| 87 | cpu_set_irq_callback( | |
| 87 | cpu_set_irq_callback(m | |
| 88 | 88 | |
| 89 | 89 | kbd_state = 0; |
| 90 | 90 | bk_scrool = 01330; |
| r8453 | r8454 | |
| 107 | 107 | |
| 108 | 108 | READ16_HANDLER (bk_key_press_r) |
| 109 | 109 | { |
| 110 | double level = cassette_input( | |
| 110 | double level = cassette_input( | |
| 111 | 111 | UINT16 cas; |
| 112 | 112 | if (level < 0) |
| 113 | 113 | { |
| r8453 | r8454 | |
|---|---|---|
| 1217 | 1217 | /* find devices */ |
| 1218 | 1218 | c1541->via0 = device->subdevice(M6522_0_TAG); |
| 1219 | 1219 | c1541->via1 = device->subdevice(M6522_1_TAG); |
| 1220 | c1541->bus = dev | |
| 1220 | c1541->bus = dev | |
| 1221 | 1221 | c1541->image = device->subdevice(FLOPPY_0); |
| 1222 | 1222 | |
| 1223 | 1223 | /* install image callbacks */ |
| r8453 | r8454 | |
|---|---|---|
| 125 | 125 | /* pokey cartridge */ |
| 126 | 126 | if (a7800_cart_type & 0x01) |
| 127 | 127 | { |
| 128 | running_device *pokey = | |
| 128 | running_device *pokey = m | |
| 129 | 129 | memory_install_read8_device_handler(space, pokey, 0x4000, 0x7FFF, 0, 0, pokey_r); |
| 130 | 130 | memory_install_write8_device_handler(space, pokey, 0x4000, 0x7FFF, 0, 0, pokey_w); |
| 131 | 131 | } |
| r8453 | r8454 | |
| 348 | 348 | } |
| 349 | 349 | else if(a7800_cart_type & 0x01) |
| 350 | 350 | { |
| 351 | running_device *pokey = | |
| 351 | running_device *pokey = | |
| 352 | 352 | pokey_w(pokey, offset, data); |
| 353 | 353 | } |
| 354 | 354 | else |
| r8453 | r8454 | |
| 452 | 452 | } |
| 453 | 453 | break; |
| 454 | 454 | } |
| 455 | tia_sound_w( | |
| 455 | tia_sound_w( | |
| 456 | 456 | ROM[offset] = data; |
| 457 | 457 | } |
| r8453 | r8454 | |
|---|---|---|
| 175 | 175 | |
| 176 | 176 | /* find device */ |
| 177 | 177 | (*tailptr)->next = NULL; |
| 178 | (*tailptr)->device = dev | |
| 178 | (*tailptr)->device = dev | |
| 179 | 179 | |
| 180 | 180 | if ((*tailptr)->device == NULL) |
| 181 | 181 | { |
| r8453 | r8454 | |
|---|---|---|
| 22 | 22 | static void kbd_sendscancode( running_machine *machine, UINT8 scancode ) |
| 23 | 23 | { |
| 24 | 24 | int j; |
| 25 | running_device *cia = | |
| 25 | running_device *cia = m | |
| 26 | 26 | |
| 27 | 27 | /* send over to the cia A */ |
| 28 | 28 | for( j = 0; j < 8; j++ ) |
| r8453 | r8454 | |
|---|---|---|
| 67 | 67 | memset(&cd, 0, sizeof( matsucd ) ); |
| 68 | 68 | |
| 69 | 69 | cd.cdrom = mess_cd_get_cdrom_file( cdrom_device ); |
| 70 | cd.cdda = | |
| 70 | cd.cdda = | |
| 71 | 71 | |
| 72 | 72 | cd.frame_timer = timer_alloc(cdrom_device->machine, matsu_subcode_proc, NULL); |
| 73 | 73 |
| r8453 | r8454 | |
|---|---|---|
| 83 | 83 | |
| 84 | 84 | WRITE8_HANDLER( nascom2_fdc_select_w ) |
| 85 | 85 | { |
| 86 | running_device *fdc = | |
| 86 | running_device *fdc = | |
| 87 | 87 | nascom2_fdc.select = data; |
| 88 | 88 | |
| 89 | 89 | logerror("nascom2_fdc_select_w: %02x\n", data); |
| r8453 | r8454 | |
| 128 | 128 | WRITE8_HANDLER( nascom1_port_00_w ) |
| 129 | 129 | { |
| 130 | 130 | |
| 131 | cassette_change_state( | |
| 131 | cassette_change_state( | |
| 132 | 132 | ( data & 0x10 ) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR ); |
| 133 | 133 | |
| 134 | 134 | if (!(data & NASCOM1_KEY_RESET)) |
| r8453 | r8454 | |
| 259 | 259 | |
| 260 | 260 | MACHINE_RESET( nascom1 ) |
| 261 | 261 | { |
| 262 | nascom1_hd6402 = | |
| 262 | nascom1_hd6402 = m | |
| 263 | 263 | |
| 264 | 264 | /* Set up hd6402 pins */ |
| 265 | 265 | ay31015_set_input_pin( nascom1_hd6402, AY31015_SWE, 1 ); |
| r8453 | r8454 | |
| 275 | 275 | |
| 276 | 276 | DRIVER_INIT( nascom1 ) |
| 277 | 277 | { |
| 278 | switch (messram_get_size( | |
| 278 | switch (messram_get_size(m | |
| 279 | 279 | { |
| 280 | 280 | case 1 * 1024: |
| 281 | 281 | memory_nop_readwrite(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), |
| r8453 | r8454 | |
| 287 | 287 | 0x1400, 0x4fff, 0, 0, "bank1"); |
| 288 | 288 | memory_nop_readwrite(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), |
| 289 | 289 | 0x5000, 0xafff, 0, 0); |
| 290 | memory_set_bankptr(machine, "bank1", messram_get_ptr( | |
| 290 | memory_set_bankptr(machine, "bank1", messram_get_ptr(m | |
| 291 | 291 | break; |
| 292 | 292 | |
| 293 | 293 | case 32 * 1024: |
| r8453 | r8454 | |
| 295 | 295 | 0x1400, 0x8fff, 0, 0, "bank1"); |
| 296 | 296 | memory_nop_readwrite(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), |
| 297 | 297 | 0x9000, 0xafff, 0, 0); |
| 298 | memory_set_bankptr(machine, "bank1", messram_get_ptr( | |
| 298 | memory_set_bankptr(machine, "bank1", messram_get_ptr(m | |
| 299 | 299 | break; |
| 300 | 300 | |
| 301 | 301 | case 40 * 1024: |
| 302 | 302 | memory_install_readwrite_bank(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), |
| 303 | 303 | 0x1400, 0xafff, 0, 0, "bank1"); |
| 304 | memory_set_bankptr(machine, "bank1", messram_get_ptr( | |
| 304 | memory_set_bankptr(machine, "bank1", messram_get_ptr(m | |
| 305 | 305 | break; |
| 306 | 306 | } |
| 307 | 307 | } |
| r8453 | r8454 | |
|---|---|---|
| 393 | 393 | |
| 394 | 394 | static VIDEO_UPDATE(terminal ) |
| 395 | 395 | { |
| 396 | running_device *devconf = | |
| 396 | running_device *devconf = | |
| 397 | 397 | generic_terminal_update( devconf, bitmap, cliprect); |
| 398 | 398 | return 0; |
| 399 | 399 | } |
| r8453 | r8454 | |
|---|---|---|
| 161 | 161 | |
| 162 | 162 | static running_device *cassette_device_image(running_machine *machine) |
| 163 | 163 | { |
| 164 | return | |
| 164 | return m | |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /************************************************************** |
| r8453 | r8454 | |
| 340 | 340 | static TIMER_CALLBACK(microtan_read_cassette) |
| 341 | 341 | { |
| 342 | 342 | double level = cassette_input(cassette_device_image(machine)); |
| 343 | running_device *via_0 = | |
| 343 | running_device *via_0 = m | |
| 344 | 344 | |
| 345 | 345 | LOG(("microtan_read_cassette: %g\n", level)); |
| 346 | 346 | if (level < -0.07) |
| r8453 | r8454 | |
|---|---|---|
| 159 | 159 | amiga_ar1_spurious = 0; |
| 160 | 160 | |
| 161 | 161 | /* Install IRQ ACK callback */ |
| 162 | cpu_set_irq_callback( | |
| 162 | cpu_set_irq_callback(m | |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /*************************************************************************** |
| r8453 | r8454 | |
| 255 | 255 | |
| 256 | 256 | static void amiga_ar23_freeze( running_machine *machine ) |
| 257 | 257 | { |
| 258 | int pc = cpu_get_pc( | |
| 258 | int pc = cpu_get_pc(m | |
| 259 | 259 | |
| 260 | 260 | /* only freeze if we're not inside the cart's ROM */ |
| 261 | 261 | if ( ((pc >> 16) & 0xfe ) != 0x40 ) |
| r8453 | r8454 | |
|---|---|---|
| 57 | 57 | /* Check whether regular RAM is enabled */ |
| 58 | 58 | if ( ! osborne1.bank2_enabled || ( osborne1.in_irq_handler && osborne1.bankswitch == RAMMODE ) ) |
| 59 | 59 | { |
| 60 | messram_get_ptr( | |
| 60 | messram_get_ptr( | |
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
| r8453 | r8454 | |
| 67 | 67 | /* Check whether regular RAM is enabled */ |
| 68 | 68 | if ( ! osborne1.bank2_enabled || ( osborne1.in_irq_handler && osborne1.bankswitch == RAMMODE ) ) |
| 69 | 69 | { |
| 70 | messram_get_ptr( | |
| 70 | messram_get_ptr( | |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
| r8453 | r8454 | |
| 75 | 75 | READ8_HANDLER( osborne1_2000_r ) |
| 76 | 76 | { |
| 77 | 77 | UINT8 data = 0xFF; |
| 78 | running_device *fdc = devtag_get_device(space->machine, "mb8877"); | |
| 79 | running_device *pia_0 = devtag_get_device(space->machine, "pia_0" ); | |
| 80 | running_device *pia_1 = devtag_get_device(space->machine, "pia_1" ); | |
| 78 | running_device *fdc = space->machine->device("mb8877"); | |
| 79 | running_device *pia_0 = space->machine->device("pia_0" ); | |
| 80 | running_device *pia_1 = space->machine->device("pia_1" ); | |
| 81 | 81 | |
| 82 | 82 | /* Check whether regular RAM is enabled */ |
| 83 | 83 | if ( ! osborne1.bank2_enabled ) |
| 84 | 84 | { |
| 85 | data = messram_get_ptr( | |
| 85 | data = messram_get_ptr( | |
| 86 | 86 | } |
| 87 | 87 | else |
| 88 | 88 | { |
| r8453 | r8454 | |
| 125 | 125 | |
| 126 | 126 | WRITE8_HANDLER( osborne1_2000_w ) |
| 127 | 127 | { |
| 128 | running_device *fdc = devtag_get_device(space->machine, "mb8877"); | |
| 129 | running_device *pia_0 = devtag_get_device(space->machine, "pia_0" ); | |
| 130 | running_device *pia_1 = devtag_get_device(space->machine, "pia_1" ); | |
| 128 | running_device *fdc = space->machine->device("mb8877"); | |
| 129 | running_device *pia_0 = space->machine->device("pia_0" ); | |
| 130 | running_device *pia_1 = space->machine->device("pia_1" ); | |
| 131 | 131 | |
| 132 | 132 | /* Check whether regular RAM is enabled */ |
| 133 | 133 | if ( ! osborne1.bank2_enabled ) |
| 134 | 134 | { |
| 135 | messram_get_ptr( | |
| 135 | messram_get_ptr( | |
| 136 | 136 | } |
| 137 | 137 | else |
| 138 | 138 | { |
| 139 | 139 | if ( osborne1.in_irq_handler && osborne1.bankswitch == RAMMODE ) |
| 140 | 140 | { |
| 141 | messram_get_ptr( | |
| 141 | messram_get_ptr( | |
| 142 | 142 | } |
| 143 | 143 | /* Handle writes to the I/O area */ |
| 144 | 144 | switch( offset & 0x0F00 ) |
| r8453 | r8454 | |
| 164 | 164 | /* Check whether regular RAM is enabled */ |
| 165 | 165 | if ( ! osborne1.bank2_enabled || ( osborne1.in_irq_handler && osborne1.bankswitch == RAMMODE ) ) |
| 166 | 166 | { |
| 167 | messram_get_ptr( | |
| 167 | messram_get_ptr( | |
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |
| r8453 | r8454 | |
| 209 | 209 | } |
| 210 | 210 | else |
| 211 | 211 | { |
| 212 | memory_set_bankptr(space->machine,"bank1", messram_get_ptr(devtag_get_device(space->machine, "messram")) ); | |
| 213 | memory_set_bankptr(space->machine,"bank2", messram_get_ptr(devtag_get_device(space->machine, "messram")) + 0x1000 ); | |
| 214 | memory_set_bankptr(space->machine,"bank3", messram_get_ptr(devtag_get_device(space->machine, "messram")) + 0x3000 ); | |
| 212 | memory_set_bankptr(space->machine,"bank1", messram_get_ptr(space->machine->device("messram")) ); | |
| 213 | memory_set_bankptr(space->machine,"bank2", messram_get_ptr(space->machine->device("messram")) + 0x1000 ); | |
| 214 | memory_set_bankptr(space->machine,"bank3", messram_get_ptr(space->machine->device("messram")) + 0x3000 ); | |
| 215 | 215 | } |
| 216 | osborne1.bank4_ptr = messram_get_ptr( | |
| 216 | osborne1.bank4_ptr = messram_get_ptr( | |
| 217 | 217 | memory_set_bankptr(space->machine,"bank4", osborne1.bank4_ptr ); |
| 218 | 218 | osborne1.bankswitch = offset; |
| 219 | 219 | osborne1.in_irq_handler = 0; |
| r8453 | r8454 | |
| 227 | 227 | if ( ! osborne1.bank2_enabled ) |
| 228 | 228 | { |
| 229 | 229 | direct->bytemask = 0x0fff; |
| 230 | direct->decrypted = messram_get_ptr(devtag_get_device(space->machine, "messram")) + 0x2000; | |
| 231 | direct->raw = messram_get_ptr(devtag_get_device(space->machine, "messram")) + 0x2000; | |
| 230 | direct->decrypted = messram_get_ptr(space->machine->device("messram")) + 0x2000; | |
| 231 | direct->raw = messram_get_ptr(space->machine->device("messram")) + 0x2000; | |
| 232 | 232 | direct->bytestart = 0x2000; |
| 233 | 233 | direct->byteend = 0x2fff; |
| 234 | 234 | return ~0; |
| r8453 | r8454 | |
| 284 | 284 | |
| 285 | 285 | static WRITE8_DEVICE_HANDLER( video_pia_port_a_w ) |
| 286 | 286 | { |
| 287 | running_device *fdc = dev | |
| 287 | running_device *fdc = dev | |
| 288 | 288 | |
| 289 | 289 | osborne1.new_start_x = data >> 1; |
| 290 | 290 | wd17xx_dden_w(fdc, BIT(data, 0)); |
| r8453 | r8454 | |
| 295 | 295 | |
| 296 | 296 | static WRITE8_DEVICE_HANDLER( video_pia_port_b_w ) |
| 297 | 297 | { |
| 298 | running_device *fdc = dev | |
| 298 | running_device *fdc = dev | |
| 299 | 299 | |
| 300 | 300 | osborne1.new_start_y = data & 0x1F; |
| 301 | 301 | osborne1.beep = ( data & 0x20 ) ? 1 : 0; |
| r8453 | r8454 | |
| 351 | 351 | static TIMER_CALLBACK(osborne1_video_callback) |
| 352 | 352 | { |
| 353 | 353 | const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 354 | running_device *speaker = devtag_get_device(space->machine, "beep"); | |
| 355 | running_device *pia_1 = devtag_get_device(space->machine, "pia_1"); | |
| 354 | running_device *speaker = space->machine->device("beep"); | |
| 355 | running_device *pia_1 = space->machine->device("pia_1"); | |
| 356 | 356 | int y = machine->primary_screen->vpos(); |
| 357 | 357 | |
| 358 | 358 | /* Check for start of frame */ |
| r8453 | r8454 | |
| 377 | 377 | |
| 378 | 378 | for ( x = 0; x < 52; x++ ) |
| 379 | 379 | { |
| 380 | UINT8 character = messram_get_ptr( | |
| 380 | UINT8 character = messram_get_ptr(m | |
| 381 | 381 | UINT8 cursor = character & 0x80; |
| 382 | UINT8 dim = messram_get_ptr( | |
| 382 | UINT8 dim = messram_get_ptr(m | |
| 383 | 383 | UINT8 bits = osborne1.charrom[ osborne1.charline * 128 + ( character & 0x7F ) ]; |
| 384 | 384 | int bit; |
| 385 | 385 | |
| r8453 | r8454 | |
| 416 | 416 | |
| 417 | 417 | static TIMER_CALLBACK( setup_osborne1 ) |
| 418 | 418 | { |
| 419 | running_device *speaker = devtag_get_device(machine, "beep"); | |
| 420 | running_device *pia_1 = devtag_get_device(machine, "pia_1"); | |
| 419 | running_device *speaker = machine->device("beep"); | |
| 420 | running_device *pia_1 = machine->device("pia_1"); | |
| 421 | 421 | |
| 422 | 422 | beep_set_state( speaker, 0 ); |
| 423 | 423 | beep_set_frequency( speaker, 300 /* 60 * 240 / 2 */ ); |
| r8453 | r8454 | |
| 427 | 427 | static void osborne1_load_proc(device_image_interface &image) |
| 428 | 428 | { |
| 429 | 429 | int size = image.length(); |
| 430 | running_device *fdc = | |
| 430 | running_device *fdc = | |
| 431 | 431 | |
| 432 | 432 | switch( size ) |
| 433 | 433 | { |
| r8453 | r8454 | |
| 464 | 464 | |
| 465 | 465 | osborne1.charrom = memory_region( machine, "gfx1" ); |
| 466 | 466 | |
| 467 | memset( messram_get_ptr( | |
| 467 | memset( messram_get_ptr(m | |
| 468 | 468 | |
| 469 | 469 | for(drive=0;drive<2;drive++) |
| 470 | 470 | { |
| r8453 | r8454 | |
|---|---|---|
| 543 | 543 | } |
| 544 | 544 | return; |
| 545 | 545 | } |
| 546 | command = (messram_get_ptr( | |
| 546 | command = (messram_get_ptr(m | |
| 547 | 547 | // logerror("DMA #%i: address %04x: command %04x\n",channel,asic.dma_addr[channel],command); |
| 548 | 548 | switch (command & 0xf000) |
| 549 | 549 | { |
| 550 | 550 | case 0x0000: // Load PSG register |
| 551 | 551 | { |
| 552 | running_device *ay8910 = | |
| 552 | running_device *ay8910 = m | |
| 553 | 553 | ay8910_address_w(ay8910, 0, (command & 0x0f00) >> 8); |
| 554 | 554 | ay8910_data_w(ay8910, 0, command & 0x00ff); |
| 555 | 555 | ay8910_address_w(ay8910, 0, prev_reg); |
| r8453 | r8454 | |
| 644 | 644 | for ( i = 0; i < x_count; i++ ) |
| 645 | 645 | { |
| 646 | 646 | UINT16 address = ( ( ( ma + i ) & 0x3000 ) << 2 ) | ( ( ra & 0x07 ) << 11 ) | ( ( ( ma + i ) & 0x3ff ) << 1 ); |
| 647 | UINT8 data0 = messram_get_ptr(devtag_get_device(device->machine, "messram"))[ address ]; | |
| 648 | UINT8 data1 = messram_get_ptr(devtag_get_device(device->machine, "messram"))[ address + 1 ]; | |
| 647 | UINT8 data0 = messram_get_ptr(device->machine->device("messram"))[ address ]; | |
| 648 | UINT8 data1 = messram_get_ptr(device->machine->device("messram"))[ address + 1 ]; | |
| 649 | 649 | UINT16 c; |
| 650 | 650 | |
| 651 | 651 | c = amstrad_GateArray_render_colours[ mode0_lookup[data0][0] ]; |
| r8453 | r8454 | |
| 669 | 669 | for ( i = 0; i < x_count; i++ ) |
| 670 | 670 | { |
| 671 | 671 | UINT16 address = ( ( ( ma + i ) & 0x3000 ) << 2 ) | ( ( ra & 0x07 ) << 11 ) | ( ( ( ma + i ) & 0x3ff ) << 1 ); |
| 672 | UINT8 data0 = messram_get_ptr(devtag_get_device(device->machine, "messram"))[ address ]; | |
| 673 | UINT8 data1 = messram_get_ptr(devtag_get_device(device->machine, "messram"))[ address + 1 ]; | |
| 672 | UINT8 data0 = messram_get_ptr(device->machine->device("messram"))[ address ]; | |
| 673 | UINT8 data1 = messram_get_ptr(device->machine->device("messram"))[ address + 1 ]; | |
| 674 | 674 | UINT16 c; |
| 675 | 675 | |
| 676 | 676 | c = amstrad_GateArray_render_colours[ mode1_lookup[data0][0] ]; |
| r8453 | r8454 | |
| 702 | 702 | for ( i = 0; i < x_count; i++ ) |
| 703 | 703 | { |
| 704 | 704 | UINT16 address = ( ( ( ma + i ) & 0x3000 ) << 2 ) | ( ( ra & 0x07 ) << 11 ) | ( ( ( ma + i ) & 0x3ff ) << 1 ); |
| 705 | UINT8 data0 = messram_get_ptr(devtag_get_device(device->machine, "messram"))[ address ]; | |
| 706 | UINT8 data1 = messram_get_ptr(devtag_get_device(device->machine, "messram"))[ address + 1 ]; | |
| 705 | UINT8 data0 = messram_get_ptr(device->machine->device("messram"))[ address ]; | |
| 706 | UINT8 data1 = messram_get_ptr(device->machine->device("messram"))[ address + 1 ]; | |
| 707 | 707 | |
| 708 | 708 | *p = amstrad_GateArray_render_colours[ ( data0 & 0x80 ) >> 7 ]; p++; |
| 709 | 709 | *p = amstrad_GateArray_render_colours[ ( data0 & 0x40 ) >> 6 ]; p++; |
| r8453 | r8454 | |
| 734 | 734 | for ( i = 0; i < x_count; i++ ) |
| 735 | 735 | { |
| 736 | 736 | UINT16 address = ( ( ( ma + i ) & 0x3000 ) << 2 ) | ( ( ra & 0x07 ) << 11 ) | ( ( ( ma + i ) & 0x3ff ) << 1 ); |
| 737 | UINT8 data0 = messram_get_ptr(devtag_get_device(device->machine, "messram"))[ address ]; | |
| 738 | UINT8 data1 = messram_get_ptr(devtag_get_device(device->machine, "messram"))[ address + 1 ]; | |
| 737 | UINT8 data0 = messram_get_ptr(device->machine->device("messram"))[ address ]; | |
| 738 | UINT8 data1 = messram_get_ptr(device->machine->device("messram"))[ address + 1 ]; | |
| 739 | 739 | UINT16 c; |
| 740 | 740 | |
| 741 | 741 | c = amstrad_GateArray_render_colours[ mode1_lookup[data0][0] ]; |
| r8453 | r8454 | |
| 787 | 787 | { |
| 788 | 788 | UINT16 address = ( ( ( ma + i ) & 0x3000 ) << 2 ) | ( ( ra & 0x07 ) << 11 ) | ( ( ( ma + i ) & 0x3ff ) << 1 ); |
| 789 | 789 | UINT16 caddr; |
| 790 | UINT8 data0 = messram_get_ptr(devtag_get_device(device->machine, "messram"))[ address ]; | |
| 791 | UINT8 data1 = messram_get_ptr(devtag_get_device(device->machine, "messram"))[ address + 1 ]; | |
| 790 | UINT8 data0 = messram_get_ptr(device->machine->device("messram"))[ address ]; | |
| 791 | UINT8 data1 = messram_get_ptr(device->machine->device("messram"))[ address + 1 ]; | |
| 792 | 792 | |
| 793 | 793 | caddr = 0x2400 + mode0_lookup[data0][0] * 2; |
| 794 | 794 | c = amstrad_plus_asic_ram[caddr] + ( amstrad_plus_asic_ram[caddr+1] << 8 ); |
| r8453 | r8454 | |
| 842 | 842 | { |
| 843 | 843 | UINT16 address = ( ( ( ma + i ) & 0x3000 ) << 2 ) | ( ( ra & 0x07 ) << 11 ) | ( ( ( ma + i ) & 0x3ff ) << 1 ); |
| 844 | 844 | UINT16 caddr; |
| 845 | UINT8 data0 = messram_get_ptr(devtag_get_device(device->machine, "messram"))[ address ]; | |
| 846 | UINT8 data1 = messram_get_ptr(devtag_get_device(device->machine, "messram"))[ address + 1 ]; | |
| 845 | UINT8 data0 = messram_get_ptr(device->machine->device("messram"))[ address ]; | |
| 846 | UINT8 data1 = messram_get_ptr(device->machine->device("messram"))[ address + 1 ]; | |
| 847 | 847 | |
| 848 | 848 | caddr = 0x2400 + mode1_lookup[data0][0] * 2; |
| 849 | 849 | c = amstrad_plus_asic_ram[caddr] + ( amstrad_plus_asic_ram[caddr+1] << 8 ); |
| r8453 | r8454 | |
| 909 | 909 | { |
| 910 | 910 | UINT16 address = ( ( ( ma + i ) & 0x3000 ) << 2 ) | ( ( ra & 0x07 ) << 11 ) | ( ( ( ma + i ) & 0x3ff ) << 1 ); |
| 911 | 911 | UINT16 caddr; |
| 912 | UINT8 data0 = messram_get_ptr(devtag_get_device(device->machine, "messram"))[ address ]; | |
| 913 | UINT8 data1 = messram_get_ptr(devtag_get_device(device->machine, "messram"))[ address + 1 ]; | |
| 912 | UINT8 data0 = messram_get_ptr(device->machine->device("messram"))[ address ]; | |
| 913 | UINT8 data1 = messram_get_ptr(device->machine->device("messram"))[ address + 1 ]; | |
| 914 | 914 | |
| 915 | 915 | caddr = 0x2400 + ( ( data0 & 0x80 ) ? 2 : 0 ); |
| 916 | 916 | c = amstrad_plus_asic_ram[caddr] + ( amstrad_plus_asic_ram[caddr+1] << 8 ); |
| r8453 | r8454 | |
| 1000 | 1000 | { |
| 1001 | 1001 | UINT16 address = ( ( ( ma + i ) & 0x3000 ) << 2 ) | ( ( ra & 0x07 ) << 11 ) | ( ( ( ma + i ) & 0x3ff ) << 1 ); |
| 1002 | 1002 | UINT16 caddr; |
| 1003 | UINT8 data0 = messram_get_ptr(devtag_get_device(device->machine, "messram"))[ address ]; | |
| 1004 | UINT8 data1 = messram_get_ptr(devtag_get_device(device->machine, "messram"))[ address + 1 ]; | |
| 1003 | UINT8 data0 = messram_get_ptr(device->machine->device("messram"))[ address ]; | |
| 1004 | UINT8 data1 = messram_get_ptr(device->machine->device("messram"))[ address + 1 ]; | |
| 1005 | 1005 | |
| 1006 | 1006 | caddr = 0x2400 + mode1_lookup[data0][0] * 2; |
| 1007 | 1007 | c = amstrad_plus_asic_ram[caddr] + ( amstrad_plus_asic_ram[caddr+1] << 8 ); |
| r8453 | r8454 | |
| 1079 | 1079 | for ( i = 0; i < x_count; i++ ) |
| 1080 | 1080 | { |
| 1081 | 1081 | UINT16 address = ( ( ( ma + i ) & 0x2000 ) << 2 ) | ( ( ra & 0x06 ) << 11 ) | ( ( ra & 0x01 ) << 14 ) | ( ( ( ma + i ) & 0x7ff ) << 1 ); |
| 1082 | UINT8 data0 = messram_get_ptr(devtag_get_device(device->machine, "messram"))[ address ]; | |
| 1083 | UINT8 data1 = messram_get_ptr(devtag_get_device(device->machine, "messram"))[ address + 1 ]; | |
| 1082 | UINT8 data0 = messram_get_ptr(device->machine->device("messram"))[ address ]; | |
| 1083 | UINT8 data1 = messram_get_ptr(device->machine->device("messram"))[ address + 1 ]; | |
| 1084 | 1084 | UINT16 c; |
| 1085 | 1085 | |
| 1086 | 1086 | if ( ~ aleste_mode & 0x08 ) |
| r8453 | r8454 | |
| 1125 | 1125 | for ( i = 0; i < x_count; i++ ) |
| 1126 | 1126 | { |
| 1127 | 1127 | UINT16 address = ( ( ( ma + i ) & 0x2000 ) << 2 ) | ( ( ra & 0x06 ) << 11 ) | ( ( ra & 0x01 ) << 14 ) | ( ( ( ma + i ) & 0x7ff ) << 1 ); |
| 1128 | UINT8 data0 = messram_get_ptr(devtag_get_device(device->machine, "messram"))[ address ]; | |
| 1129 | UINT8 data1 = messram_get_ptr(devtag_get_device(device->machine, "messram"))[ address + 1 ]; | |
| 1128 | UINT8 data0 = messram_get_ptr(device->machine->device("messram"))[ address ]; | |
| 1129 | UINT8 data1 = messram_get_ptr(device->machine->device("messram"))[ address + 1 ]; | |
| 1130 | 1130 | UINT16 c; |
| 1131 | 1131 | |
| 1132 | 1132 | if ( ~ aleste_mode & 0x08 ) |
| r8453 | r8454 | |
| 1306 | 1306 | |
| 1307 | 1307 | VIDEO_UPDATE( amstrad ) |
| 1308 | 1308 | { |
| 1309 | running_device *mc6845 = | |
| 1309 | running_device *mc6845 = | |
| 1310 | 1310 | mc6845_update( mc6845, bitmap, cliprect ); |
| 1311 | 1311 | return 0; |
| 1312 | 1312 | } |
| r8453 | r8454 | |
| 1369 | 1369 | { |
| 1370 | 1370 | int pc; |
| 1371 | 1371 | |
| 1372 | pc = cpu_get_pc( | |
| 1372 | pc = cpu_get_pc( | |
| 1373 | 1373 | |
| 1374 | 1374 | /* there are two places where CALL &0065 can be found |
| 1375 | 1375 | in the multiface rom. At this address there is a RET. |
| r8453 | r8454 | |
| 1781 | 1781 | for (i=0;i<4;i++) |
| 1782 | 1782 | { |
| 1783 | 1783 | BankIndex = RamConfigurations[(ConfigurationIndex << 2) + i]; |
| 1784 | BankAddr = messram_get_ptr( | |
| 1784 | BankAddr = messram_get_ptr(m | |
| 1785 | 1785 | Aleste_RamBanks[i] = BankAddr; |
| 1786 | 1786 | AmstradCPC_RamBanks[i] = BankAddr; |
| 1787 | 1787 | } |
| r8453 | r8454 | |
| 1895 | 1895 | if ( asic.enabled ) |
| 1896 | 1896 | { |
| 1897 | 1897 | vector = (data & 0xf8) + (amstrad_plus_irq_cause); |
| 1898 | cpu_set_input_line_vector( | |
| 1898 | cpu_set_input_line_vector( | |
| 1899 | 1899 | logerror("ASIC: IM 2 vector write %02x, data = &%02x\n",vector,data); |
| 1900 | 1900 | } |
| 1901 | 1901 | asic.dma_clear = data & 0x01; |
| r8453 | r8454 | |
| 2190 | 2190 | switch(page) |
| 2191 | 2191 | { |
| 2192 | 2192 | case 0: /* 0x0000 - 0x3fff */ |
| 2193 | memory_set_bankptr(space->machine,"bank1",messram_get_ptr(devtag_get_device(space->machine, "messram"))+ramptr); | |
| 2194 | memory_set_bankptr(space->machine,"bank2",messram_get_ptr(devtag_get_device(space->machine, "messram"))+ramptr+0x2000); | |
| 2195 | memory_set_bankptr(space->machine,"bank9",messram_get_ptr(devtag_get_device(space->machine, "messram"))+ramptr); | |
| 2196 | memory_set_bankptr(space->machine,"bank10",messram_get_ptr(devtag_get_device(space->machine, "messram"))+ramptr+0x2000); | |
| 2197 | Aleste_RamBanks[0] = messram_get_ptr(devtag_get_device(space->machine, "messram"))+ramptr; | |
| 2193 | memory_set_bankptr(space->machine,"bank1",messram_get_ptr(space->machine->device("messram"))+ramptr); | |
| 2194 | memory_set_bankptr(space->machine,"bank2",messram_get_ptr(space->machine->device("messram"))+ramptr+0x2000); | |
| 2195 | memory_set_bankptr(space->machine,"bank9",messram_get_ptr(space->machine->device("messram"))+ramptr); | |
| 2196 | memory_set_bankptr(space->machine,"bank10",messram_get_ptr(space->machine->device("messram"))+ramptr+0x2000); | |
| 2197 | Aleste_RamBanks[0] = messram_get_ptr(space->machine->device("messram"))+ramptr; | |
| 2198 | 2198 | aleste_active_page[0] = data; |
| 2199 | 2199 | logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0x0000\n",ramptr,rampage); |
| 2200 | 2200 | break; |
| 2201 | 2201 | case 1: /* 0x4000 - 0x7fff */ |
| 2202 | memory_set_bankptr(space->machine,"bank3",messram_get_ptr(devtag_get_device(space->machine, "messram"))+ramptr); | |
| 2203 | memory_set_bankptr(space->machine,"bank4",messram_get_ptr(devtag_get_device(space->machine, "messram"))+ramptr+0x2000); | |
| 2204 | memory_set_bankptr(space->machine,"bank11",messram_get_ptr(devtag_get_device(space->machine, "messram"))+ramptr); | |
| 2205 | memory_set_bankptr(space->machine,"bank12",messram_get_ptr(devtag_get_device(space->machine, "messram"))+ramptr+0x2000); | |
| 2206 | Aleste_RamBanks[1] = messram_get_ptr(devtag_get_device(space->machine, "messram"))+ramptr; | |
| 2202 | memory_set_bankptr(space->machine,"bank3",messram_get_ptr(space->machine->device("messram"))+ramptr); | |
| 2203 | memory_set_bankptr(space->machine,"bank4",messram_get_ptr(space->machine->device("messram"))+ramptr+0x2000); | |
| 2204 | memory_set_bankptr(space->machine,"bank11",messram_get_ptr(space->machine->device("messram"))+ramptr); | |
| 2205 | memory_set_bankptr(space->machine,"bank12",messram_get_ptr(space->machine->device("messram"))+ramptr+0x2000); | |
| 2206 | Aleste_RamBanks[1] = messram_get_ptr(space->machine->device("messram"))+ramptr; | |
| 2207 | 2207 | aleste_active_page[1] = data; |
| 2208 | 2208 | logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0x4000\n",ramptr,rampage); |
| 2209 | 2209 | break; |
| 2210 | 2210 | case 2: /* 0x8000 - 0xbfff */ |
| 2211 | memory_set_bankptr(space->machine,"bank5",messram_get_ptr(devtag_get_device(space->machine, "messram"))+ramptr); | |
| 2212 | memory_set_bankptr(space->machine,"bank6",messram_get_ptr(devtag_get_device(space->machine, "messram"))+ramptr+0x2000); | |
| 2213 | memory_set_bankptr(space->machine,"bank13",messram_get_ptr(devtag_get_device(space->machine, "messram"))+ramptr); | |
| 2214 | memory_set_bankptr(space->machine,"bank14",messram_get_ptr(devtag_get_device(space->machine, "messram"))+ramptr+0x2000); | |
| 2215 | Aleste_RamBanks[2] = messram_get_ptr(devtag_get_device(space->machine, "messram"))+ramptr; | |
| 2211 | memory_set_bankptr(space->machine,"bank5",messram_get_ptr(space->machine->device("messram"))+ramptr); | |
| 2212 | memory_set_bankptr(space->machine,"bank6",messram_get_ptr(space->machine->device("messram"))+ramptr+0x2000); | |
| 2213 | memory_set_bankptr(space->machine,"bank13",messram_get_ptr(space->machine->device("messram"))+ramptr); | |
| 2214 | memory_set_bankptr(space->machine,"bank14",messram_get_ptr(space->machine->device("messram"))+ramptr+0x2000); | |
| 2215 | Aleste_RamBanks[2] = messram_get_ptr(space->machine->device("messram"))+ramptr; | |
| 2216 | 2216 | aleste_active_page[2] = data; |
| 2217 | 2217 | logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0x8000\n",ramptr,rampage); |
| 2218 | 2218 | break; |
| 2219 | 2219 | case 3: /* 0xc000 - 0xffff */ |
| 2220 | memory_set_bankptr(space->machine,"bank7",messram_get_ptr(devtag_get_device(space->machine, "messram"))+ramptr); | |
| 2221 | memory_set_bankptr(space->machine,"bank8",messram_get_ptr(devtag_get_device(space->machine, "messram"))+ramptr+0x2000); | |
| 2222 | memory_set_bankptr(space->machine,"bank15",messram_get_ptr(devtag_get_device(space->machine, "messram"))+ramptr); | |
| 2223 | memory_set_bankptr(space->machine,"bank16",messram_get_ptr(devtag_get_device(space->machine, "messram"))+ramptr+0x2000); | |
| 2224 | Aleste_RamBanks[3] = messram_get_ptr(devtag_get_device(space->machine, "messram"))+ramptr; | |
| 2220 | memory_set_bankptr(space->machine,"bank7",messram_get_ptr(space->machine->device("messram"))+ramptr); | |
| 2221 | memory_set_bankptr(space->machine,"bank8",messram_get_ptr(space->machine->device("messram"))+ramptr+0x2000); | |
| 2222 | memory_set_bankptr(space->machine,"bank15",messram_get_ptr(space->machine->device("messram"))+ramptr); | |
| 2223 | memory_set_bankptr(space->machine,"bank16",messram_get_ptr(space->machine->device("messram"))+ramptr+0x2000); | |
| 2224 | Aleste_RamBanks[3] = messram_get_ptr(space->machine->device("messram"))+ramptr; | |
| 2225 | 2225 | aleste_active_page[3] = data; |
| 2226 | 2226 | logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0xc000\n",ramptr,rampage); |
| 2227 | 2227 | break; |
| r8453 | r8454 | |
| 2294 | 2294 | |
| 2295 | 2295 | READ8_HANDLER ( amstrad_cpc_io_r ) |
| 2296 | 2296 | { |
| 2297 | running_device *fdc = devtag_get_device(space->machine, "upd765"); | |
| 2298 | running_device *mc6845 = devtag_get_device(space->machine, "mc6845" ); | |
| 2297 | running_device *fdc = space->machine->device("upd765"); | |
| 2298 | running_device *mc6845 = space->machine->device("mc6845" ); | |
| 2299 | 2299 | |
| 2300 | 2300 | unsigned char data = 0xFF; |
| 2301 | 2301 | unsigned int r1r0 = (unsigned int)((offset & 0x0300) >> 8); |
| r8453 | r8454 | |
| 2354 | 2354 | if ((offset & (1<<11)) == 0) |
| 2355 | 2355 | { |
| 2356 | 2356 | if (r1r0 < 0x03 ) |
| 2357 | data = i8255a_r( | |
| 2357 | data = i8255a_r( | |
| 2358 | 2358 | } |
| 2359 | 2359 | |
| 2360 | 2360 | /* if b10 = 0 : Expansion Peripherals Read selected |
| r8453 | r8454 | |
| 2431 | 2431 | /* Offset handler for write */ |
| 2432 | 2432 | WRITE8_HANDLER ( amstrad_cpc_io_w ) |
| 2433 | 2433 | { |
| 2434 | running_device *fdc = devtag_get_device(space->machine, "upd765"); | |
| 2435 | running_device *mc6845 = devtag_get_device(space->machine, "mc6845"); | |
| 2434 | running_device *fdc = space->machine->device("upd765"); | |
| 2435 | running_device *mc6845 = space->machine->device("mc6845"); | |
| 2436 | 2436 | |
| 2437 | 2437 | static int printer_bit8_selected = FALSE; |
| 2438 | 2438 | |
| r8453 | r8454 | |
| 2476 | 2476 | /* printer port bit 8 */ |
| 2477 | 2477 | if (printer_bit8_selected && amstrad_system_type == SYSTEM_PLUS) |
| 2478 | 2478 | { |
| 2479 | running_device *printer = | |
| 2479 | running_device *printer = | |
| 2480 | 2480 | centronics_d7_w(printer, BIT(data, 3)); |
| 2481 | 2481 | printer_bit8_selected = FALSE; |
| 2482 | 2482 | } |
| r8453 | r8454 | |
| 2500 | 2500 | { |
| 2501 | 2501 | if ((offset & (1<<12)) == 0) |
| 2502 | 2502 | { |
| 2503 | running_device *printer = | |
| 2503 | running_device *printer = | |
| 2504 | 2504 | |
| 2505 | 2505 | /* CPC has a 7-bit data port, bit 8 is the STROBE signal */ |
| 2506 | 2506 | centronics_data_w(printer, 0, data & 0x7f); |
| r8453 | r8454 | |
| 2519 | 2519 | { |
| 2520 | 2520 | unsigned int Index = ((offset & 0x0300) >> 8); |
| 2521 | 2521 | |
| 2522 | i8255a_w( | |
| 2522 | i8255a_w( | |
| 2523 | 2523 | } |
| 2524 | 2524 | |
| 2525 | 2525 | /* if b10 = 0 : Expansion Peripherals Write selected */ |
| r8453 | r8454 | |
| 2593 | 2593 | static void amstrad_handle_snapshot(running_machine *machine, unsigned char *pSnapshot) |
| 2594 | 2594 | { |
| 2595 | 2595 | const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 2596 | running_device *mc6845 = devtag_get_device(space->machine, "mc6845" ); | |
| 2597 | running_device *ay8910 = devtag_get_device(machine, "ay"); | |
| 2596 | running_device *mc6845 = space->machine->device("mc6845" ); | |
| 2597 | running_device *ay8910 = machine->device("ay"); | |
| 2598 | 2598 | int RegData; |
| 2599 | 2599 | int i; |
| 2600 | 2600 | |
| 2601 | 2601 | /* init Z80 */ |
| 2602 | 2602 | RegData = (pSnapshot[0x011] & 0x0ff) | ((pSnapshot[0x012] & 0x0ff)<<8); |
| 2603 | cpu_set_reg( | |
| 2603 | cpu_set_reg(m | |
| 2604 | 2604 | |
| 2605 | 2605 | RegData = (pSnapshot[0x013] & 0x0ff) | ((pSnapshot[0x014] & 0x0ff)<<8); |
| 2606 | cpu_set_reg( | |
| 2606 | cpu_set_reg(m | |
| 2607 | 2607 | |
| 2608 | 2608 | RegData = (pSnapshot[0x015] & 0x0ff) | ((pSnapshot[0x016] & 0x0ff)<<8); |
| 2609 | cpu_set_reg( | |
| 2609 | cpu_set_reg(m | |
| 2610 | 2610 | |
| 2611 | 2611 | RegData = (pSnapshot[0x017] & 0x0ff) | ((pSnapshot[0x018] & 0x0ff)<<8); |
| 2612 | cpu_set_reg( | |
| 2612 | cpu_set_reg(m | |
| 2613 | 2613 | |
| 2614 | 2614 | RegData = (pSnapshot[0x019] & 0x0ff) ; |
| 2615 | cpu_set_reg( | |
| 2615 | cpu_set_reg(m | |
| 2616 | 2616 | |
| 2617 | 2617 | RegData = (pSnapshot[0x01a] & 0x0ff); |
| 2618 | cpu_set_reg( | |
| 2618 | cpu_set_reg(m | |
| 2619 | 2619 | |
| 2620 | 2620 | if ((pSnapshot[0x01b] & 1)==1) |
| 2621 | 2621 | { |
| 2622 | cpu_set_reg( | |
| 2622 | cpu_set_reg(m | |
| 2623 | 2623 | } |
| 2624 | 2624 | else |
| 2625 | 2625 | { |
| 2626 | cpu_set_reg( | |
| 2626 | cpu_set_reg(m | |
| 2627 | 2627 | } |
| 2628 | 2628 | |
| 2629 | 2629 | if ((pSnapshot[0x01c] & 1)==1) |
| 2630 | 2630 | { |
| 2631 | cpu_set_reg( | |
| 2631 | cpu_set_reg(m | |
| 2632 | 2632 | } |
| 2633 | 2633 | else |
| 2634 | 2634 | { |
| 2635 | cpu_set_reg( | |
| 2635 | cpu_set_reg(m | |
| 2636 | 2636 | } |
| 2637 | 2637 | |
| 2638 | 2638 | RegData = (pSnapshot[0x01d] & 0x0ff) | ((pSnapshot[0x01e] & 0x0ff)<<8); |
| 2639 | cpu_set_reg( | |
| 2639 | cpu_set_reg(m | |
| 2640 | 2640 | |
| 2641 | 2641 | RegData = (pSnapshot[0x01f] & 0x0ff) | ((pSnapshot[0x020] & 0x0ff)<<8); |
| 2642 | cpu_set_reg( | |
| 2642 | cpu_set_reg(m | |
| 2643 | 2643 | |
| 2644 | 2644 | RegData = (pSnapshot[0x021] & 0x0ff) | ((pSnapshot[0x022] & 0x0ff)<<8); |
| 2645 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_SP, RegData); | |
| 2646 | cpu_set_reg(devtag_get_device(machine, "maincpu"), STATE_GENSP, RegData); | |
| 2645 | cpu_set_reg(machine->device("maincpu"), Z80_SP, RegData); | |
| 2646 | cpu_set_reg(machine->device("maincpu"), STATE_GENSP, RegData); | |
| 2647 | 2647 | |
| 2648 | 2648 | RegData = (pSnapshot[0x023] & 0x0ff) | ((pSnapshot[0x024] & 0x0ff)<<8); |
| 2649 | 2649 | |
| 2650 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_PC, RegData); | |
| 2651 | // cpu_set_reg(devtag_get_device(machine, "maincpu"), REG_SP, RegData); | |
| 2650 | cpu_set_reg(machine->device("maincpu"), Z80_PC, RegData); | |
| 2651 | // cpu_set_reg(machine->device("maincpu"), REG_SP, RegData); | |
| 2652 | 2652 | |
| 2653 | 2653 | RegData = (pSnapshot[0x025] & 0x0ff); |
| 2654 | cpu_set_reg( | |
| 2654 | cpu_set_reg(m | |
| 2655 | 2655 | |
| 2656 | 2656 | RegData = (pSnapshot[0x026] & 0x0ff) | ((pSnapshot[0x027] & 0x0ff)<<8); |
| 2657 | cpu_set_reg( | |
| 2657 | cpu_set_reg(m | |
| 2658 | 2658 | |
| 2659 | 2659 | RegData = (pSnapshot[0x028] & 0x0ff) | ((pSnapshot[0x029] & 0x0ff)<<8); |
| 2660 | cpu_set_reg( | |
| 2660 | cpu_set_reg(m | |
| 2661 | 2661 | |
| 2662 | 2662 | RegData = (pSnapshot[0x02a] & 0x0ff) | ((pSnapshot[0x02b] & 0x0ff)<<8); |
| 2663 | cpu_set_reg( | |
| 2663 | cpu_set_reg(m | |
| 2664 | 2664 | |
| 2665 | 2665 | RegData = (pSnapshot[0x02c] & 0x0ff) | ((pSnapshot[0x02d] & 0x0ff)<<8); |
| 2666 | cpu_set_reg( | |
| 2666 | cpu_set_reg(m | |
| 2667 | 2667 | |
| 2668 | 2668 | /* init GA */ |
| 2669 | 2669 | for (i=0; i<17; i++) |
| r8453 | r8454 | |
| 2692 | 2692 | gate_array.upper_bank = pSnapshot[0x055]; |
| 2693 | 2693 | |
| 2694 | 2694 | /* PPI */ |
| 2695 | i8255a_w( | |
| 2695 | i8255a_w(m | |
| 2696 | 2696 | |
| 2697 | i8255a_w(devtag_get_device(machine, "ppi8255"),0,pSnapshot[0x056] & 0x0ff); | |
| 2698 | i8255a_w(devtag_get_device(machine, "ppi8255"),1,pSnapshot[0x057] & 0x0ff); | |
| 2699 | i8255a_w(devtag_get_device(machine, "ppi8255"),2,pSnapshot[0x058] & 0x0ff); | |
| 2697 | i8255a_w(machine->device("ppi8255"),0,pSnapshot[0x056] & 0x0ff); | |
| 2698 | i8255a_w(machine->device("ppi8255"),1,pSnapshot[0x057] & 0x0ff); | |
| 2699 | i8255a_w(machine->device("ppi8255"),2,pSnapshot[0x058] & 0x0ff); | |
| 2700 | 2700 | |
| 2701 | 2701 | /* PSG */ |
| 2702 | 2702 | for (i=0; i<16; i++) |
| r8453 | r8454 | |
| 2722 | 2722 | MemorySize = 64*1024; |
| 2723 | 2723 | } |
| 2724 | 2724 | |
| 2725 | memcpy(messram_get_ptr( | |
| 2725 | memcpy(messram_get_ptr(m | |
| 2726 | 2726 | } |
| 2727 | 2727 | amstrad_rethinkMemory(machine); |
| 2728 | 2728 | } |
| r8453 | r8454 | |
| 2864 | 2864 | static void update_psg(running_machine *machine) |
| 2865 | 2865 | { |
| 2866 | 2866 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 2867 | running_device *ay8910 = | |
| 2867 | running_device *ay8910 = m | |
| 2868 | 2868 | |
| 2869 | 2869 | if(aleste_mode & 0x20) // RTC selected |
| 2870 | 2870 | { |
| r8453 | r8454 | |
| 2956 | 2956 | /* Set b7 with cassette tape input */ |
| 2957 | 2957 | if(amstrad_system_type != SYSTEM_GX4000) |
| 2958 | 2958 | { |
| 2959 | if (cassette_input(dev | |
| 2959 | if (cassette_input(dev | |
| 2960 | 2960 | { |
| 2961 | 2961 | data |= (1<<7); |
| 2962 | 2962 | } |
| r8453 | r8454 | |
| 2964 | 2964 | /* Set b6 with Parallel/Printer port ready */ |
| 2965 | 2965 | if(amstrad_system_type != SYSTEM_GX4000) |
| 2966 | 2966 | { |
| 2967 | running_device *printer = dev | |
| 2967 | running_device *printer = dev | |
| 2968 | 2968 | data |= centronics_busy_r(printer) << 6; |
| 2969 | 2969 | } |
| 2970 | 2970 | /* Set b4-b1 50Hz/60Hz state and manufacturer name defined by links on PCB */ |
| r8453 | r8454 | |
| 3024 | 3024 | { |
| 3025 | 3025 | if ((changed_data & 0x20) != 0) |
| 3026 | 3026 | { |
| 3027 | cassette_output(dev | |
| 3027 | cassette_output(dev | |
| 3028 | 3028 | ((data & 0x20) ? -1.0 : +1.0)); |
| 3029 | 3029 | } |
| 3030 | 3030 | } |
| r8453 | r8454 | |
| 3034 | 3034 | { |
| 3035 | 3035 | if ((changed_data & 0x10) != 0) |
| 3036 | 3036 | { |
| 3037 | cassette_change_state(dev | |
| 3037 | cassette_change_state(dev | |
| 3038 | 3038 | ((data & 0x10) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED), |
| 3039 | 3039 | CASSETTE_MASK_MOTOR); |
| 3040 | 3040 | } |
| r8453 | r8454 | |
| 3259 | 3259 | memory_install_write_bank(space, 0xc000, 0xdfff, 0, 0, "bank15"); |
| 3260 | 3260 | memory_install_write_bank(space, 0xe000, 0xffff, 0, 0, "bank16"); |
| 3261 | 3261 | |
| 3262 | | |
| 3262 | | |
| 3263 | 3263 | if ( amstrad_system_type == SYSTEM_CPC || amstrad_system_type == SYSTEM_ALESTE ) |
| 3264 | cpu_set_input_line_vector( | |
| 3264 | cpu_set_input_line_vector(m | |
| 3265 | 3265 | else |
| 3266 | cpu_set_input_line_vector( | |
| 3266 | cpu_set_input_line_vector(m | |
| 3267 | 3267 | |
| 3268 | 3268 | /* The opcode timing in the Amstrad is different to the opcode |
| 3269 | 3269 | timing in the core for the Z80 CPU. |
| r8453 | r8454 | |
| 3275 | 3275 | |
| 3276 | 3276 | /* Using the cool code Juergen has provided, I will override |
| 3277 | 3277 | the timing tables with the values for the amstrad */ |
| 3278 | z80_set_cycle_tables( | |
| 3278 | z80_set_cycle_tables(m | |
| 3279 | 3279 | (const UINT8*)amstrad_cycle_table_op, |
| 3280 | 3280 | (const UINT8*)amstrad_cycle_table_cb, |
| 3281 | 3281 | (const UINT8*)amstrad_cycle_table_ed, |
| r8453 | r8454 | |
| 3284 | 3284 | (const UINT8*)amstrad_cycle_table_ex); |
| 3285 | 3285 | |
| 3286 | 3286 | /* Juergen is a cool dude! */ |
| 3287 | cpu_set_irq_callback( | |
| 3287 | cpu_set_irq_callback(m | |
| 3288 | 3288 | } |
| 3289 | 3289 | |
| 3290 | 3290 |
| r8453 | r8454 | |
|---|---|---|
| 1147 | 1147 | if (device->owner() != NULL) { |
| 1148 | 1148 | w->drive = device->owner()->subdevice(w->intf->floppy_drive_tags[drive]); |
| 1149 | 1149 | if (w->drive == NULL) { |
| 1150 | w->drive = dev | |
| 1150 | w->drive = dev | |
| 1151 | 1151 | } |
| 1152 | 1152 | } |
| 1153 | 1153 | else |
| 1154 | w->drive = dev | |
| 1154 | w->drive = dev | |
| 1155 | 1155 | } |
| 1156 | 1156 | } |
| 1157 | 1157 | |
| r8453 | r8454 | |
| 2027 | 2027 | if (device->owner() != NULL) |
| 2028 | 2028 | img = device->owner()->subdevice(w->intf->floppy_drive_tags[i]); |
| 2029 | 2029 | if (img == NULL) { |
| 2030 | img = dev | |
| 2030 | img = dev | |
| 2031 | 2031 | } |
| 2032 | 2032 | |
| 2033 | 2033 | else |
| 2034 | img = dev | |
| 2034 | img = dev | |
| 2035 | 2035 | |
| 2036 | 2036 | if (img!=NULL) { |
| 2037 | 2037 | floppy_drive_set_controller(img,device); |
| r8453 | r8454 | |
|---|---|---|
| 174 | 174 | static void sms_vdp_hcount_lphaser( running_machine *machine, int hpos) |
| 175 | 175 | { |
| 176 | 176 | UINT8 tmp = ((hpos - 46) >> 1) & 0xff; |
| 177 | running_device *smsvdp = | |
| 177 | running_device *smsvdp = m | |
| 178 | 178 | |
| 179 | 179 | //printf ("sms_vdp_hcount_lphaser: hpos %3d => hcount %2X\n", hpos, tmp); |
| 180 | 180 | sms_vdp_hcount_latch_w(smsvdp, 0, tmp); |
| r8453 | r8454 | |
| 214 | 214 | static void sms_vdp_hcount_latch( running_machine *machine ) |
| 215 | 215 | { |
| 216 | 216 | UINT8 value = sms_vdp_hcount(machine); |
| 217 | running_device *smsvdp = | |
| 217 | running_device *smsvdp = m | |
| 218 | 218 | |
| 219 | 219 | sms_vdp_hcount_latch_w(smsvdp, 0, value); |
| 220 | 220 | } |
| r8453 | r8454 | |
| 241 | 241 | int x = screen_hpos_nonscaled(machine->primary_screen, input_port_read(machine, tag_x)); |
| 242 | 242 | int y = screen_vpos_nonscaled(machine->primary_screen, input_port_read(machine, tag_y)); |
| 243 | 243 | |
| 244 | if (sms_vdp_area_brightness( | |
| 244 | if (sms_vdp_area_brightness(m | |
| 245 | 245 | { |
| 246 | 246 | /* avoid latching hcount more than once in a line */ |
| 247 | 247 | if (sms_state.lphaser_latch == 0) |
| r8453 | r8454 | |
| 456 | 456 | |
| 457 | 457 | READ8_HANDLER( sms_count_r ) |
| 458 | 458 | { |
| 459 | running_device *smsvdp = | |
| 459 | running_device *smsvdp = | |
| 460 | 460 | |
| 461 | 461 | if (offset & 0x01) |
| 462 | 462 | return sms_vdp_hcount_latch_r(smsvdp, offset); |
| r8453 | r8454 | |
| 547 | 547 | { |
| 548 | 548 | if (sms_state.has_fm) |
| 549 | 549 | { |
| 550 | running_device *ym = | |
| 550 | running_device *ym = | |
| 551 | 551 | ym2413_w(ym, 0, (data & 0x3f)); |
| 552 | 552 | } |
| 553 | 553 | } |
| r8453 | r8454 | |
| 557 | 557 | { |
| 558 | 558 | if (sms_state.has_fm) |
| 559 | 559 | { |
| 560 | running_device *ym = | |
| 560 | running_device *ym = | |
| 561 | 561 | logerror("data_port_0_w %x %x\n", offset, data); |
| 562 | 562 | ym2413_w(ym, 1, data); |
| 563 | 563 | } |
| r8453 | r8454 | |
| 931 | 931 | { |
| 932 | 932 | /* Does the cartridge have SRAM that should be saved? */ |
| 933 | 933 | if (sms_state.cartridge[sms_state.current_cartridge].sram_save) { |
| 934 | device_image_interface *image = dynamic_cast<device_image_interface *>( | |
| 934 | device_image_interface *image = dynamic_cast<device_image_interface *>(m | |
| 935 | 935 | image->battery_save(sms_state.cartridge[sms_state.current_cartridge].cartSRAM, sizeof(UINT8) * NVRAM_SIZE ); |
| 936 | 936 | } |
| 937 | 937 | } |
| r8453 | r8454 | |
| 1429 | 1429 | MACHINE_RESET( sms ) |
| 1430 | 1430 | { |
| 1431 | 1431 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 1432 | running_device *smsvdp = | |
| 1432 | running_device *smsvdp = m | |
| 1433 | 1433 | |
| 1434 | 1434 | sms_state.ctrl_reg = 0xff; |
| 1435 | 1435 | if (sms_state.has_fm) |
| r8453 | r8454 | |
| 1537 | 1537 | else |
| 1538 | 1538 | { |
| 1539 | 1539 | /* Pull reset line of CPU #0 low */ |
| 1540 | | |
| 1540 | | |
| 1541 | 1541 | cputag_suspend(space->machine, "maincpu", SUSPEND_REASON_HALT, 1); |
| 1542 | 1542 | } |
| 1543 | 1543 | sms_state.store_control = data; |
| r8453 | r8454 | |
| 1618 | 1618 | /* This needs to be here to check if segascope has been enabled */ |
| 1619 | 1619 | VIDEO_UPDATE( sms1 ) |
| 1620 | 1620 | { |
| 1621 | running_device *main_scr = devtag_get_device(screen->machine, "screen"); | |
| 1622 | running_device *left_lcd = devtag_get_device(screen->machine, "left_lcd"); | |
| 1623 | running_device *right_lcd = devtag_get_device(screen->machine, "right_lcd"); | |
| 1624 | running_device *smsvdp = devtag_get_device(screen->machine, "sms_vdp"); | |
| 1621 | running_device *main_scr = screen->machine->device("screen"); | |
| 1622 | running_device *left_lcd = screen->machine->device("left_lcd"); | |
| 1623 | running_device *right_lcd = screen->machine->device("right_lcd"); | |
| 1624 | running_device *smsvdp = screen->machine->device("sms_vdp"); | |
| 1625 | 1625 | UINT8 segascope = input_port_read_safe(screen->machine, "SEGASCOPE", 0x00); |
| 1626 | 1626 | |
| 1627 | 1627 | if (screen == main_scr) |
| r8453 | r8454 | |
| 1682 | 1682 | |
| 1683 | 1683 | VIDEO_UPDATE( sms ) |
| 1684 | 1684 | { |
| 1685 | running_device *smsvdp = | |
| 1685 | running_device *smsvdp = | |
| 1686 | 1686 | sms_vdp_update(smsvdp, bitmap, cliprect); |
| 1687 | 1687 | |
| 1688 | 1688 | return 0; |
| r8453 | r8454 | |
|---|---|---|
| 24 | 24 | static TIMER_CALLBACK(poly88_usart_timer_callback) |
| 25 | 25 | { |
| 26 | 26 | int_vector = 0xe7; |
| 27 | cpu_set_input_line( | |
| 27 | cpu_set_input_line(m | |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | WRITE8_HANDLER(poly88_baud_rate_w) |
| r8453 | r8454 | |
| 154 | 154 | // if (!(input_port_read(machine, "DSW0") & 0x02)) /* V.24 / Tape Switch */ |
| 155 | 155 | //{ |
| 156 | 156 | /* tape reading */ |
| 157 | if (cassette_get_state( | |
| 157 | if (cassette_get_state(m | |
| 158 | 158 | { |
| 159 | 159 | if (clk_level_tape) |
| 160 | 160 | { |
| 161 | previous_level = (cassette_input( | |
| 161 | previous_level = (cassette_input(m | |
| 162 | 162 | clk_level_tape = 0; |
| 163 | 163 | } |
| 164 | 164 | else |
| 165 | 165 | { |
| 166 | current_level = (cassette_input( | |
| 166 | current_level = (cassette_input(m | |
| 167 | 167 | |
| 168 | 168 | if (previous_level!=current_level) |
| 169 | 169 | { |
| r8453 | r8454 | |
| 171 | 171 | //data = current_level; |
| 172 | 172 | set_out_data_bit(poly88_cassette_serial_connection.State, data); |
| 173 | 173 | serial_connection_out(machine, &poly88_cassette_serial_connection); |
| 174 | msm8251_receive_clock( | |
| 174 | msm8251_receive_clock(m | |
| 175 | 175 | |
| 176 | 176 | clk_level_tape = 1; |
| 177 | 177 | } |
| r8453 | r8454 | |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | /* tape writing */ |
| 182 | if (cassette_get_state( | |
| 182 | if (cassette_get_state(m | |
| 183 | 183 | { |
| 184 | 184 | data = get_in_data_bit(poly88_cassette_serial_connection.input_state); |
| 185 | 185 | data ^= clk_level_tape; |
| 186 | cassette_output( | |
| 186 | cassette_output(m | |
| 187 | 187 | |
| 188 | 188 | if (!clk_level_tape) |
| 189 | msm8251_transmit_clock( | |
| 189 | msm8251_transmit_clock(m | |
| 190 | 190 | |
| 191 | 191 | clk_level_tape = clk_level_tape ? 0 : 1; |
| 192 | 192 | |
| r8453 | r8454 | |
| 196 | 196 | clk_level_tape = 1; |
| 197 | 197 | |
| 198 | 198 | if (!clk_level) |
| 199 | msm8251_transmit_clock( | |
| 199 | msm8251_transmit_clock(m | |
| 200 | 200 | clk_level = clk_level ? 0 : 1; |
| 201 | 201 | // } |
| 202 | 202 | } |
| r8453 | r8454 | |
| 204 | 204 | |
| 205 | 205 | static TIMER_CALLBACK( setup_machine_state ) |
| 206 | 206 | { |
| 207 | msm8251_connect( | |
| 207 | msm8251_connect(m | |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | DRIVER_INIT ( poly88 ) |
| r8453 | r8454 | |
| 222 | 222 | |
| 223 | 223 | MACHINE_RESET(poly88) |
| 224 | 224 | { |
| 225 | cpu_set_irq_callback( | |
| 225 | cpu_set_irq_callback(m | |
| 226 | 226 | intr = 0; |
| 227 | 227 | last_code = 0; |
| 228 | 228 | |
| r8453 | r8454 | |
| 304 | 304 | break; |
| 305 | 305 | case 3 : |
| 306 | 306 | /* 03 Auto Start @ Address */ |
| 307 | cpu_set_reg( | |
| 307 | cpu_set_reg( | |
| 308 | 308 | theend = 1; |
| 309 | 309 | break; |
| 310 | 310 | case 4 : |
| r8453 | r8454 | |
| 329 | 329 | } |
| 330 | 330 | pos+=recordLen; |
| 331 | 331 | } |
| 332 | | |
| 332 | | |
| 333 | 333 | return IMAGE_INIT_PASS; |
| 334 | 334 | } |
| r8453 | r8454 | |
|---|---|---|
| 106 | 106 | |
| 107 | 107 | DRIVER_INIT(llc2) |
| 108 | 108 | { |
| 109 | llc_video_ram = messram_get_ptr( | |
| 109 | llc_video_ram = messram_get_ptr(m | |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | MACHINE_RESET( llc2 ) |
| r8453 | r8454 | |
| 123 | 123 | memory_set_bankptr(machine, "bank3", memory_region(machine, "maincpu") + 0x6000); |
| 124 | 124 | |
| 125 | 125 | memory_install_write_bank(space, 0xc000, 0xffff, 0, 0, "bank4"); |
| 126 | memory_set_bankptr(machine, "bank4", messram_get_ptr( | |
| 126 | memory_set_bankptr(machine, "bank4", messram_get_ptr(m | |
| 127 | 127 | |
| 128 | 128 | } |
| 129 | 129 | |
| r8453 | r8454 | |
| 132 | 132 | const address_space *mem_space = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 133 | 133 | |
| 134 | 134 | memory_install_write_bank(mem_space, 0x0000, 0xbfff, 0, 0, "bank1"); |
| 135 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr( | |
| 135 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr( | |
| 136 | 136 | |
| 137 | 137 | memory_install_write_bank(mem_space, 0x4000, 0x5fff, 0, 0, "bank2"); |
| 138 | memory_set_bankptr(space->machine, "bank2", messram_get_ptr( | |
| 138 | memory_set_bankptr(space->machine, "bank2", messram_get_ptr( | |
| 139 | 139 | |
| 140 | 140 | memory_install_write_bank(mem_space, 0x6000, 0xbfff, 0, 0, "bank3"); |
| 141 | memory_set_bankptr(space->machine, "bank3", messram_get_ptr( | |
| 141 | memory_set_bankptr(space->machine, "bank3", messram_get_ptr( | |
| 142 | 142 | |
| 143 | 143 | memory_install_write_bank(mem_space, 0xc000, 0xffff, 0, 0, "bank4"); |
| 144 | memory_set_bankptr(space->machine, "bank4", messram_get_ptr( | |
| 144 | memory_set_bankptr(space->machine, "bank4", messram_get_ptr( | |
| 145 | 145 | |
| 146 | 146 | } |
| 147 | 147 | |
| r8453 | r8454 | |
| 154 | 154 | memory_set_bankptr(space->machine, "bank2", memory_region(space->machine, "maincpu") + 0x10000); |
| 155 | 155 | } else { |
| 156 | 156 | memory_install_write_bank(mem_space, 0x4000, 0x5fff, 0, 0, "bank2"); |
| 157 | memory_set_bankptr(space->machine, "bank2", messram_get_ptr( | |
| 157 | memory_set_bankptr(space->machine, "bank2", messram_get_ptr( | |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | } |
| r8453 | r8454 | |
|---|---|---|
| 48 | 48 | UINT8 *mem; |
| 49 | 49 | |
| 50 | 50 | /* bank 3 */ |
| 51 | if (asic->lext >> 6 < messram_get_size(devtag_get_device(space->machine, "messram")) >> 20) | |
| 52 | mem = &messram_get_ptr(devtag_get_device(space->machine, "messram"))[(messram_get_size(devtag_get_device(space->machine, "messram")) & 0xfffff) + (asic->lext >> 6) * 0x100000 + (asic->lext & 0x3f) * 0x4000]; | |
| 51 | if (asic->lext >> 6 < messram_get_size(space->machine->device("messram")) >> 20) | |
| 52 | mem = &messram_get_ptr(space->machine->device("messram"))[(messram_get_size(space->machine->device("messram")) & 0xfffff) + (asic->lext >> 6) * 0x100000 + (asic->lext & 0x3f) * 0x4000]; | |
| 53 | 53 | else |
| 54 | 54 | mem = NULL; |
| 55 | 55 | |
| 56 | 56 | samcoupe_update_bank(space, 3, mem, FALSE); |
| 57 | 57 | |
| 58 | 58 | /* bank 4 */ |
| 59 | if (asic->hext >> 6 < messram_get_size(devtag_get_device(space->machine, "messram")) >> 20) | |
| 60 | mem = &messram_get_ptr(devtag_get_device(space->machine, "messram"))[(messram_get_size(devtag_get_device(space->machine, "messram")) & 0xfffff) + (asic->hext >> 6) * 0x100000 + (asic->hext & 0x3f) * 0x4000]; | |
| 59 | if (asic->hext >> 6 < messram_get_size(space->machine->device("messram")) >> 20) | |
| 60 | mem = &messram_get_ptr(space->machine->device("messram"))[(messram_get_size(space->machine->device("messram")) & 0xfffff) + (asic->hext >> 6) * 0x100000 + (asic->hext & 0x3f) * 0x4000]; | |
| 61 | 61 | else |
| 62 | 62 | mem = NULL; |
| 63 | 63 | |
| r8453 | r8454 | |
| 68 | 68 | void samcoupe_update_memory(const address_space *space) |
| 69 | 69 | { |
| 70 | 70 | coupe_asic *asic = (coupe_asic *)space->machine->driver_data; |
| 71 | const int PAGE_MASK = ((messram_get_size( | |
| 71 | const int PAGE_MASK = ((messram_get_size( | |
| 72 | 72 | UINT8 *rom = memory_region(space->machine, "maincpu"); |
| 73 | 73 | UINT8 *memory; |
| 74 | 74 | int is_readonly; |
| r8453 | r8454 | |
| 77 | 77 | if (asic->lmpr & LMPR_RAM0) /* Is ram paged in at bank 1 */ |
| 78 | 78 | { |
| 79 | 79 | if ((asic->lmpr & 0x1F) <= PAGE_MASK) |
| 80 | memory = &messram_get_ptr( | |
| 80 | memory = &messram_get_ptr( | |
| 81 | 81 | else |
| 82 | 82 | memory = NULL; /* Attempt to page in non existant ram region */ |
| 83 | 83 | is_readonly = FALSE; |
| r8453 | r8454 | |
| 92 | 92 | |
| 93 | 93 | /* BANK2 */ |
| 94 | 94 | if (((asic->lmpr + 1) & 0x1f) <= PAGE_MASK) |
| 95 | memory = &messram_get_ptr( | |
| 95 | memory = &messram_get_ptr( | |
| 96 | 96 | else |
| 97 | 97 | memory = NULL; /* Attempt to page in non existant ram region */ |
| 98 | 98 | samcoupe_update_bank(space, 2, memory, FALSE); |
| r8453 | r8454 | |
| 106 | 106 | { |
| 107 | 107 | /* BANK3 */ |
| 108 | 108 | if ((asic->hmpr & 0x1F) <= PAGE_MASK ) |
| 109 | memory = &messram_get_ptr( | |
| 109 | memory = &messram_get_ptr( | |
| 110 | 110 | else |
| 111 | 111 | memory = NULL; /* Attempt to page in non existant ram region */ |
| 112 | 112 | samcoupe_update_bank(space, 3, memory, FALSE); |
| r8453 | r8454 | |
| 121 | 121 | else |
| 122 | 122 | { |
| 123 | 123 | if (((asic->hmpr + 1) & 0x1f) <= PAGE_MASK) |
| 124 | memory = &messram_get_ptr( | |
| 124 | memory = &messram_get_ptr( | |
| 125 | 125 | else |
| 126 | 126 | memory = NULL; /* Attempt to page in non existant ram region */ |
| 127 | 127 | is_readonly = FALSE; |
| r8453 | r8454 | |
| 131 | 131 | |
| 132 | 132 | /* video memory location */ |
| 133 | 133 | if (asic->vmpr & 0x40) /* if bit set in 2 bank screen mode */ |
| 134 | space->machine->generic.videoram.u8 = &messram_get_ptr( | |
| 134 | space->machine->generic.videoram.u8 = &messram_get_ptr( | |
| 135 | 135 | else |
| 136 | space->machine->generic.videoram.u8 = &messram_get_ptr( | |
| 136 | space->machine->generic.videoram.u8 = &messram_get_ptr( | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | |
| r8453 | r8454 | |
| 261 | 261 | if (input_port_read(machine, "config") & 0x01) |
| 262 | 262 | { |
| 263 | 263 | /* install RTC */ |
| 264 | running_device *rtc = | |
| 264 | running_device *rtc = m | |
| 265 | 265 | memory_install_readwrite8_device_handler(spaceio, rtc, 0xef, 0xef, 0xffff, 0xff00, samcoupe_rtc_r, samcoupe_rtc_w); |
| 266 | 266 | } |
| 267 | 267 | else |
| r8453 | r8454 | |
|---|---|---|
| 20 | 20 | |
| 21 | 21 | MACHINE_RESET( z1013 ) |
| 22 | 22 | { |
| 23 | cpu_set_reg( | |
| 23 | cpu_set_reg(m | |
| 24 | 24 | z1013_keyboard_part = 0; |
| 25 | 25 | z1013_keyboard_line = 0; |
| 26 | 26 | } |
| r8453 | r8454 | |
| 90 | 90 | memcpy (memory_get_read_ptr(cputag_get_address_space(image.device().machine, "maincpu", ADDRESS_SPACE_PROGRAM), startaddr ), |
| 91 | 91 | data+0x20, endaddr - startaddr + 1); |
| 92 | 92 | |
| 93 | cpu_set_reg( | |
| 93 | cpu_set_reg( | |
| 94 | 94 | |
| 95 | 95 | return IMAGE_INIT_PASS; |
| 96 | 96 | } |
| r8453 | r8454 | |
|---|---|---|
| 153 | 153 | |
| 154 | 154 | static running_device *get_printer_device(running_machine *machine) |
| 155 | 155 | { |
| 156 | return | |
| 156 | return m | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | static int expansion_box_installed(running_machine *machine) |
| r8453 | r8454 | |
| 201 | 201 | static UINT8 fdc_r(const address_space *space) |
| 202 | 202 | { |
| 203 | 203 | comx35_state *state = (comx35_state *)space->machine->driver_data; |
| 204 | running_device *fdc = | |
| 204 | running_device *fdc = | |
| 205 | 205 | |
| 206 | 206 | UINT8 data; |
| 207 | 207 | |
| r8453 | r8454 | |
| 219 | 219 | |
| 220 | 220 | static void fdc_w(const address_space *space, UINT8 data) |
| 221 | 221 | { |
| 222 | running_device *fdc = | |
| 222 | running_device *fdc = | |
| 223 | 223 | /* |
| 224 | 224 | |
| 225 | 225 | bit description |
| r8453 | r8454 | |
| 427 | 427 | |
| 428 | 428 | case BANK_80_COLUMNS: |
| 429 | 429 | { |
| 430 | running_device *mc6845 = | |
| 430 | running_device *mc6845 = m | |
| 431 | 431 | |
| 432 | 432 | memory_install_read_bank(program, 0xc000, 0xc7ff, 0, 0, "bank1"); // ROM |
| 433 | 433 | memory_unmap_write(program, 0xc000, 0xc7ff, 0, 0); // ROM |
| r8453 | r8454 | |
| 629 | 629 | memory_configure_bank(machine, "bank1", BANK_PRINTER_THERMAL, 1, memory_region(machine, "thermal"), 0); |
| 630 | 630 | memory_configure_bank(machine, "bank1", BANK_JOYCARD, 1, memory_region(machine, CDP1802_TAG), 0); |
| 631 | 631 | memory_configure_bank(machine, "bank1", BANK_80_COLUMNS, 1, memory_region(machine, "80column"), 0); |
| 632 | memory_configure_bank(machine, "bank1", BANK_RAMCARD, 4, messram_get_ptr( | |
| 632 | memory_configure_bank(machine, "bank1", BANK_RAMCARD, 4, messram_get_ptr(m | |
| 633 | 633 | |
| 634 | 634 | memory_set_bank(machine, "bank1", 0); |
| 635 | 635 |
| r8453 | r8454 | |
|---|---|---|
| 897 | 897 | { |
| 898 | 898 | cassette_data_timer = timer_alloc(machine, cassette_data_callback, NULL ); |
| 899 | 899 | timer_adjust_periodic( cassette_data_timer, attotime_zero, 0, ATTOTIME_IN_HZ(11025) ); |
| 900 | trs80_printer = devtag_get_device(machine, "centronics"); | |
| 901 | trs80_ay31015 = devtag_get_device(machine, "tr1602"); | |
| 902 | trs80_cass = devtag_get_device(machine, "cassette"); | |
| 903 | trs80_speaker = devtag_get_device(machine, "speaker"); | |
| 904 | trs80_fdc = devtag_get_device(machine, "wd179x"); | |
| 900 | trs80_printer = machine->device("centronics"); | |
| 901 | trs80_ay31015 = machine->device("tr1602"); | |
| 902 | trs80_cass = machine->device("cassette"); | |
| 903 | trs80_speaker = machine->device("speaker"); | |
| 904 | trs80_fdc = machine->device("wd179x"); | |
| 905 | 905 | machine->generic.videoram_size = 0x800; |
| 906 | 906 | } |
| 907 | 907 |
| r8453 | r8454 | |
|---|---|---|
| 86 | 86 | if ( offset & 0x80 ) { |
| 87 | 87 | if ( data & 0x20 ) { |
| 88 | 88 | logerror("voice write %02X, data = %02X (p1 = %02X)\n", offset, data, p1 ); |
| 89 | sp0256_ALD_w( | |
| 89 | sp0256_ALD_w( | |
| 90 | 90 | } else { |
| 91 | 91 | /* TODO: Reset sp0256 in this case */ |
| 92 | 92 | } |
| r8453 | r8454 | |
|---|---|---|
| 203 | 203 | { |
| 204 | 204 | case 1: |
| 205 | 205 | tandy_ppi.portb = data; |
| 206 | pit8253_gate2_w( | |
| 206 | pit8253_gate2_w( | |
| 207 | 207 | pc_speaker_set_spkrdata( space->machine, data & 0x02 ); |
| 208 | 208 | pc_keyb_set_clock(data&0x40); |
| 209 | 209 | if ( data & 0x80 ) |
| r8453 | r8454 | |
| 214 | 214 | case 2: |
| 215 | 215 | tandy_ppi.portc = data; |
| 216 | 216 | if (data & 8) |
| 217 | cpu_set_clockscale( | |
| 217 | cpu_set_clockscale( | |
| 218 | 218 | else |
| 219 | cpu_set_clockscale( | |
| 219 | cpu_set_clockscale( | |
| 220 | 220 | break; |
| 221 | 221 | } |
| 222 | 222 | } |
| r8453 | r8454 | |
|---|---|---|
| 91 | 91 | // bit 3 - I3 (external bus) |
| 92 | 92 | |
| 93 | 93 | // bit 2 - cassette |
| 94 | data |= (cassette_input( | |
| 94 | data |= (cassette_input( | |
| 95 | 95 | |
| 96 | 96 | // bit 1 - reset button |
| 97 | 97 | data |= (input_port_read(space->machine, "RESET")) ? 0x02 : 0x00; |
| r8453 | r8454 | |
| 105 | 105 | READ8_HANDLER( primo_be_2_r ) |
| 106 | 106 | { |
| 107 | 107 | UINT8 data = 0xff; |
| 108 | running_device *serbus = | |
| 108 | running_device *serbus = | |
| 109 | 109 | |
| 110 | 110 | // bit 7, 6 - not used |
| 111 | 111 | |
| r8453 | r8454 | |
| 135 | 135 | |
| 136 | 136 | WRITE8_HANDLER( primo_ki_1_w ) |
| 137 | 137 | { |
| 138 | running_device *speaker = | |
| 138 | running_device *speaker = | |
| 139 | 139 | // bit 7 - NMI generator enable/disable |
| 140 | 140 | primo_nmi = (data & 0x80) ? 1 : 0; |
| 141 | 141 | |
| r8453 | r8454 | |
| 158 | 158 | switch (data & 0x03) |
| 159 | 159 | { |
| 160 | 160 | case 0: |
| 161 | cassette_output( | |
| 161 | cassette_output( | |
| 162 | 162 | break; |
| 163 | 163 | case 1: |
| 164 | 164 | case 2: |
| 165 | cassette_output( | |
| 165 | cassette_output( | |
| 166 | 166 | break; |
| 167 | 167 | case 3: |
| 168 | cassette_output( | |
| 168 | cassette_output( | |
| 169 | 169 | break; |
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | WRITE8_HANDLER( primo_ki_2_w ) |
| 174 | 174 | { |
| 175 | running_device *serbus = | |
| 175 | running_device *serbus = | |
| 176 | 176 | |
| 177 | 177 | // bit 7, 6 - not used |
| 178 | 178 | |
| r8453 | r8454 | |
| 244 | 244 | if (input_port_read(machine, "MEMORY_EXPANSION")) |
| 245 | 245 | primo_port_FD = 0x00; |
| 246 | 246 | primo_update_memory(machine); |
| 247 | cpu_set_clockscale( | |
| 247 | cpu_set_clockscale(m | |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | MACHINE_RESET( primoa ) |
| r8453 | r8454 | |
| 269 | 269 | static void primo_setup_pss (running_machine *machine, UINT8* snapshot_data, UINT32 snapshot_size) |
| 270 | 270 | { |
| 271 | 271 | int i; |
| 272 | running_device *speaker = | |
| 272 | running_device *speaker = m | |
| 273 | 273 | |
| 274 | 274 | /* Z80 registers */ |
| 275 | 275 | |
| 276 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_BC, snapshot_data[4] + snapshot_data[5]*256); | |
| 277 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_DE, snapshot_data[6] + snapshot_data[7]*256); | |
| 278 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_HL, snapshot_data[8] + snapshot_data[9]*256); | |
| 279 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_AF, snapshot_data[10] + snapshot_data[11]*256); | |
| 280 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_BC2, snapshot_data[12] + snapshot_data[13]*256); | |
| 281 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_DE2, snapshot_data[14] + snapshot_data[15]*256); | |
| 282 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_HL2, snapshot_data[16] + snapshot_data[17]*256); | |
| 283 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_AF2, snapshot_data[18] + snapshot_data[19]*256); | |
| 284 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_PC, snapshot_data[20] + snapshot_data[21]*256); | |
| 285 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_SP, snapshot_data[22] + snapshot_data[23]*256); | |
| 286 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_I, snapshot_data[24]); | |
| 287 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_R, snapshot_data[25]); | |
| 288 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_IX, snapshot_data[26] + snapshot_data[27]*256); | |
| 289 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_IY, snapshot_data[28] + snapshot_data[29]*256); | |
| 276 | cpu_set_reg(machine->device("maincpu"), Z80_BC, snapshot_data[4] + snapshot_data[5]*256); | |
| 277 | cpu_set_reg(machine->device("maincpu"), Z80_DE, snapshot_data[6] + snapshot_data[7]*256); | |
| 278 | cpu_set_reg(machine->device("maincpu"), Z80_HL, snapshot_data[8] + snapshot_data[9]*256); | |
| 279 | cpu_set_reg(machine->device("maincpu"), Z80_AF, snapshot_data[10] + snapshot_data[11]*256); | |
| 280 | cpu_set_reg(machine->device("maincpu"), Z80_BC2, snapshot_data[12] + snapshot_data[13]*256); | |
| 281 | cpu_set_reg(machine->device("maincpu"), Z80_DE2, snapshot_data[14] + snapshot_data[15]*256); | |
| 282 | cpu_set_reg(machine->device("maincpu"), Z80_HL2, snapshot_data[16] + snapshot_data[17]*256); | |
| 283 | cpu_set_reg(machine->device("maincpu"), Z80_AF2, snapshot_data[18] + snapshot_data[19]*256); | |
| 284 | cpu_set_reg(machine->device("maincpu"), Z80_PC, snapshot_data[20] + snapshot_data[21]*256); | |
| 285 | cpu_set_reg(machine->device("maincpu"), Z80_SP, snapshot_data[22] + snapshot_data[23]*256); | |
| 286 | cpu_set_reg(machine->device("maincpu"), Z80_I, snapshot_data[24]); | |
| 287 | cpu_set_reg(machine->device("maincpu"), Z80_R, snapshot_data[25]); | |
| 288 | cpu_set_reg(machine->device("maincpu"), Z80_IX, snapshot_data[26] + snapshot_data[27]*256); | |
| 289 | cpu_set_reg(machine->device("maincpu"), Z80_IY, snapshot_data[28] + snapshot_data[29]*256); | |
| 290 | 290 | |
| 291 | 291 | |
| 292 | 292 | /* IO ports */ |
| r8453 | r8454 | |
| 349 | 349 | for (i=4; i<quickload_size; i++) |
| 350 | 350 | memory_write_byte(cputag_get_address_space(machine, "maincpu",ADDRESS_SPACE_PROGRAM), start_addr+i-4, quickload_data[i]); |
| 351 | 351 | |
| 352 | cpu_set_reg( | |
| 352 | cpu_set_reg(m | |
| 353 | 353 | |
| 354 | 354 | logerror ("Quickload .pp l: %04x r: %04x s: %04x\n", load_addr, start_addr, quickload_size-4); |
| 355 | 355 | } |
| r8453 | r8454 | |
|---|---|---|
| 469 | 469 | |
| 470 | 470 | READ8_HANDLER ( ti85_port_0007_r ) |
| 471 | 471 | { |
| 472 | running_device *ti85serial = | |
| 472 | running_device *ti85serial = | |
| 473 | 473 | |
| 474 | 474 | ti85_update_serial(ti85serial); |
| 475 | 475 | return (ti85_white_out<<3) |
| r8453 | r8454 | |
| 622 | 622 | |
| 623 | 623 | WRITE8_HANDLER ( ti85_port_0007_w ) |
| 624 | 624 | { |
| 625 | running_device *speaker = devtag_get_device(space->machine, "speaker"); | |
| 626 | running_device *ti85serial = devtag_get_device(space->machine, "ti85serial"); | |
| 625 | running_device *speaker = space->machine->device("speaker"); | |
| 626 | running_device *ti85serial = space->machine->device("ti85serial"); | |
| 627 | 627 | |
| 628 | 628 | speaker_level_w(speaker,( (data>>2)|(data>>3) )&0x01 ); |
| 629 | 629 | ti85_red_out=(data>>2)&0x01; |
| r8453 | r8454 | |
| 796 | 796 | if (file) |
| 797 | 797 | { |
| 798 | 798 | mame_fread(file, ti8x_ram, sizeof(unsigned char)*32*1024); |
| 799 | cpu_set_reg( | |
| 799 | cpu_set_reg(m | |
| 800 | 800 | } |
| 801 | 801 | else |
| 802 | 802 | memset(ti8x_ram, 0, sizeof(unsigned char)*32*1024); |
| r8453 | r8454 | |
| 814 | 814 | if (file) |
| 815 | 815 | { |
| 816 | 816 | mame_fread(file, ti8x_ram, sizeof(unsigned char)*128*1024); |
| 817 | cpu_set_reg( | |
| 817 | cpu_set_reg(m | |
| 818 | 818 | } |
| 819 | 819 | else |
| 820 | 820 | memset(ti8x_ram, 0, sizeof(unsigned char)*128*1024); |
| r8453 | r8454 | |
| 833 | 833 | /* Set registers */ |
| 834 | 834 | lo = reg[0x00] & 0x0ff; |
| 835 | 835 | hi = reg[0x01] & 0x0ff; |
| 836 | cpu_set_reg( | |
| 836 | cpu_set_reg(m | |
| 837 | 837 | lo = reg[0x04] & 0x0ff; |
| 838 | 838 | hi = reg[0x05] & 0x0ff; |
| 839 | cpu_set_reg( | |
| 839 | cpu_set_reg(m | |
| 840 | 840 | lo = reg[0x08] & 0x0ff; |
| 841 | 841 | hi = reg[0x09] & 0x0ff; |
| 842 | cpu_set_reg( | |
| 842 | cpu_set_reg(m | |
| 843 | 843 | lo = reg[0x0c] & 0x0ff; |
| 844 | 844 | hi = reg[0x0d] & 0x0ff; |
| 845 | cpu_set_reg( | |
| 845 | cpu_set_reg(m | |
| 846 | 846 | lo = reg[0x10] & 0x0ff; |
| 847 | 847 | hi = reg[0x11] & 0x0ff; |
| 848 | cpu_set_reg( | |
| 848 | cpu_set_reg(m | |
| 849 | 849 | lo = reg[0x14] & 0x0ff; |
| 850 | 850 | hi = reg[0x15] & 0x0ff; |
| 851 | cpu_set_reg( | |
| 851 | cpu_set_reg(m | |
| 852 | 852 | lo = reg[0x18] & 0x0ff; |
| 853 | 853 | hi = reg[0x19] & 0x0ff; |
| 854 | cpu_set_reg( | |
| 854 | cpu_set_reg(m | |
| 855 | 855 | lo = reg[0x1c] & 0x0ff; |
| 856 | 856 | hi = reg[0x1d] & 0x0ff; |
| 857 | cpu_set_reg( | |
| 857 | cpu_set_reg(m | |
| 858 | 858 | lo = reg[0x20] & 0x0ff; |
| 859 | 859 | hi = reg[0x21] & 0x0ff; |
| 860 | cpu_set_reg( | |
| 860 | cpu_set_reg(m | |
| 861 | 861 | lo = reg[0x24] & 0x0ff; |
| 862 | 862 | hi = reg[0x25] & 0x0ff; |
| 863 | cpu_set_reg( | |
| 863 | cpu_set_reg(m | |
| 864 | 864 | lo = reg[0x28] & 0x0ff; |
| 865 | 865 | hi = reg[0x29] & 0x0ff; |
| 866 | cpu_set_reg( | |
| 866 | cpu_set_reg(m | |
| 867 | 867 | lo = reg[0x2c] & 0x0ff; |
| 868 | 868 | hi = reg[0x2d] & 0x0ff; |
| 869 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_HL2, (hi << 8) | lo); | |
| 870 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_IFF1, reg[0x30]&0x0ff); | |
| 871 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_IFF2, reg[0x34]&0x0ff); | |
| 872 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_HALT, reg[0x38]&0x0ff); | |
| 873 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_IM, reg[0x3c]&0x0ff); | |
| 874 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_I, reg[0x40]&0x0ff); | |
| 869 | cpu_set_reg(machine->device("maincpu"), Z80_HL2, (hi << 8) | lo); | |
| 870 | cpu_set_reg(machine->device("maincpu"), Z80_IFF1, reg[0x30]&0x0ff); | |
| 871 | cpu_set_reg(machine->device("maincpu"), Z80_IFF2, reg[0x34]&0x0ff); | |
| 872 | cpu_set_reg(machine->device("maincpu"), Z80_HALT, reg[0x38]&0x0ff); | |
| 873 | cpu_set_reg(machine->device("maincpu"), Z80_IM, reg[0x3c]&0x0ff); | |
| 874 | cpu_set_reg(machine->device("maincpu"), Z80_I, reg[0x40]&0x0ff); | |
| 875 | 875 | |
| 876 | cpu_set_reg( | |
| 876 | cpu_set_reg(m | |
| 877 | 877 | |
| 878 | 878 | cputag_set_input_line(machine, "maincpu", 0, 0); |
| 879 | 879 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, 0); |
| r8453 | r8454 | |
|---|---|---|
| 163 | 163 | { |
| 164 | 164 | int data = 0x0f; |
| 165 | 165 | |
| 166 | if (cassette_input(dev | |
| 166 | if (cassette_input(dev | |
| 167 | 167 | data |= 0x80; |
| 168 | 168 | if (!svi318_cassette_present(device->machine, 0)) |
| 169 | 169 | data |= 0x40; |
| r8453 | r8454 | |
| 220 | 220 | /* key click */ |
| 221 | 221 | val = (data & 0x80) ? 0x3e : 0; |
| 222 | 222 | val += (data & 0x40) ? 0x3e : 0; |
| 223 | dac_signed_data_w (dev | |
| 223 | dac_signed_data_w (dev | |
| 224 | 224 | |
| 225 | 225 | /* cassette motor on/off */ |
| 226 | 226 | if (svi318_cassette_present(device->machine, 0)) |
| 227 | 227 | { |
| 228 | 228 | cassette_change_state( |
| 229 | dev | |
| 229 | dev | |
| 230 | 230 | (data & 0x10) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, |
| 231 | 231 | CASSETTE_MOTOR_DISABLED); |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | /* cassette signal write */ |
| 235 | cassette_output(dev | |
| 235 | cassette_output(dev | |
| 236 | 236 | |
| 237 | 237 | svi.keyboard_row = data & 0x0F; |
| 238 | 238 | } |
| r8453 | r8454 | |
| 335 | 335 | |
| 336 | 336 | static WRITE8_HANDLER( svi318_fdc_drive_motor_w ) |
| 337 | 337 | { |
| 338 | running_device *fdc = | |
| 338 | running_device *fdc = | |
| 339 | 339 | switch (data & 3) |
| 340 | 340 | { |
| 341 | 341 | case 1: |
| r8453 | r8454 | |
| 351 | 351 | |
| 352 | 352 | static WRITE8_HANDLER( svi318_fdc_density_side_w ) |
| 353 | 353 | { |
| 354 | running_device *fdc = | |
| 354 | running_device *fdc = | |
| 355 | 355 | |
| 356 | 356 | wd17xx_dden_w(fdc, BIT(data, 0)); |
| 357 | 357 | wd17xx_set_side(fdc, BIT(data, 1)); |
| r8453 | r8454 | |
| 421 | 421 | } |
| 422 | 422 | else if (!strcmp(screen->tag(), "svi806")) |
| 423 | 423 | { |
| 424 | running_device *mc6845 = | |
| 424 | running_device *mc6845 = | |
| 425 | 425 | mc6845_update(mc6845, bitmap, cliprect); |
| 426 | 426 | } |
| 427 | 427 | else |
| r8453 | r8454 | |
| 571 | 571 | DRIVER_INIT( svi318 ) |
| 572 | 572 | { |
| 573 | 573 | /* z80 stuff */ |
| 574 | z80_set_cycle_tables( | |
| 574 | z80_set_cycle_tables( m | |
| 575 | 575 | |
| 576 | 576 | memset(&svi, 0, sizeof (svi) ); |
| 577 | 577 | |
| r8453 | r8454 | |
| 580 | 580 | svi.svi318 = 1; |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | cpu_set_input_line_vector( | |
| 583 | cpu_set_input_line_vector(m | |
| 584 | 584 | |
| 585 | 585 | /* memory */ |
| 586 | 586 | svi.empty_bank = auto_alloc_array(machine, UINT8, 0x8000); |
| r8453 | r8454 | |
| 725 | 725 | } |
| 726 | 726 | break; |
| 727 | 727 | case SVI_EXPRAM2: |
| 728 | if ( messram_get_size( | |
| 728 | if ( messram_get_size(m | |
| 729 | 729 | { |
| 730 | svi.bankLow_ptr = messram_get_ptr( | |
| 730 | svi.bankLow_ptr = messram_get_ptr(m | |
| 731 | 731 | svi.bankLow_read_only = 0; |
| 732 | 732 | } |
| 733 | 733 | break; |
| 734 | 734 | case SVI_EXPRAM3: |
| 735 | if ( messram_get_size( | |
| 735 | if ( messram_get_size(m | |
| 736 | 736 | { |
| 737 | svi.bankLow_ptr = messram_get_ptr( | |
| 737 | svi.bankLow_ptr = messram_get_ptr(m | |
| 738 | 738 | svi.bankLow_read_only = 0; |
| 739 | 739 | } |
| 740 | 740 | break; |
| r8453 | r8454 | |
| 746 | 746 | switch( svi.bankHigh1 ) |
| 747 | 747 | { |
| 748 | 748 | case SVI_INTERNAL: |
| 749 | if ( messram_get_size( | |
| 749 | if ( messram_get_size(m | |
| 750 | 750 | { |
| 751 | svi.bankHigh2_ptr = messram_get_ptr( | |
| 751 | svi.bankHigh2_ptr = messram_get_ptr(m | |
| 752 | 752 | svi.bankHigh2_read_only = 0; |
| 753 | 753 | } |
| 754 | 754 | else |
| 755 | 755 | { |
| 756 | svi.bankHigh1_ptr = messram_get_ptr( | |
| 756 | svi.bankHigh1_ptr = messram_get_ptr(m | |
| 757 | 757 | svi.bankHigh1_read_only = 0; |
| 758 | svi.bankHigh2_ptr = messram_get_ptr( | |
| 758 | svi.bankHigh2_ptr = messram_get_ptr(m | |
| 759 | 759 | svi.bankHigh2_read_only = 0; |
| 760 | 760 | } |
| 761 | 761 | break; |
| 762 | 762 | case SVI_EXPRAM2: |
| 763 | if ( messram_get_size( | |
| 763 | if ( messram_get_size(m | |
| 764 | 764 | { |
| 765 | svi.bankHigh1_ptr = messram_get_ptr( | |
| 765 | svi.bankHigh1_ptr = messram_get_ptr(m | |
| 766 | 766 | svi.bankHigh1_read_only = 0; |
| 767 | svi.bankHigh2_ptr = messram_get_ptr( | |
| 767 | svi.bankHigh2_ptr = messram_get_ptr(m | |
| 768 | 768 | svi.bankHigh2_read_only = 0; |
| 769 | 769 | } |
| 770 | 770 | break; |
| 771 | 771 | case SVI_EXPRAM3: |
| 772 | if ( messram_get_size( | |
| 772 | if ( messram_get_size(m | |
| 773 | 773 | { |
| 774 | svi.bankHigh1_ptr = messram_get_ptr( | |
| 774 | svi.bankHigh1_ptr = messram_get_ptr(m | |
| 775 | 775 | svi.bankHigh1_read_only = 0; |
| 776 | svi.bankHigh2_ptr = messram_get_ptr( | |
| 776 | svi.bankHigh2_ptr = messram_get_ptr(m | |
| 777 | 777 | svi.bankHigh2_read_only = 0; |
| 778 | 778 | } |
| 779 | 779 | break; |
| r8453 | r8454 | |
| 818 | 818 | |
| 819 | 819 | int svi318_cassette_present(running_machine *machine, int id) |
| 820 | 820 | { |
| 821 | device_image_interface *image = dynamic_cast<device_image_interface *>( | |
| 821 | device_image_interface *image = dynamic_cast<device_image_interface *>(m | |
| 822 | 822 | |
| 823 | 823 | if ( image == NULL ) |
| 824 | 824 | return FALSE; |
| r8453 | r8454 | |
| 840 | 840 | switch( offset ) |
| 841 | 841 | { |
| 842 | 842 | case 0x12: |
| 843 | device = | |
| 843 | device = | |
| 844 | 844 | data = 0xfe | centronics_busy_r(device); |
| 845 | 845 | break; |
| 846 | 846 | |
| r8453 | r8454 | |
| 852 | 852 | case 0x25: |
| 853 | 853 | case 0x26: |
| 854 | 854 | case 0x27: |
| 855 | device = | |
| 855 | device = | |
| 856 | 856 | data = ins8250_r(device, offset & 7); |
| 857 | 857 | break; |
| 858 | 858 | |
| r8453 | r8454 | |
| 864 | 864 | case 0x2D: |
| 865 | 865 | case 0x2E: |
| 866 | 866 | case 0x2F: |
| 867 | device = | |
| 867 | device = | |
| 868 | 868 | data = ins8250_r(device, offset & 7); |
| 869 | 869 | break; |
| 870 | 870 | |
| 871 | 871 | case 0x30: |
| 872 | device = | |
| 872 | device = | |
| 873 | 873 | data = wd17xx_status_r(device, 0); |
| 874 | 874 | break; |
| 875 | 875 | case 0x31: |
| 876 | device = | |
| 876 | device = | |
| 877 | 877 | data = wd17xx_track_r(device, 0); |
| 878 | 878 | break; |
| 879 | 879 | case 0x32: |
| 880 | device = | |
| 880 | device = | |
| 881 | 881 | data = wd17xx_sector_r(device, 0); |
| 882 | 882 | break; |
| 883 | 883 | case 0x33: |
| 884 | device = | |
| 884 | device = | |
| 885 | 885 | data = wd17xx_data_r(device, 0); |
| 886 | 886 | break; |
| 887 | 887 | case 0x34: |
| 888 | 888 | data = svi318_fdc_irqdrq_r(space, 0); |
| 889 | 889 | break; |
| 890 | 890 | case 0x51: |
| 891 | device = | |
| 891 | device = | |
| 892 | 892 | data = mc6845_register_r(device, 0); |
| 893 | 893 | break; |
| 894 | 894 | } |
| r8453 | r8454 | |
| 908 | 908 | switch( offset ) |
| 909 | 909 | { |
| 910 | 910 | case 0x10: |
| 911 | device = | |
| 911 | device = | |
| 912 | 912 | centronics_data_w(device, 0, data); |
| 913 | 913 | break; |
| 914 | 914 | |
| 915 | 915 | case 0x11: |
| 916 | device = | |
| 916 | device = | |
| 917 | 917 | centronics_strobe_w(device, BIT(data, 0)); |
| 918 | 918 | break; |
| 919 | 919 | |
| r8453 | r8454 | |
| 925 | 925 | case 0x25: |
| 926 | 926 | case 0x26: |
| 927 | 927 | case 0x27: |
| 928 | device = | |
| 928 | device = | |
| 929 | 929 | ins8250_w(device, offset & 7, data); |
| 930 | 930 | break; |
| 931 | 931 | |
| r8453 | r8454 | |
| 937 | 937 | case 0x2D: |
| 938 | 938 | case 0x2E: |
| 939 | 939 | case 0x2F: |
| 940 | device = | |
| 940 | device = | |
| 941 | 941 | ins8250_w(device, offset & 7, data); |
| 942 | 942 | break; |
| 943 | 943 | |
| 944 | 944 | case 0x30: |
| 945 | device = | |
| 945 | device = | |
| 946 | 946 | wd17xx_command_w(device, 0, data); |
| 947 | 947 | break; |
| 948 | 948 | case 0x31: |
| 949 | device = | |
| 949 | device = | |
| 950 | 950 | wd17xx_track_w(device, 0, data); |
| 951 | 951 | break; |
| 952 | 952 | case 0x32: |
| 953 | device = | |
| 953 | device = | |
| 954 | 954 | wd17xx_sector_w(device, 0, data); |
| 955 | 955 | break; |
| 956 | 956 | case 0x33: |
| 957 | device = | |
| 957 | device = | |
| 958 | 958 | wd17xx_data_w(device, 0, data); |
| 959 | 959 | break; |
| 960 | 960 | case 0x34: |
| r8453 | r8454 | |
| 965 | 965 | break; |
| 966 | 966 | |
| 967 | 967 | case 0x50: |
| 968 | device = | |
| 968 | device = | |
| 969 | 969 | mc6845_address_w(device, 0, data); |
| 970 | 970 | break; |
| 971 | 971 | case 0x51: |
| 972 | device = | |
| 972 | device = | |
| 973 | 973 | mc6845_register_w(device, 0, data); |
| 974 | 974 | break; |
| 975 | 975 |
| r8453 | r8454 | |
|---|---|---|
| 154 | 154 | pc1640.port61=data; |
| 155 | 155 | if (data==0x30) pc1640.port62=(pc1640.port65&0x10)>>4; |
| 156 | 156 | else if (data==0x34) pc1640.port62=pc1640.port65&0xf; |
| 157 | pit8253_gate2_w( | |
| 157 | pit8253_gate2_w( | |
| 158 | 158 | pc_speaker_set_spkrdata( space->machine, data & 0x02 ); |
| 159 | 159 | pc_keyb_set_clock(data&0x40); |
| 160 | 160 | break; |
| r8453 | r8454 | |
| 192 | 192 | |
| 193 | 193 | case 2: |
| 194 | 194 | data = pc1640.port62; |
| 195 | if (pit8253_get_output( | |
| 195 | if (pit8253_get_output( | |
| 196 | 196 | data |= 0x20; |
| 197 | 197 | break; |
| 198 | 198 | } |
| r8453 | r8454 | |
| 201 | 201 | |
| 202 | 202 | READ8_HANDLER( pc200_port378_r ) |
| 203 | 203 | { |
| 204 | running_device *lpt = | |
| 204 | running_device *lpt = | |
| 205 | 205 | UINT8 data = pc_lpt_r(lpt, offset); |
| 206 | 206 | |
| 207 | 207 | if (offset == 1) |
| r8453 | r8454 | |
| 214 | 214 | |
| 215 | 215 | static READ8_HANDLER( pc200_port278_r ) |
| 216 | 216 | { |
| 217 | running_device *lpt = | |
| 217 | running_device *lpt = | |
| 218 | 218 | UINT8 data = pc_lpt_r(lpt, offset); |
| 219 | 219 | |
| 220 | 220 | if (offset == 1) |
| r8453 | r8454 | |
| 228 | 228 | |
| 229 | 229 | READ8_HANDLER( pc1640_port378_r ) |
| 230 | 230 | { |
| 231 | running_device *lpt = | |
| 231 | running_device *lpt = | |
| 232 | 232 | UINT8 data = pc_lpt_r(lpt, offset); |
| 233 | 233 | |
| 234 | 234 | if (offset == 1) |
| r8453 | r8454 | |
|---|---|---|
| 23 | 23 | |
| 24 | 24 | if (offset == 0) |
| 25 | 25 | { |
| 26 | double level = cassette_input( | |
| 26 | double level = cassette_input( | |
| 27 | 27 | return (level > 0) ? 0xfe : 0xff; |
| 28 | 28 | } |
| 29 | 29 | else |
| r8453 | r8454 | |
| 38 | 38 | { |
| 39 | 39 | double val = (((data >>6) & 1 ) + ((data >> 2) & 1) - 1) * 32000; |
| 40 | 40 | galaxy_latch_value = data; |
| 41 | cassette_output( | |
| 41 | cassette_output( | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| r8453 | r8454 | |
| 69 | 69 | |
| 70 | 70 | static void galaxy_setup_snapshot (running_machine *machine, const UINT8 * data, UINT32 size) |
| 71 | 71 | { |
| 72 | running_device *cpu = | |
| 72 | running_device *cpu = m | |
| 73 | 73 | |
| 74 | 74 | switch (size) |
| 75 | 75 | { |
| r8453 | r8454 | |
| 93 | 93 | cpu_set_reg(cpu, Z80_I, data[0x40]); |
| 94 | 94 | cpu_set_reg(cpu, Z80_R, (data[0x44] & 0x7f) | (data[0x48] & 0x80)); |
| 95 | 95 | |
| 96 | memcpy (messram_get_ptr( | |
| 96 | memcpy (messram_get_ptr(m | |
| 97 | 97 | |
| 98 | 98 | break; |
| 99 | 99 | case GALAXY_SNAPSHOT_V2_SIZE: |
| r8453 | r8454 | |
| 120 | 120 | cpu_set_reg(cpu, Z80_I, data[0x19]); |
| 121 | 121 | cpu_set_reg(cpu, Z80_R, data[0x1a]); |
| 122 | 122 | |
| 123 | memcpy (messram_get_ptr( | |
| 123 | memcpy (messram_get_ptr(m | |
| 124 | 124 | |
| 125 | 125 | break; |
| 126 | 126 | } |
| r8453 | r8454 | |
| 158 | 158 | DRIVER_INIT( galaxy ) |
| 159 | 159 | { |
| 160 | 160 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 161 | memory_install_readwrite_bank( space, 0x2800, 0x2800 + messram_get_size(devtag_get_device(machine, "messram")) - 1, 0, 0, "bank1"); | |
| 162 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 161 | memory_install_readwrite_bank( space, 0x2800, 0x2800 + messram_get_size(machine->device("messram")) - 1, 0, 0, "bank1"); | |
| 162 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram"))); | |
| 163 | 163 | |
| 164 | if (messram_get_size( | |
| 164 | if (messram_get_size(m | |
| 165 | 165 | { |
| 166 | memory_nop_readwrite( space, 0x2800 + messram_get_size( | |
| 166 | memory_nop_readwrite( space, 0x2800 + messram_get_size(m | |
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
| r8453 | r8454 | |
| 186 | 186 | if (input_port_read(machine, "ROM2")) |
| 187 | 187 | memory_set_bankptr(machine,"bank10", memory_region(machine, "maincpu") + 0x1000); |
| 188 | 188 | |
| 189 | cpu_set_irq_callback( | |
| 189 | cpu_set_irq_callback(m | |
| 190 | 190 | galaxy_interrupts_enabled = TRUE; |
| 191 | 191 | } |
| 192 | 192 | |
| r8453 | r8454 | |
| 200 | 200 | UINT8 *ROM = memory_region(machine, "maincpu"); |
| 201 | 201 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 202 | 202 | |
| 203 | cpu_set_irq_callback( | |
| 203 | cpu_set_irq_callback(m | |
| 204 | 204 | |
| 205 | 205 | ROM[0x0037] = 0x29; |
| 206 | 206 | ROM[0x03f9] = 0xcd; |
| r8453 | r8454 | |
|---|---|---|
| 132 | 132 | running_device *tms9902 = NULL; |
| 133 | 133 | |
| 134 | 134 | if (strcmp(image.device().tag(), "rs232:port0")) { |
| 135 | tms9902 = | |
| 135 | tms9902 = | |
| 136 | 136 | } |
| 137 | 137 | if (strcmp(image.device().tag(), "rs232:port1")) { |
| 138 | tms9902 = | |
| 138 | tms9902 = | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | if (image) |
| r8453 | r8454 | |
| 173 | 173 | static DEVICE_RESET( ti99_4_rs232 ) |
| 174 | 174 | { |
| 175 | 175 | rs232_DSR = memory_region(device->machine, region_dsr) + offset_rs232_dsr; |
| 176 | running_device *box = dev | |
| 176 | running_device *box = dev | |
| 177 | 177 | ti99_peb_set_card_handlers(box, 0x1300, & rs232_handlers); |
| 178 | 178 | } |
| 179 | 179 | |
| r8453 | r8454 | |
| 303 | 303 | switch (offset) |
| 304 | 304 | { |
| 305 | 305 | case 0: |
| 306 | reply = ti99_4_pio_r( | |
| 306 | reply = ti99_4_pio_r(m | |
| 307 | 307 | break; |
| 308 | 308 | |
| 309 | 309 | default: |
| r8453 | r8454 | |
| 314 | 314 | |
| 315 | 315 | case 1: |
| 316 | 316 | /* first 9902 */ |
| 317 | reply = tms9902_cru_r( | |
| 317 | reply = tms9902_cru_r(m | |
| 318 | 318 | break; |
| 319 | 319 | |
| 320 | 320 | case 2: |
| 321 | 321 | /* second 9902 */ |
| 322 | reply = tms9902_cru_r( | |
| 322 | reply = tms9902_cru_r(m | |
| 323 | 323 | break; |
| 324 | 324 | |
| 325 | 325 | default: |
| r8453 | r8454 | |
| 340 | 340 | { |
| 341 | 341 | case 0: |
| 342 | 342 | /* custom buffer */ |
| 343 | ti99_4_pio_w( | |
| 343 | ti99_4_pio_w(m | |
| 344 | 344 | break; |
| 345 | 345 | |
| 346 | 346 | case 1: |
| 347 | 347 | /* first 9902 */ |
| 348 | tms9902_cru_w( | |
| 348 | tms9902_cru_w(m | |
| 349 | 349 | break; |
| 350 | 350 | |
| 351 | 351 | case 2: |
| 352 | 352 | /* second 9902 */ |
| 353 | tms9902_cru_w( | |
| 353 | tms9902_cru_w(m | |
| 354 | 354 | break; |
| 355 | 355 | |
| 356 | 356 | default: |
| r8453 | r8454 | |
| 375 | 375 | else |
| 376 | 376 | { |
| 377 | 377 | /* PIO */ |
| 378 | reply = ti99_4_pio_buf_r( | |
| 378 | reply = ti99_4_pio_buf_r( | |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | return reply; |
| r8453 | r8454 | |
| 389 | 389 | if (offset >= 0x1000) |
| 390 | 390 | { |
| 391 | 391 | /* PIO */ |
| 392 | ti99_4_pio_buf_w( | |
| 392 | ti99_4_pio_buf_w( | |
| 393 | 393 | } |
| 394 | 394 | else |
| 395 | 395 | { |
| r8453 | r8454 | |
| 402 | 402 | */ |
| 403 | 403 | static TMS9902_INT_CALLBACK( int_callback_0 ) |
| 404 | 404 | { |
| 405 | running_device *box = dev | |
| 405 | running_device *box = dev | |
| 406 | 406 | ti99_peb_set_ila_bit(box, inta_rs232_1_bit, INT); |
| 407 | 407 | } |
| 408 | 408 | static TMS9902_INT_CALLBACK( int_callback_1 ) |
| 409 | 409 | { |
| 410 | running_device *box = dev | |
| 410 | running_device *box = dev | |
| 411 | 411 | ti99_peb_set_ila_bit(box, inta_rs232_2_bit, INT); |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | static TMS9902_XMIT_CALLBACK( xmit_callback_0 ) |
| 415 | 415 | { |
| 416 | 416 | UINT8 buf = data; |
| 417 | device_image_interface *rs232_fp = dynamic_cast<device_image_interface *>(dev | |
| 417 | device_image_interface *rs232_fp = dynamic_cast<device_image_interface *>(dev | |
| 418 | 418 | |
| 419 | 419 | if (rs232_fp) |
| 420 | 420 | rs232_fp->fwrite(&buf, 1); |
| r8453 | r8454 | |
| 423 | 423 | static TMS9902_XMIT_CALLBACK( xmit_callback_1 ) |
| 424 | 424 | { |
| 425 | 425 | UINT8 buf = data; |
| 426 | device_image_interface *rs232_fp = dynamic_cast<device_image_interface *>(dev | |
| 426 | device_image_interface *rs232_fp = dynamic_cast<device_image_interface *>(dev | |
| 427 | 427 | |
| 428 | 428 | if (rs232_fp) |
| 429 | 429 | rs232_fp->fwrite(&buf, 1); |
| r8453 | r8454 | |
|---|---|---|
| 218 | 218 | /* This is called whenever the T0 pin switches state */ |
| 219 | 219 | int gamepock_io_callback( running_device *device, int ioline, int state ) |
| 220 | 220 | { |
| 221 | running_device *speaker = dev | |
| 221 | running_device *speaker = dev | |
| 222 | 222 | if ( ioline == UPD7810_TO ) |
| 223 | 223 | { |
| 224 | 224 | speaker_level_w(speaker, state & 1 ); |
| r8453 | r8454 | |
|---|---|---|
| 265 | 265 | /*-------------------------------------------------------------------------*/ |
| 266 | 266 | static void compis_fdc_reset(running_machine *machine) |
| 267 | 267 | { |
| 268 | running_device *fdc = | |
| 268 | running_device *fdc = m | |
| 269 | 269 | |
| 270 | 270 | upd765_reset(fdc, 0); |
| 271 | 271 | |
| r8453 | r8454 | |
| 275 | 275 | |
| 276 | 276 | static void compis_fdc_tc(running_machine *machine, int state) |
| 277 | 277 | { |
| 278 | running_device *fdc = | |
| 278 | running_device *fdc = m | |
| 279 | 279 | /* Terminal count if iSBX-218A has DMA enabled */ |
| 280 | 280 | if (input_port_read(machine, "DSW1")) |
| 281 | 281 | { |
| r8453 | r8454 | |
| 316 | 316 | |
| 317 | 317 | READ16_HANDLER (compis_fdc_dack_r) |
| 318 | 318 | { |
| 319 | running_device *fdc = | |
| 319 | running_device *fdc = | |
| 320 | 320 | UINT16 data; |
| 321 | 321 | data = 0xffff; |
| 322 | 322 | /* DMA acknowledge if iSBX-218A has DMA enabled */ |
| r8453 | r8454 | |
| 330 | 330 | |
| 331 | 331 | WRITE16_HANDLER (compis_fdc_w) |
| 332 | 332 | { |
| 333 | running_device *fdc = | |
| 333 | running_device *fdc = | |
| 334 | 334 | switch(offset) |
| 335 | 335 | { |
| 336 | 336 | case 2: |
| r8453 | r8454 | |
| 344 | 344 | |
| 345 | 345 | READ16_HANDLER (compis_fdc_r) |
| 346 | 346 | { |
| 347 | running_device *fdc = | |
| 347 | running_device *fdc = | |
| 348 | 348 | UINT16 data; |
| 349 | 349 | data = 0xffff; |
| 350 | 350 | switch(offset) |
| r8453 | r8454 | |
| 486 | 486 | |
| 487 | 487 | READ16_HANDLER ( compis_usart_r ) |
| 488 | 488 | { |
| 489 | running_device *uart = | |
| 489 | running_device *uart = | |
| 490 | 490 | return msm8251_data_r(uart, offset); |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | WRITE16_HANDLER ( compis_usart_w ) |
| 494 | 494 | { |
| 495 | running_device *uart = | |
| 495 | running_device *uart = | |
| 496 | 496 | switch (offset) |
| 497 | 497 | { |
| 498 | 498 | case 0x00: |
| r8453 | r8454 | |
| 653 | 653 | case 0x0d: i186.intr.in_service &= ~0x20; break; |
| 654 | 654 | case 0x0e: i186.intr.in_service &= ~0x40; break; |
| 655 | 655 | case 0x0f: i186.intr.in_service &= ~0x80; break; |
| 656 | default: logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", cpu_get_pc( | |
| 656 | default: logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", cpu_get_pc(m | |
| 657 | 657 | } |
| 658 | 658 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", attotime_to_double(timer_get_time(machine)), data & 0x1f); |
| 659 | 659 | } |
| r8453 | r8454 | |
| 825 | 825 | diff = new_control ^ t->control; |
| 826 | 826 | if (diff & 0x001c) |
| 827 | 827 | logerror("%05X:ERROR! -unsupported timer mode %04X\n", |
| 828 | cpu_get_pc( | |
| 828 | cpu_get_pc(m | |
| 829 | 829 | |
| 830 | 830 | /* if we have real changes, update things */ |
| 831 | 831 | if (diff != 0) |
| r8453 | r8454 | |
| 926 | 926 | diff = new_control ^ d->control; |
| 927 | 927 | if (diff & 0x6811) |
| 928 | 928 | logerror("%05X:ERROR! - unsupported DMA mode %04X\n", |
| 929 | cpu_get_pc( | |
| 929 | cpu_get_pc(m | |
| 930 | 930 | |
| 931 | 931 | /* if we're going live, set a timer */ |
| 932 | 932 | if ((diff & 0x0002) && (new_control & 0x0002)) |
| r8453 | r8454 | |
| 987 | 987 | case 0x12: |
| 988 | 988 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll\n", cpu_get_pc(space->cpu)); |
| 989 | 989 | if (i186.intr.poll_status & 0x8000) |
| 990 | int_callback( | |
| 990 | int_callback( | |
| 991 | 991 | return i186.intr.poll_status; |
| 992 | 992 | |
| 993 | 993 | case 0x13: |
| r8453 | r8454 | |
| 1461 | 1461 | DRIVER_INIT( compis ) |
| 1462 | 1462 | { |
| 1463 | 1463 | compis_init( &i82720_interface ); |
| 1464 | cpu_set_irq_callback( | |
| 1464 | cpu_set_irq_callback(m | |
| 1465 | 1465 | memset (&compis, 0, sizeof (compis) ); |
| 1466 | 1466 | } |
| 1467 | 1467 | |
| r8453 | r8454 | |
| 1483 | 1483 | compis_keyb_init(); |
| 1484 | 1484 | |
| 1485 | 1485 | /* OSP PIC 8259 */ |
| 1486 | cpu_set_irq_callback( | |
| 1486 | cpu_set_irq_callback(m | |
| 1487 | 1487 | |
| 1488 | compis_devices.pic8259_master = devtag_get_device(machine, "pic8259_master"); | |
| 1489 | compis_devices.pic8259_slave = devtag_get_device(machine, "pic8259_slave"); | |
| 1488 | compis_devices.pic8259_master = machine->device("pic8259_master"); | |
| 1489 | compis_devices.pic8259_slave = machine->device("pic8259_slave"); | |
| 1490 | 1490 | } |
| 1491 | 1491 | |
| 1492 | 1492 | /*-------------------------------------------------------------------------*/ |
| r8453 | r8454 | |
|---|---|---|
| 197 | 197 | |
| 198 | 198 | static running_device *vtech2_cassette_image(running_machine *machine) |
| 199 | 199 | { |
| 200 | return | |
| 200 | return m | |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /************************************************* |
| r8453 | r8454 | |
| 302 | 302 | ************************************************/ |
| 303 | 303 | static void mwa_bank(running_machine *machine, int bank, int offs, int data) |
| 304 | 304 | { |
| 305 | running_device *speaker = | |
| 305 | running_device *speaker = m | |
| 306 | 306 | offs += 0x4000 * laser_bank[bank]; |
| 307 | 307 | switch (laser_bank[bank]) |
| 308 | 308 | { |
| r8453 | r8454 | |
| 363 | 363 | |
| 364 | 364 | static running_device *laser_file(running_machine *machine) |
| 365 | 365 | { |
| 366 | return | |
| 366 | return m | |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | static void laser_get_track(running_machine *machine) |
| r8453 | r8454 | |
|---|---|---|
| 1181 | 1181 | /* Only one harddisk supported right now */ |
| 1182 | 1182 | assert ( id == 0 ); |
| 1183 | 1183 | |
| 1184 | img = dynamic_cast<device_image_interface *>( | |
| 1184 | img = dynamic_cast<device_image_interface *>(m | |
| 1185 | 1185 | |
| 1186 | 1186 | if ( !img ) |
| 1187 | 1187 | return NULL; |
| r8453 | r8454 | |
|---|---|---|
| 724 | 724 | c1551->bit_timer = timer_alloc(device->machine, bit_tick, (void *)device); |
| 725 | 725 | |
| 726 | 726 | /* map TPI1 to host CPU memory space */ |
| 727 | const address_space *program = cpu_get_address_space(dev | |
| 727 | const address_space *program = cpu_get_address_space(dev | |
| 728 | 728 | UINT32 start_address = c1551->address ? 0xfec0 : 0xfef0; |
| 729 | 729 | |
| 730 | 730 | memory_install_readwrite8_device_handler(program, c1551->tpi1, start_address, start_address + 7, 0, 0, tpi6525_r, tpi6525_w); |
| r8453 | r8454 | |
|---|---|---|
| 211 | 211 | |
| 212 | 212 | static void wswan_machine_stop( running_machine &machine ) |
| 213 | 213 | { |
| 214 | device_image_interface *image = dynamic_cast<device_image_interface *>( | |
| 214 | device_image_interface *image = dynamic_cast<device_image_interface *>(m | |
| 215 | 215 | if ( eeprom.size ) |
| 216 | 216 | { |
| 217 | 217 | image->battery_save(eeprom.data, eeprom.size ); |
| r8453 | r8454 | |
|---|---|---|
| 52 | 52 | { |
| 53 | 53 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 54 | 54 | |
| 55 | memory_install_read_bank(space, 0x4000, 0x4000 + messram_get_size(devtag_get_device(machine, "messram")) - 1, 0, 0, "bank1"); | |
| 56 | memory_install_write8_handler(space, 0x4000, 0x4000 + messram_get_size(devtag_get_device(machine, "messram")) - 1, 0, 0, zx_ram_w); | |
| 55 | memory_install_read_bank(space, 0x4000, 0x4000 + messram_get_size(machine->device("messram")) - 1, 0, 0, "bank1"); | |
| 56 | memory_install_write8_handler(space, 0x4000, 0x4000 + messram_get_size(machine->device("messram")) - 1, 0, 0, zx_ram_w); | |
| 57 | 57 | memory_set_bankptr(machine, "bank1", memory_region(machine, "maincpu") + 0x4000); |
| 58 | 58 | } |
| 59 | 59 | |
| r8453 | r8454 | |
| 133 | 133 | if (!input_port_read(space->machine, "CONFIG")) |
| 134 | 134 | data &= ~0x40; |
| 135 | 135 | |
| 136 | cassette_output( | |
| 136 | cassette_output( | |
| 137 | 137 | |
| 138 | 138 | if (ula_irq_active) |
| 139 | 139 | { |
| r8453 | r8454 | |
| 144 | 144 | } |
| 145 | 145 | // else |
| 146 | 146 | // { |
| 147 | if ((cassette_input( | |
| 147 | if ((cassette_input( | |
| 148 | 148 | { |
| 149 | 149 | zx_tape_bit = 0x00; |
| 150 | 150 | timer_set(space->machine, ATTOTIME_IN_USEC(362), NULL, 0, zx_tape_pulse); |
| r8453 | r8454 | |
| 197 | 197 | if (!input_port_read(space->machine, "CONFIG")) |
| 198 | 198 | data &= ~0x40; |
| 199 | 199 | |
| 200 | cassette_output( | |
| 200 | cassette_output( | |
| 201 | 201 | |
| 202 | 202 | if (ula_irq_active) |
| 203 | 203 | { |
| r8453 | r8454 | |
| 208 | 208 | } |
| 209 | 209 | else |
| 210 | 210 | { |
| 211 | if ((cassette_input( | |
| 211 | if ((cassette_input( | |
| 212 | 212 | { |
| 213 | 213 | zx_tape_bit = 0x00; |
| 214 | 214 | timer_set(space->machine, ATTOTIME_IN_USEC(362), NULL, 0, zx_tape_pulse); |
| r8453 | r8454 | |
| 242 | 242 | UINT8 data = 0xff; |
| 243 | 243 | UINT8 offs = offset & 0xff; |
| 244 | 244 | static UINT8 speaker_state = 0; |
| 245 | running_device *speaker = | |
| 245 | running_device *speaker = | |
| 246 | 246 | |
| 247 | 247 | if (offs == 0xf5) |
| 248 | 248 | { |
| r8453 | r8454 | |
| 269 | 269 | if ((offset & 0x8000) == 0) |
| 270 | 270 | data &= input_port_read(space->machine, "ROW7"); |
| 271 | 271 | |
| 272 | cassette_output( | |
| 272 | cassette_output( | |
| 273 | 273 | |
| 274 | 274 | if (ula_irq_active) |
| 275 | 275 | { |
| r8453 | r8454 | |
| 280 | 280 | } |
| 281 | 281 | else |
| 282 | 282 | { |
| 283 | if ((cassette_input( | |
| 283 | if ((cassette_input( | |
| 284 | 284 | { |
| 285 | 285 | zx_tape_bit = 0x00; |
| 286 | 286 | timer_set(space->machine, ATTOTIME_IN_USEC(362), NULL, 0, zx_tape_pulse); |
| r8453 | r8454 | |
| 314 | 314 | UINT8 data = 0xff; |
| 315 | 315 | UINT8 offs = offset & 0xff; |
| 316 | 316 | static UINT8 speaker_state = 0; |
| 317 | running_device *speaker = | |
| 317 | running_device *speaker = | |
| 318 | 318 | |
| 319 | 319 | if (offs == 0x7e) |
| 320 | 320 | { |
| r8453 | r8454 | |
| 346 | 346 | if ((offset & 0x8000) == 0) |
| 347 | 347 | data &= input_port_read(space->machine, "ROW7"); |
| 348 | 348 | |
| 349 | cassette_output( | |
| 349 | cassette_output( | |
| 350 | 350 | |
| 351 | 351 | if (ula_irq_active) |
| 352 | 352 | { |
| r8453 | r8454 | |
| 356 | 356 | } |
| 357 | 357 | else |
| 358 | 358 | { |
| 359 | if ((cassette_input( | |
| 359 | if ((cassette_input( | |
| 360 | 360 | { |
| 361 | 361 | zx_tape_bit = 0x00; |
| 362 | 362 | timer_set(space->machine, ATTOTIME_IN_USEC(362), NULL, 0, zx_tape_pulse); |
| r8453 | r8454 | |
| 385 | 385 | UINT8 offs = offset & 0xff; |
| 386 | 386 | |
| 387 | 387 | if (offs == 0xff) |
| 388 | cassette_output( | |
| 388 | cassette_output( | |
| 389 | 389 | else |
| 390 | 390 | LOG_ZX81_IOR("Unmapped port"); |
| 391 | 391 | } |
| r8453 | r8454 | |
| 422 | 422 | else |
| 423 | 423 | if (offs == 0xff) |
| 424 | 424 | { |
| 425 | cassette_output( | |
| 425 | cassette_output( | |
| 426 | 426 | zx_ula_bkgnd(space->machine, 1); |
| 427 | 427 | if (ula_frame_vsync == 2) |
| 428 | 428 | { |
| r8453 | r8454 | |
|---|---|---|
| 76 | 76 | static running_device *cassette_device_image(running_machine *machine) |
| 77 | 77 | { |
| 78 | 78 | if (lx385_ctrl & 0x08) |
| 79 | return | |
| 79 | return m | |
| 80 | 80 | else |
| 81 | return | |
| 81 | return m | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | static TIMER_CALLBACK(z80ne_cassette_tc) |
| r8453 | r8454 | |
| 239 | 239 | |
| 240 | 240 | static void reset_lx388(running_machine *machine) |
| 241 | 241 | { |
| 242 | lx388_kr2376 = | |
| 242 | lx388_kr2376 = m | |
| 243 | 243 | kr2376_set_input_pin( lx388_kr2376, KR2376_DSII, 0); |
| 244 | 244 | kr2376_set_input_pin( lx388_kr2376, KR2376_PII, 0); |
| 245 | 245 | } |
| r8453 | r8454 | |
| 356 | 356 | cass_data.input.length = 0; |
| 357 | 357 | cass_data.input.bit = 1; |
| 358 | 358 | |
| 359 | z80ne_ay31015 = | |
| 359 | z80ne_ay31015 = m | |
| 360 | 360 | ay31015_set_input_pin( z80ne_ay31015, AY31015_CS, 0 ); |
| 361 | 361 | ay31015_set_input_pin( z80ne_ay31015, AY31015_NB1, 1 ); |
| 362 | 362 | ay31015_set_input_pin( z80ne_ay31015, AY31015_NB2, 1 ); |
| r8453 | r8454 | |
| 630 | 630 | /* motors */ |
| 631 | 631 | if(changed_bits & 0x18) |
| 632 | 632 | { |
| 633 | cassette_change_state( | |
| 633 | cassette_change_state( | |
| 634 | 634 | (motor_a) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); |
| 635 | 635 | |
| 636 | cassette_change_state( | |
| 636 | cassette_change_state( | |
| 637 | 637 | (motor_b) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); |
| 638 | 638 | |
| 639 | 639 | if (motor_a || motor_b) |
| r8453 | r8454 | |
| 657 | 657 | |
| 658 | 658 | VIDEO_UPDATE( lx388 ) |
| 659 | 659 | { |
| 660 | running_device *mc6847 = | |
| 660 | running_device *mc6847 = | |
| 661 | 661 | return mc6847_update(mc6847, bitmap, cliprect); |
| 662 | 662 | } |
| 663 | 663 | |
| r8453 | r8454 | |
| 672 | 672 | |
| 673 | 673 | READ8_HANDLER( lx388_read_field_sync ) |
| 674 | 674 | { |
| 675 | running_device *mc6847 = | |
| 675 | running_device *mc6847 = | |
| 676 | 676 | return mc6847_fs_r(mc6847) << 7; |
| 677 | 677 | } |
| 678 | 678 | |
| r8453 | r8454 | |
| 737 | 737 | offs_t pc; |
| 738 | 738 | |
| 739 | 739 | /* if PC is not in range, we are under integrated debugger control, DON'T SWAP */ |
| 740 | pc = cpu_get_pc(dev | |
| 740 | pc = cpu_get_pc(dev | |
| 741 | 741 | if((pc >= 0xf000) && (pc <=0xffff)) |
| 742 | 742 | { |
| 743 | 743 | LOG(("lx390_reset_bank, reset memory bank 1\n")); |
| r8453 | r8454 | |
|---|---|---|
| 115 | 115 | /* currently enough to save the external ram */ |
| 116 | 116 | NVRAM_HANDLER( pc1401 ) |
| 117 | 117 | { |
| 118 | running_device *main_cpu = | |
| 118 | running_device *main_cpu = m | |
| 119 | 119 | UINT8 *ram = memory_region(machine, "maincpu")+0x2000; |
| 120 | 120 | UINT8 *cpu = sc61860_internal_ram(main_cpu); |
| 121 | 121 |
| r8453 | r8454 | |
|---|---|---|
| 829 | 829 | |
| 830 | 830 | /* call Apple II interrupt handler */ |
| 831 | 831 | if ((machine->primary_screen->vpos() % 8) == 7) |
| 832 | apple2_interrupt( | |
| 832 | apple2_interrupt(m | |
| 833 | 833 | } |
| 834 | 834 | |
| 835 | 835 | timer_adjust_oneshot(apple2gs_scanline_timer, machine->primary_screen->time_until_pos((scanline+1)%262, 0), 0); |
| r8453 | r8454 | |
| 862 | 862 | } |
| 863 | 863 | else |
| 864 | 864 | { |
| 865 | running_device *es5503 = | |
| 865 | running_device *es5503 = | |
| 866 | 866 | sndglu_dummy_read = es5503_r(es5503, sndglu_addr); |
| 867 | 867 | } |
| 868 | 868 | |
| r8453 | r8454 | |
| 902 | 902 | } |
| 903 | 903 | else |
| 904 | 904 | { |
| 905 | running_device *es5503 = | |
| 905 | running_device *es5503 = | |
| 906 | 906 | es5503_w(es5503, sndglu_addr, data); |
| 907 | 907 | } |
| 908 | 908 | |
| r8453 | r8454 | |
| 1044 | 1044 | case 0x39: /* C039 - SCCAREG */ |
| 1045 | 1045 | case 0x3A: /* C03A - SCCBDATA */ |
| 1046 | 1046 | case 0x3B: /* C03B - SCCADATA */ |
| 1047 | scc = | |
| 1047 | scc = | |
| 1048 | 1048 | result = scc8530_r(scc, offset & 0x03); |
| 1049 | 1049 | break; |
| 1050 | 1050 | |
| r8453 | r8454 | |
| 1184 | 1184 | case 0x39: /* C039 - SCCAREG */ |
| 1185 | 1185 | case 0x3A: /* C03A - SCCBDATA */ |
| 1186 | 1186 | case 0x3B: /* C03B - SCCADATA */ |
| 1187 | scc = | |
| 1187 | scc = | |
| 1188 | 1188 | scc8530_w(scc, offset & 0x03, data); |
| 1189 | 1189 | break; |
| 1190 | 1190 | |
| r8453 | r8454 | |
| 1236 | 1236 | static WRITE8_HANDLER( apple2gs_main0400_w ) |
| 1237 | 1237 | { |
| 1238 | 1238 | offset += 0x000400; |
| 1239 | messram_get_ptr( | |
| 1239 | messram_get_ptr( | |
| 1240 | 1240 | |
| 1241 | 1241 | if (!(apple2gs_shadow & 0x01)) |
| 1242 | 1242 | { |
| r8453 | r8454 | |
| 1247 | 1247 | static WRITE8_HANDLER( apple2gs_aux0400_w ) |
| 1248 | 1248 | { |
| 1249 | 1249 | offset += 0x010400; |
| 1250 | messram_get_ptr( | |
| 1250 | messram_get_ptr( | |
| 1251 | 1251 | |
| 1252 | 1252 | if (!(apple2gs_shadow & 0x01)) |
| 1253 | 1253 | { |
| r8453 | r8454 | |
| 1258 | 1258 | static WRITE8_HANDLER( apple2gs_main2000_w ) |
| 1259 | 1259 | { |
| 1260 | 1260 | offset += 0x002000; |
| 1261 | messram_get_ptr( | |
| 1261 | messram_get_ptr( | |
| 1262 | 1262 | |
| 1263 | 1263 | if (!(apple2gs_shadow & 0x02)) |
| 1264 | 1264 | { |
| r8453 | r8454 | |
| 1269 | 1269 | static WRITE8_HANDLER( apple2gs_aux2000_w ) |
| 1270 | 1270 | { |
| 1271 | 1271 | offset += 0x012000; |
| 1272 | messram_get_ptr( | |
| 1272 | messram_get_ptr( | |
| 1273 | 1273 | |
| 1274 | 1274 | if (!(apple2gs_shadow & 0x12) || !(apple2gs_shadow & 0x08)) |
| 1275 | 1275 | { |
| r8453 | r8454 | |
| 1280 | 1280 | static WRITE8_HANDLER( apple2gs_main4000_w ) |
| 1281 | 1281 | { |
| 1282 | 1282 | offset += 0x004000; |
| 1283 | messram_get_ptr( | |
| 1283 | messram_get_ptr( | |
| 1284 | 1284 | |
| 1285 | 1285 | if ((offset >= 0x004000) && (offset <= 0x005FFF)) |
| 1286 | 1286 | { |
| r8453 | r8454 | |
| 1292 | 1292 | static WRITE8_HANDLER( apple2gs_aux4000_w ) |
| 1293 | 1293 | { |
| 1294 | 1294 | offset += 0x014000; |
| 1295 | messram_get_ptr( | |
| 1295 | messram_get_ptr( | |
| 1296 | 1296 | |
| 1297 | 1297 | if ((offset >= 0x014000) && (offset <= 0x015FFF)) |
| 1298 | 1298 | { |
| r8453 | r8454 | |
| 1535 | 1535 | |
| 1536 | 1536 | if ((apple2gs_shadow & 0x40) && ((address & 0xF00000) == 0x000000)) |
| 1537 | 1537 | { |
| 1538 | result = messram_get_ptr( | |
| 1538 | result = messram_get_ptr(m | |
| 1539 | 1539 | } |
| 1540 | 1540 | else if ((address & 0x000F00) == 0x000000) |
| 1541 | 1541 | { |
| r8453 | r8454 | |
| 1561 | 1561 | |
| 1562 | 1562 | if ((apple2gs_shadow & 0x40) && ((address & 0xF00000) == 0x000000)) |
| 1563 | 1563 | { |
| 1564 | messram_get_ptr( | |
| 1564 | messram_get_ptr(m | |
| 1565 | 1565 | } |
| 1566 | 1566 | else if ((address & 0x000F00) == 0x000000) |
| 1567 | 1567 | { |
| r8453 | r8454 | |
| 1587 | 1587 | { |
| 1588 | 1588 | if ((apple2gs_shadow & 0x40) && ((address & 0xF00000) == 0x000000)) |
| 1589 | 1589 | { |
| 1590 | opptr = &messram_get_ptr( | |
| 1590 | opptr = &messram_get_ptr( | |
| 1591 | 1591 | } |
| 1592 | 1592 | else if ((address & 0x000F00) == 0x000000) |
| 1593 | 1593 | { |
| r8453 | r8454 | |
| 1664 | 1664 | state_save_register_item_array(machine, "APPLE2GS_SLOWMEM", NULL, 0, apple2gs_slowmem); |
| 1665 | 1665 | |
| 1666 | 1666 | /* install expanded memory */ |
| 1667 | memory_install_readwrite_bank(space, 0x010000, messram_get_size(devtag_get_device(machine, "messram")) - 1, 0, 0, "bank1"); | |
| 1668 | memory_set_bankptr(machine,"bank1", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x010000); | |
| 1667 | memory_install_readwrite_bank(space, 0x010000, messram_get_size(machine->device("messram")) - 1, 0, 0, "bank1"); | |
| 1668 | memory_set_bankptr(machine,"bank1", messram_get_ptr(machine->device("messram")) + 0x010000); | |
| 1669 | 1669 | |
| 1670 | 1670 | /* install hi memory */ |
| 1671 | 1671 | memory_install_read_bank(space, 0xe00000, 0xe1ffff, 0, 0, "bank2"); |
| r8453 | r8454 | |
| 1729 | 1729 | apple2_init_common(machine); |
| 1730 | 1730 | |
| 1731 | 1731 | /* set up Apple IIgs vectoring */ |
| 1732 | g65816_set_read_vector_callback( | |
| 1732 | g65816_set_read_vector_callback(m | |
| 1733 | 1733 | |
| 1734 | 1734 | /* setup globals */ |
| 1735 | 1735 | apple2gs_cur_slot6_image = NULL; |
| r8453 | r8454 | |
| 1778 | 1778 | apple2gs_setup_memory(machine); |
| 1779 | 1779 | |
| 1780 | 1780 | /* save state stuff. note that the driver takes care of docram. */ |
| 1781 | state_save_register_global_array(machine, messram_get_ptr( | |
| 1781 | state_save_register_global_array(machine, messram_get_ptr(m | |
| 1782 | 1782 | |
| 1783 | 1783 | state_save_register_item(machine, "NEWVIDEO", NULL, 0, apple2gs_newvideo); |
| 1784 | 1784 |
| r8453 | r8454 | |
|---|---|---|
| 347 | 347 | is_rom = TRUE; |
| 348 | 348 | |
| 349 | 349 | /* HACK! - copy in the initial reset/stack */ |
| 350 | memcpy(messram_get_ptr( | |
| 350 | memcpy(messram_get_ptr(m | |
| 351 | 351 | } |
| 352 | 352 | else |
| 353 | 353 | { |
| 354 | 354 | /* RAM */ |
| 355 | memory_size = messram_get_size(devtag_get_device(machine, "messram")); | |
| 356 | memory_data = messram_get_ptr(devtag_get_device(machine, "messram")); | |
| 355 | memory_size = messram_get_size(machine->device("messram")); | |
| 356 | memory_data = messram_get_ptr(machine->device("messram")); | |
| 357 | 357 | is_rom = FALSE; |
| 358 | 358 | } |
| 359 | 359 | |
| r8453 | r8454 | |
| 561 | 561 | static TIMER_CALLBACK(kbd_clock) |
| 562 | 562 | { |
| 563 | 563 | int i; |
| 564 | running_device *via_0 = | |
| 564 | running_device *via_0 = m | |
| 565 | 565 | mac_state *mac = (mac_state *)machine->driver_data; |
| 566 | 566 | |
| 567 | 567 | if (mac->kbd_comm == TRUE) |
| r8453 | r8454 | |
| 951 | 951 | |
| 952 | 952 | void mac_scc_mouse_irq(running_machine *machine, int x, int y) |
| 953 | 953 | { |
| 954 | running_device *scc = | |
| 954 | running_device *scc = m | |
| 955 | 955 | static int last_was_x = 0; |
| 956 | 956 | if (x && y) |
| 957 | 957 | { |
| r8453 | r8454 | |
| 978 | 978 | |
| 979 | 979 | READ16_HANDLER ( mac_scc_r ) |
| 980 | 980 | { |
| 981 | running_device *scc = | |
| 981 | running_device *scc = | |
| 982 | 982 | UINT16 result; |
| 983 | 983 | |
| 984 | 984 | result = scc8530_r(scc, offset); |
| r8453 | r8454 | |
| 989 | 989 | |
| 990 | 990 | WRITE16_HANDLER ( mac_scc_w ) |
| 991 | 991 | { |
| 992 | running_device *scc = | |
| 992 | running_device *scc = | |
| 993 | 993 | scc8530_w(scc, offset, (UINT8) data); |
| 994 | 994 | } |
| 995 | 995 | |
| 996 | 996 | WRITE16_HANDLER ( mac_scc_2_w ) |
| 997 | 997 | { |
| 998 | running_device *scc = | |
| 998 | running_device *scc = | |
| 999 | 999 | UINT8 wdata = data>>8; |
| 1000 | 1000 | scc8530_w(scc, offset, wdata); |
| 1001 | 1001 | } |
| r8453 | r8454 | |
| 1352 | 1352 | */ |
| 1353 | 1353 | |
| 1354 | 1354 | UINT16 result = 0; |
| 1355 | running_device *fdc = | |
| 1355 | running_device *fdc = | |
| 1356 | 1356 | |
| 1357 | 1357 | if (LOG_MAC_IWM) |
| 1358 | 1358 | logerror("mac_iwm_r: offset=0x%08x mem_mask %04x (PC %x)\n", offset, mem_mask, cpu_get_pc(space->cpu)); |
| r8453 | r8454 | |
| 1363 | 1363 | |
| 1364 | 1364 | WRITE16_HANDLER ( mac_iwm_w ) |
| 1365 | 1365 | { |
| 1366 | running_device *fdc = | |
| 1366 | running_device *fdc = | |
| 1367 | 1367 | |
| 1368 | 1368 | if (LOG_MAC_IWM) |
| 1369 | 1369 | logerror("mac_iwm_w: offset=0x%08x data=0x%04x mask %04x (PC=%x)\n", offset, data, mem_mask, cpu_get_pc(space->cpu)); |
| r8453 | r8454 | |
| 1774 | 1774 | |
| 1775 | 1775 | static TIMER_CALLBACK(mac_adb_tick) |
| 1776 | 1776 | { |
| 1777 | running_device *via_0 = | |
| 1777 | running_device *via_0 = m | |
| 1778 | 1778 | mac_state *mac = (mac_state *)machine->driver_data; |
| 1779 | 1779 | |
| 1780 | 1780 | // do one clock transition on CB1 to advance the VIA shifter |
| r8453 | r8454 | |
| 2308 | 2308 | { |
| 2309 | 2309 | mac_state *mac = (mac_state *)device->machine->driver_data; |
| 2310 | 2310 | |
| 2311 | // printf("VIA1 IN_A (PC %x)\n", cpu_get_pc(dev | |
| 2311 | // printf("VIA1 IN_A (PC %x)\n", cpu_get_pc(dev | |
| 2312 | 2312 | |
| 2313 | 2313 | switch (mac->mac_model) |
| 2314 | 2314 | { |
| r8453 | r8454 | |
| 2395 | 2395 | val |= 1; |
| 2396 | 2396 | } |
| 2397 | 2397 | |
| 2398 | // printf("VIA1 IN_B = %02x (PC %x)\n", val, cpu_get_pc(dev | |
| 2398 | // printf("VIA1 IN_B = %02x (PC %x)\n", val, cpu_get_pc(dev | |
| 2399 | 2399 | |
| 2400 | 2400 | return val; |
| 2401 | 2401 | } |
| 2402 | 2402 | |
| 2403 | 2403 | static WRITE8_DEVICE_HANDLER(mac_via_out_a) |
| 2404 | 2404 | { |
| 2405 | running_device *sound = devtag_get_device(device->machine, "custom"); | |
| 2406 | running_device *fdc = devtag_get_device(device->machine, "fdc"); | |
| 2405 | running_device *sound = device->machine->device("custom"); | |
| 2406 | running_device *fdc = device->machine->device("fdc"); | |
| 2407 | 2407 | mac_state *mac = (mac_state *)device->machine->driver_data; |
| 2408 | 2408 | |
| 2409 | // printf("VIA1 OUT A: %02x (PC %x)\n", data, cpu_get_pc(dev | |
| 2409 | // printf("VIA1 OUT A: %02x (PC %x)\n", data, cpu_get_pc(dev | |
| 2410 | 2410 | |
| 2411 | 2411 | if (mac->mac_model >= MODEL_MAC_PORTABLE && mac->mac_model <= MODEL_MAC_PB100) |
| 2412 | 2412 | { |
| r8453 | r8454 | |
| 2442 | 2442 | |
| 2443 | 2443 | static WRITE8_DEVICE_HANDLER(mac_via_out_b) |
| 2444 | 2444 | { |
| 2445 | running_device *sound = dev | |
| 2445 | running_device *sound = dev | |
| 2446 | 2446 | int new_rtc_rTCClk; |
| 2447 | 2447 | mac_state *mac = (mac_state *)device->machine->driver_data; |
| 2448 | 2448 | |
| 2449 | // printf("VIA1 OUT B: %02x (PC %x)\n", data, cpu_get_pc(dev | |
| 2449 | // printf("VIA1 OUT B: %02x (PC %x)\n", data, cpu_get_pc(dev | |
| 2450 | 2450 | |
| 2451 | 2451 | if (mac->mac_model >= MODEL_MAC_PORTABLE && mac->mac_model <= MODEL_MAC_PB100) |
| 2452 | 2452 | { |
| 2453 | running_device *fdc = dev | |
| 2453 | running_device *fdc = dev | |
| 2454 | 2454 | |
| 2455 | 2455 | mac_enable_sound(sound, (data & 0x80) == 0); |
| 2456 | 2456 | sony_set_sel_line(fdc,(data & 0x20) >> 5); |
| r8453 | r8454 | |
| 2509 | 2509 | READ16_HANDLER ( mac_via_r ) |
| 2510 | 2510 | { |
| 2511 | 2511 | UINT16 data; |
| 2512 | running_device *via_0 = | |
| 2512 | running_device *via_0 = | |
| 2513 | 2513 | |
| 2514 | 2514 | offset >>= 8; |
| 2515 | 2515 | offset &= 0x0f; |
| r8453 | r8454 | |
| 2523 | 2523 | |
| 2524 | 2524 | WRITE16_HANDLER ( mac_via_w ) |
| 2525 | 2525 | { |
| 2526 | running_device *via_0 = | |
| 2526 | running_device *via_0 = | |
| 2527 | 2527 | |
| 2528 | 2528 | offset >>= 8; |
| 2529 | 2529 | offset &= 0x0f; |
| r8453 | r8454 | |
| 2547 | 2547 | READ16_HANDLER ( mac_via2_r ) |
| 2548 | 2548 | { |
| 2549 | 2549 | int data; |
| 2550 | running_device *via_1 = | |
| 2550 | running_device *via_1 = | |
| 2551 | 2551 | |
| 2552 | 2552 | offset >>= 8; |
| 2553 | 2553 | offset &= 0x0f; |
| r8453 | r8454 | |
| 2561 | 2561 | |
| 2562 | 2562 | WRITE16_HANDLER ( mac_via2_w ) |
| 2563 | 2563 | { |
| 2564 | running_device *via_1 = | |
| 2564 | running_device *via_1 = | |
| 2565 | 2565 | |
| 2566 | 2566 | offset >>= 8; |
| 2567 | 2567 | offset &= 0x0f; |
| r8453 | r8454 | |
| 2593 | 2593 | { |
| 2594 | 2594 | mac_state *mac =(mac_state *)device->machine->driver_data; |
| 2595 | 2595 | |
| 2596 | // logerror("VIA2 IN B (PC %x)\n", cpu_get_pc(dev | |
| 2596 | // logerror("VIA2 IN B (PC %x)\n", cpu_get_pc(dev | |
| 2597 | 2597 | |
| 2598 | 2598 | if ((mac->mac_model == MODEL_MAC_LC) || (mac->mac_model == MODEL_MAC_LC_II)) |
| 2599 | 2599 | { |
| r8453 | r8454 | |
| 2610 | 2610 | |
| 2611 | 2611 | static WRITE8_DEVICE_HANDLER(mac_via2_out_a) |
| 2612 | 2612 | { |
| 2613 | // logerror("VIA2 OUT A: %02x (PC %x)\n", data, cpu_get_pc(dev | |
| 2613 | // logerror("VIA2 OUT A: %02x (PC %x)\n", data, cpu_get_pc(dev | |
| 2614 | 2614 | } |
| 2615 | 2615 | |
| 2616 | 2616 | static WRITE8_DEVICE_HANDLER(mac_via2_out_b) |
| 2617 | 2617 | { |
| 2618 | running_device *via_0 = dev | |
| 2618 | running_device *via_0 = dev | |
| 2619 | 2619 | |
| 2620 | // logerror("VIA2 OUT B: %02x (PC %x)\n", data, cpu_get_pc(dev | |
| 2620 | // logerror("VIA2 OUT B: %02x (PC %x)\n", data, cpu_get_pc(dev | |
| 2621 | 2621 | |
| 2622 | 2622 | // printf("VIA2 OUT B: %02x (MMU = %02x)\n", data, data & 0x08); |
| 2623 | 2623 | |
| r8453 | r8454 | |
| 2668 | 2668 | /* setup sound */ |
| 2669 | 2669 | if (mac->mac_model < MODEL_MAC_II) |
| 2670 | 2670 | { |
| 2671 | mac_set_sound_buffer( | |
| 2671 | mac_set_sound_buffer(m | |
| 2672 | 2672 | } |
| 2673 | 2673 | |
| 2674 | 2674 | if (has_adb(mac)) |
| r8453 | r8454 | |
| 2678 | 2678 | |
| 2679 | 2679 | if ((mac->mac_model == MODEL_MAC_SE) || (mac->mac_model == MODEL_MAC_CLASSIC)) |
| 2680 | 2680 | { |
| 2681 | mac_set_sound_buffer( | |
| 2681 | mac_set_sound_buffer(m | |
| 2682 | 2682 | |
| 2683 | 2683 | // classic will fail RAM test and try to boot appletalk if RAM is not all zero |
| 2684 | memset(messram_get_ptr( | |
| 2684 | memset(messram_get_ptr(m | |
| 2685 | 2685 | } |
| 2686 | 2686 | |
| 2687 | 2687 | scsi_interrupt = 0; |
| r8453 | r8454 | |
| 2762 | 2762 | else if (model < MODEL_MAC_II) |
| 2763 | 2763 | { |
| 2764 | 2764 | /* set up RAM mirror at 0x600000-0x6fffff (0x7fffff ???) */ |
| 2765 | mac_install_memory(machine, 0x600000, 0x6fffff, messram_get_size( | |
| 2765 | mac_install_memory(machine, 0x600000, 0x6fffff, messram_get_size(m | |
| 2766 | 2766 | |
| 2767 | 2767 | /* set up ROM at 0x400000-0x43ffff (-0x5fffff for mac 128k/512k/512ke) */ |
| 2768 | 2768 | mac_install_memory(machine, 0x400000, (model >= MODEL_MAC_PLUS) ? 0x43ffff : 0x5fffff, |
| r8453 | r8454 | |
| 2770 | 2770 | } |
| 2771 | 2771 | else if ((model == MODEL_MAC_LC) || (model == MODEL_MAC_LC_II) || (model == MODEL_MAC_LC_III)) |
| 2772 | 2772 | { |
| 2773 | mac_install_memory(machine, 0x000000, messram_get_size( | |
| 2773 | mac_install_memory(machine, 0x000000, messram_get_size(m | |
| 2774 | 2774 | } |
| 2775 | 2775 | else if ((mac->mac_model == MODEL_MAC_CLASSIC_II) || ((mac->mac_model >= MODEL_MAC_II) && (mac->mac_model <= MODEL_MAC_SE30))) |
| 2776 | 2776 | { |
| 2777 | mac_install_memory(machine, 0x00000000, 0x3fffffff, messram_get_size( | |
| 2777 | mac_install_memory(machine, 0x00000000, 0x3fffffff, messram_get_size(m | |
| 2778 | 2778 | } |
| 2779 | 2779 | |
| 2780 | 2780 | set_memory_overlay(machine, 1); |
| 2781 | 2781 | mac->mac_overlay = 1; |
| 2782 | 2782 | |
| 2783 | memset(messram_get_ptr( | |
| 2783 | memset(messram_get_ptr(m | |
| 2784 | 2784 | |
| 2785 | 2785 | if ((model == MODEL_MAC_SE) || (model == MODEL_MAC_CLASSIC) || (model == MODEL_MAC_CLASSIC_II) || (model == MODEL_MAC_LC) || |
| 2786 | 2786 | (model == MODEL_MAC_LC_II) || (model == MODEL_MAC_LC_III) || ((mac->mac_model >= MODEL_MAC_II) && (mac->mac_model <= MODEL_MAC_SE30)) || |
| r8453 | r8454 | |
| 2965 | 2965 | |
| 2966 | 2966 | if ((mac->mac_nubus_irq_state & 0x3f) != 0x3f) |
| 2967 | 2967 | { |
| 2968 | running_device *via_1 = | |
| 2968 | running_device *via_1 = m | |
| 2969 | 2969 | |
| 2970 | 2970 | mac->via2_ca1 ^= 1; |
| 2971 | 2971 | via_ca1_w(via_1, mac->via2_ca1); |
| r8453 | r8454 | |
| 2975 | 2975 | static void mac_vblank_irq(running_machine *machine) |
| 2976 | 2976 | { |
| 2977 | 2977 | static int irq_count = 0, ca1_data = 0, ca2_data = 0; |
| 2978 | running_device *via_0 = | |
| 2978 | running_device *via_0 = m | |
| 2979 | 2979 | mac_state *mac = (mac_state *)machine->driver_data; |
| 2980 | 2980 | |
| 2981 | 2981 | /* handle ADB keyboard/mouse */ |
| r8453 | r8454 | |
| 3039 | 3039 | |
| 3040 | 3040 | if (mac->mac_model < MODEL_MAC_II) |
| 3041 | 3041 | { |
| 3042 | mac_sh_updatebuffer( | |
| 3042 | mac_sh_updatebuffer(m | |
| 3043 | 3043 | } |
| 3044 | 3044 | |
| 3045 | 3045 | scanline = machine->primary_screen->vpos(); |
| r8453 | r8454 | |
|---|---|---|
| 58 | 58 | | (((mpc105->bank_registers[(bank / 4) + 6] >> (bank % 4) * 8)) & 0x03) << 28 |
| 59 | 59 | | 0x000FFFFF; |
| 60 | 60 | |
| 61 | end = MIN(end, begin + messram_get_size( | |
| 61 | end = MIN(end, begin + messram_get_size(m | |
| 62 | 62 | |
| 63 | 63 | if ((begin + 0x100000) <= end) |
| 64 | 64 | { |
| 65 | 65 | if (LOG_MPC105) |
| 66 | logerror("\tbank #%d [%02d]: 0x%08X - 0x%08X [%p-%p]\n", bank, bank + mpc105->bank_base, begin, end, messram_get_ptr( | |
| 66 | logerror("\tbank #%d [%02d]: 0x%08X - 0x%08X [%p-%p]\n", bank, bank + mpc105->bank_base, begin, end, messram_get_ptr(m | |
| 67 | 67 | |
| 68 | 68 | if (mpc105->bank_base > 0) |
| 69 | 69 | { |
| r8453 | r8454 | |
| 78 | 78 | 0, 0, (write64_space_func) (FPTR)(bank + mpc105->bank_base)); |
| 79 | 79 | } |
| 80 | 80 | sprintf(bank_str,"bank%d",bank + mpc105->bank_base); |
| 81 | memory_set_bankptr(machine, bank_str, messram_get_ptr( | |
| 81 | memory_set_bankptr(machine, bank_str, messram_get_ptr(m | |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | } |
| r8453 | r8454 | |
|---|---|---|
| 190 | 190 | { |
| 191 | 191 | i8271_t *i8271 = get_safe_token(device); |
| 192 | 192 | if (i8271->intf->floppy_drive_tags[i8271->drive]!=NULL) { |
| 193 | return dev | |
| 193 | return dev | |
| 194 | 194 | } else { |
| 195 | 195 | return NULL; |
| 196 | 196 | } |
| r8453 | r8454 | |
| 1064 | 1064 | /* these two do not appear to be set at all! ?? */ |
| 1065 | 1065 | |
| 1066 | 1066 | if (i8271->intf->floppy_drive_tags[0]!=NULL) { |
| 1067 | if (floppy_drive_get_flag_state(dev | |
| 1067 | if (floppy_drive_get_flag_state(dev | |
| 1068 | 1068 | { |
| 1069 | 1069 | status |= (1<<2); |
| 1070 | 1070 | } |
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | 1073 | if (i8271->intf->floppy_drive_tags[1]!=NULL) { |
| 1074 | if (floppy_drive_get_flag_state(dev | |
| 1074 | if (floppy_drive_get_flag_state(dev | |
| 1075 | 1075 | { |
| 1076 | 1076 | status |= (1<<6); |
| 1077 | 1077 | } |
| r8453 | r8454 | |
|---|---|---|
| 213 | 213 | case 0x66: |
| 214 | 214 | case 0x67: |
| 215 | 215 | { |
| 216 | running_device *tpi = | |
| 216 | running_device *tpi = | |
| 217 | 217 | LOG(( "DMAC: PC=%08x - TPI6525 Read(%d)\n", cpu_get_pc(space->cpu), (offset - 0x58) )); |
| 218 | 218 | return tpi6525_r(tpi, offset - 0x58); |
| 219 | 219 | } |
| r8453 | r8454 | |
| 340 | 340 | case 0x66: |
| 341 | 341 | case 0x67: |
| 342 | 342 | { |
| 343 | running_device *tpi = | |
| 343 | running_device *tpi = | |
| 344 | 344 | LOG(( "DMAC: PC=%08x - TPI6525 Write(%d) - data = %04x\n", cpu_get_pc(space->cpu), (offset - 0x58), data )); |
| 345 | 345 | tpi6525_w(tpi, offset - 0x58, data); |
| 346 | 346 | } |
| r8453 | r8454 | |
| 483 | 483 | |
| 484 | 484 | static void cdrom_status_enabled( running_machine *machine, int level ) |
| 485 | 485 | { |
| 486 | running_device *tpi = | |
| 486 | running_device *tpi = m | |
| 487 | 487 | |
| 488 | 488 | /* PC3 on the 6525 */ |
| 489 | 489 | tpi6525_irq3_level(tpi, level); |
| r8453 | r8454 | |
| 491 | 491 | |
| 492 | 492 | static void cdrom_status_change( running_machine *machine, int level ) |
| 493 | 493 | { |
| 494 | running_device *tpi = | |
| 494 | running_device *tpi = m | |
| 495 | 495 | |
| 496 | 496 | /* invert */ |
| 497 | 497 | level = level ? 0 : 1; |
| r8453 | r8454 | |
| 502 | 502 | |
| 503 | 503 | static void cdrom_subcode_ready( running_machine *machine, int level ) |
| 504 | 504 | { |
| 505 | running_device *tpi = | |
| 505 | running_device *tpi = m | |
| 506 | 506 | |
| 507 | 507 | /* PC1 on the 6525 */ |
| 508 | 508 | tpi6525_irq1_level(tpi, level); |
| r8453 | r8454 | |
| 519 | 519 | /* set up DMAC with autoconfig */ |
| 520 | 520 | amiga_add_autoconfig( machine, &dmac_device ); |
| 521 | 521 | |
| 522 | matsucd_init( | |
| 522 | matsucd_init( m | |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | MACHINE_RESET( amigacd ) |
| r8453 | r8454 | |
|---|---|---|
| 50 | 50 | /* Brutal hack put in as a consequence of the new memory system; we really need to fix the NES code */ |
| 51 | 51 | memory_install_readwrite_bank(space, 0x0000, 0x07ff, 0, 0x1800, "bank10"); |
| 52 | 52 | |
| 53 | memory_install_readwrite8_handler(cpu_get_address_space(devtag_get_device(machine, "ppu"), ADDRESS_SPACE_PROGRAM), 0, 0x1fff, 0, 0, nes_chr_r, nes_chr_w); | |
| 54 | memory_install_readwrite8_handler(cpu_get_address_space(devtag_get_device(machine, "ppu"), ADDRESS_SPACE_PROGRAM), 0x2000, 0x3eff, 0, 0, nes_nt_r, nes_nt_w); | |
| 53 | memory_install_readwrite8_handler(cpu_get_address_space(machine->device("ppu"), ADDRESS_SPACE_PROGRAM), 0, 0x1fff, 0, 0, nes_chr_r, nes_chr_w); | |
| 54 | memory_install_readwrite8_handler(cpu_get_address_space(machine->device("ppu"), ADDRESS_SPACE_PROGRAM), 0x2000, 0x3eff, 0, 0, nes_nt_r, nes_nt_w); | |
| 55 | 55 | |
| 56 | 56 | memory_set_bankptr(machine, "bank10", state->rom); |
| 57 | 57 | |
| r8453 | r8454 | |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | if (state->pcb_id == WAIXING_SH2) |
| 180 | memory_install_read8_handler(cpu_get_address_space( | |
| 180 | memory_install_read8_handler(cpu_get_address_space(m | |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | // to be probably removed (it does nothing since a long time) |
| r8453 | r8454 | |
| 200 | 200 | state->in_0.shift = 0; |
| 201 | 201 | state->in_1.shift = 0; |
| 202 | 202 | |
| 203 | | |
| 203 | m | |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | static TIMER_CALLBACK( nes_irq_callback ) |
| r8453 | r8454 | |
| 281 | 281 | init_nes_core(machine); |
| 282 | 282 | machine->add_notifier(MACHINE_NOTIFY_EXIT, nes_machine_stop); |
| 283 | 283 | |
| 284 | state->maincpu = devtag_get_device(machine, "maincpu"); | |
| 285 | state->ppu = devtag_get_device(machine, "ppu"); | |
| 286 | state->sound = devtag_get_device(machine, "nessound"); | |
| 287 | state->cart = devtag_get_device(machine, "cart"); | |
| 284 | state->maincpu = machine->device("maincpu"); | |
| 285 | state->ppu = machine->device("ppu"); | |
| 286 | state->sound = machine->device("nessound"); | |
| 287 | state->cart = machine->device("cart"); | |
| 288 | 288 | |
| 289 | 289 | state->irq_timer = timer_alloc(machine, nes_irq_callback, NULL); |
| 290 | 290 | nes_state_register(machine); |
| r8453 | r8454 | |
|---|---|---|
| 330 | 330 | /* calendar R/W */ |
| 331 | 331 | VLOG(("concept_io_r: Calendar read at address 0x03%4.4x\n", offset << 1)); |
| 332 | 332 | if (!clock_enable) |
| 333 | return mm58274c_r( | |
| 333 | return mm58274c_r( | |
| 334 | 334 | break; |
| 335 | 335 | |
| 336 | 336 | case 7: |
| r8453 | r8454 | |
| 378 | 378 | /* NVIA versatile system interface */ |
| 379 | 379 | LOG(("concept_io_r: VIA read at address 0x03%4.4x\n", offset << 1)); |
| 380 | 380 | { |
| 381 | running_device *via_0 = | |
| 381 | running_device *via_0 = | |
| 382 | 382 | return via_r(via_0, offset & 0xf); |
| 383 | 383 | } |
| 384 | 384 | break; |
| r8453 | r8454 | |
| 472 | 472 | /* calendar R/W */ |
| 473 | 473 | LOG(("concept_io_w: Calendar written to at address 0x03%4.4x, data: 0x%4.4x\n", offset << 1, data)); |
| 474 | 474 | if (!clock_enable) |
| 475 | mm58274c_w( | |
| 475 | mm58274c_w( | |
| 476 | 476 | break; |
| 477 | 477 | |
| 478 | 478 | case 7: |
| r8453 | r8454 | |
| 491 | 491 | case 3: |
| 492 | 492 | /* NVIA versatile system interface */ |
| 493 | 493 | { |
| 494 | running_device *via_0 = | |
| 494 | running_device *via_0 = | |
| 495 | 495 | via_w(via_0, offset & 0xf, data); |
| 496 | 496 | } |
| 497 | 497 | break; |
| r8453 | r8454 | |
| 606 | 606 | |
| 607 | 607 | static READ8_HANDLER(concept_fdc_reg_r) |
| 608 | 608 | { |
| 609 | running_device *fdc = | |
| 609 | running_device *fdc = | |
| 610 | 610 | switch (offset) |
| 611 | 611 | { |
| 612 | 612 | case 0: |
| r8453 | r8454 | |
| 636 | 636 | static WRITE8_HANDLER(concept_fdc_reg_w) |
| 637 | 637 | { |
| 638 | 638 | int current_drive; |
| 639 | running_device *fdc = | |
| 639 | running_device *fdc = | |
| 640 | 640 | switch (offset) |
| 641 | 641 | { |
| 642 | 642 | case 0: |
| r8453 | r8454 | |
|---|---|---|
| 482 | 482 | msx1.cart_state[i] = cart_state[i]; |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | cpu_set_input_line_vector ( | |
| 485 | cpu_set_input_line_vector (m | |
| 486 | 486 | |
| 487 | 487 | msx_memory_init (machine); |
| 488 | 488 | |
| 489 | z80_set_cycle_tables( | |
| 489 | z80_set_cycle_tables( m | |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | INTERRUPT_GEN( msx2_interrupt ) |
| r8453 | r8454 | |
| 516 | 516 | |
| 517 | 517 | static running_device *cassette_device_image(running_machine *machine) |
| 518 | 518 | { |
| 519 | return | |
| 519 | return m | |
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | READ8_HANDLER ( msx_psg_port_a_r ) |
| r8453 | r8454 | |
| 616 | 616 | if (input_port_read(device->machine, "DSW") & 0x80) |
| 617 | 617 | { |
| 618 | 618 | /* SIMPL emulation */ |
| 619 | dac_signed_data_w(dev | |
| 619 | dac_signed_data_w(dev | |
| 620 | 620 | } |
| 621 | 621 | else |
| 622 | 622 | { |
| r8453 | r8454 | |
| 640 | 640 | { |
| 641 | 641 | if (msx1.opll_active) |
| 642 | 642 | { |
| 643 | running_device *ym = | |
| 643 | running_device *ym = | |
| 644 | 644 | |
| 645 | 645 | if (offset == 1) |
| 646 | 646 | ym2413_w (ym, 1, data); |
| r8453 | r8454 | |
| 660 | 660 | |
| 661 | 661 | WRITE8_HANDLER (msx_rtc_reg_w) |
| 662 | 662 | { |
| 663 | running_device *rtc = | |
| 663 | running_device *rtc = | |
| 664 | 664 | tc8521_w(rtc, msx1.rtc_latch, data); |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | 667 | READ8_HANDLER (msx_rtc_reg_r) |
| 668 | 668 | { |
| 669 | running_device *rtc = | |
| 669 | running_device *rtc = | |
| 670 | 670 | return tc8521_r(rtc, msx1.rtc_latch); |
| 671 | 671 | } |
| 672 | 672 | |
| 673 | 673 | NVRAM_HANDLER( msx2 ) |
| 674 | 674 | { |
| 675 | running_device *rtc = | |
| 675 | running_device *rtc = m | |
| 676 | 676 | if (file) |
| 677 | 677 | { |
| 678 | 678 | if (read_or_write) |
| r8453 | r8454 | |
| 775 | 775 | |
| 776 | 776 | /* key click */ |
| 777 | 777 | if ( (old_val ^ data) & 0x80) |
| 778 | dac_signed_data_w (dev | |
| 778 | dac_signed_data_w (dev | |
| 779 | 779 | |
| 780 | 780 | /* cassette motor on/off */ |
| 781 | 781 | if ( (old_val ^ data) & 0x10) |
| r8453 | r8454 | |
|---|---|---|
| 110 | 110 | { |
| 111 | 111 | mz_state *mz = (mz_state *)machine->driver_data; |
| 112 | 112 | |
| 113 | mz->pit = devtag_get_device(machine, "pit8253"); | |
| 114 | mz->ppi = devtag_get_device(machine, "ppi8255"); | |
| 113 | mz->pit = machine->device("pit8253"); | |
| 114 | mz->ppi = machine->device("ppi8255"); | |
| 115 | 115 | |
| 116 | 116 | /* reset memory map to defaults */ |
| 117 | 117 | mz700_bank_4_w(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0, 0); |
| r8453 | r8454 | |
| 180 | 180 | |
| 181 | 181 | /* ram from 0xa000 to 0xbfff */ |
| 182 | 182 | memory_install_readwrite_bank(spc, 0xa000, 0xbfff, 0, 0, "bank5"); |
| 183 | memory_set_bankptr(space->machine, "bank5", messram_get_ptr( | |
| 183 | memory_set_bankptr(space->machine, "bank5", messram_get_ptr( | |
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
| r8453 | r8454 | |
| 192 | 192 | const address_space *spc = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 193 | 193 | |
| 194 | 194 | memory_install_readwrite_bank(spc, 0x0000, 0x0fff, 0, 0, "bank1"); |
| 195 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr( | |
| 195 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr( | |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | WRITE8_HANDLER( mz800_bank_0_w ) |
| r8453 | r8454 | |
| 200 | 200 | const address_space *spc = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 201 | 201 | |
| 202 | 202 | memory_install_readwrite_bank(spc, 0x0000, 0x7fff, 0, 0, "bank1"); |
| 203 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr( | |
| 203 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr( | |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | READ8_HANDLER( mz800_bank_1_r ) |
| r8453 | r8454 | |
| 210 | 210 | |
| 211 | 211 | /* switch in ram from 0x1000 to 0x1fff */ |
| 212 | 212 | memory_install_readwrite_bank(spc, 0x1000, 0x1fff, 0x1000, 0, "bank2"); |
| 213 | memory_set_bankptr(space->machine, "bank2", messram_get_ptr( | |
| 213 | memory_set_bankptr(space->machine, "bank2", messram_get_ptr( | |
| 214 | 214 | |
| 215 | 215 | if (mz->mz700_mode) |
| 216 | 216 | { |
| 217 | 217 | /* ram from 0xc000 to 0xcfff */ |
| 218 | 218 | memory_install_readwrite_bank(spc, 0xc000, 0xcfff, 0, 0, "bank6"); |
| 219 | memory_set_bankptr(space->machine, "bank6", messram_get_ptr( | |
| 219 | memory_set_bankptr(space->machine, "bank6", messram_get_ptr( | |
| 220 | 220 | } |
| 221 | 221 | else |
| 222 | 222 | { |
| 223 | 223 | /* ram from 0x8000 to 0xbfff */ |
| 224 | 224 | memory_install_readwrite_bank(spc, 0x8000, 0xbfff, 0, 0, "bank4"); |
| 225 | memory_set_bankptr(space->machine, "bank4", messram_get_ptr( | |
| 225 | memory_set_bankptr(space->machine, "bank4", messram_get_ptr( | |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | return 0xff; |
| r8453 | r8454 | |
| 239 | 239 | if (!mz->mz700_ram_lock) |
| 240 | 240 | { |
| 241 | 241 | memory_install_readwrite_bank(spc, 0xd000, 0xffff, 0, 0, "bank7"); |
| 242 | memory_set_bankptr(space->machine, "bank7", messram_get_ptr( | |
| 242 | memory_set_bankptr(space->machine, "bank7", messram_get_ptr( | |
| 243 | 243 | mz->mz700_ram_vram = FALSE; |
| 244 | 244 | } |
| 245 | 245 | } |
| r8453 | r8454 | |
| 249 | 249 | if (!mz->mz800_ram_lock) |
| 250 | 250 | { |
| 251 | 251 | memory_install_readwrite_bank(spc, 0xe000, 0xffff, 0, 0, "bank8"); |
| 252 | memory_set_bankptr(space->machine, "bank8", messram_get_ptr( | |
| 252 | memory_set_bankptr(space->machine, "bank8", messram_get_ptr( | |
| 253 | 253 | mz->mz800_ram_monitor = FALSE; |
| 254 | 254 | } |
| 255 | 255 | } |
| r8453 | r8454 | |
| 324 | 324 | |
| 325 | 325 | /* rest is ram is always ram in mz700 mode */ |
| 326 | 326 | memory_install_readwrite_bank(spc, 0x1000, 0xcfff, 0, 0, "bank2"); |
| 327 | memory_set_bankptr(space->machine, "bank2", messram_get_ptr( | |
| 327 | memory_set_bankptr(space->machine, "bank2", messram_get_ptr( | |
| 328 | 328 | } |
| 329 | 329 | else |
| 330 | 330 | { |
| r8453 | r8454 | |
| 335 | 335 | |
| 336 | 336 | /* ram from 0x2000 to 0x7fff */ |
| 337 | 337 | memory_install_readwrite_bank(spc, 0x2000, 0x7fff, 0, 0, "bank3"); |
| 338 | memory_set_bankptr(space->machine, "bank3", messram_get_ptr( | |
| 338 | memory_set_bankptr(space->machine, "bank3", messram_get_ptr( | |
| 339 | 339 | |
| 340 | 340 | if (mz->hires_mode) |
| 341 | 341 | { |
| r8453 | r8454 | |
| 351 | 351 | |
| 352 | 352 | /* ram from 0xa000 to 0xbfff */ |
| 353 | 353 | memory_install_readwrite_bank(spc, 0xa000, 0xbfff, 0, 0, "bank5"); |
| 354 | memory_set_bankptr(space->machine, "bank5", messram_get_ptr( | |
| 354 | memory_set_bankptr(space->machine, "bank5", messram_get_ptr( | |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | /* ram from 0xc000 to 0xdfff */ |
| 358 | 358 | memory_install_readwrite_bank(spc, 0xc000, 0xdfff, 0, 0, "bank6"); |
| 359 | memory_set_bankptr(space->machine, "bank6", messram_get_ptr( | |
| 359 | memory_set_bankptr(space->machine, "bank6", messram_get_ptr( | |
| 360 | 360 | |
| 361 | 361 | /* mz800 monitor rom from 0xe000 to 0xffff */ |
| 362 | 362 | memory_install_read_bank(spc, 0xe000, 0xffff, 0, 0, "bank8"); |
| r8453 | r8454 | |
| 422 | 422 | |
| 423 | 423 | static WRITE_LINE_DEVICE_HANDLER( pit_out0_changed ) |
| 424 | 424 | { |
| 425 | running_device *speaker = dev | |
| 425 | running_device *speaker = dev | |
| 426 | 426 | if((prev_state==0) && (state==1)) { |
| 427 | 427 | speaker_level ^= 1; |
| 428 | 428 | } |
| r8453 | r8454 | |
| 474 | 474 | */ |
| 475 | 475 | static READ8_DEVICE_HANDLER( pio_port_c_r ) |
| 476 | 476 | { |
| 477 | running_device *cas = dev | |
| 477 | running_device *cas = dev | |
| 478 | 478 | mz_state *mz = (mz_state *)device->machine->driver_data; |
| 479 | 479 | UINT8 data = 0; |
| 480 | 480 | |
| r8453 | r8454 | |
| 517 | 517 | * bit 0 out unused |
| 518 | 518 | */ |
| 519 | 519 | |
| 520 | // UINT8 state = cassette_get_state(dev | |
| 520 | // UINT8 state = cassette_get_state(dev | |
| 521 | 521 | // UINT8 action = ((~pio_port_c_output & 8) & (data & 8)); /* detect low-to-high transition */ |
| 522 | 522 | |
| 523 | 523 | /* The motor control circuit consists of a resistor, capacitor, invertor, nand-gate, and D flip-flop. |
| r8453 | r8454 | |
| 530 | 530 | If you load from the command-line or the software-picker, type in L <enter> immediately. */ |
| 531 | 531 | #if 0 |
| 532 | 532 | cassette_change_state( |
| 533 | dev | |
| 533 | dev | |
| 534 | 534 | ((data & 0x08) && mz700_motor_on) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, |
| 535 | 535 | CASSETTE_MOTOR_DISABLED); |
| 536 | 536 | |
| r8453 | r8454 | |
| 538 | 538 | |
| 539 | 539 | LOG(2,"mz700_pio_port_c_w",("%02X\n", data),device->machine); |
| 540 | 540 | |
| 541 | cassette_output(dev | |
| 541 | cassette_output(dev | |
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | |
| r8453 | r8454 | |
| 566 | 566 | |
| 567 | 567 | static READ8_DEVICE_HANDLER( mz800_z80pio_port_a_r ) |
| 568 | 568 | { |
| 569 | running_device *printer = dev | |
| 569 | running_device *printer = dev | |
| 570 | 570 | UINT8 result = 0; |
| 571 | 571 | |
| 572 | 572 | result |= centronics_busy_r(printer); |
| r8453 | r8454 | |
| 578 | 578 | |
| 579 | 579 | static WRITE8_DEVICE_HANDLER( mz800_z80pio_port_a_w ) |
| 580 | 580 | { |
| 581 | running_device *printer = dev | |
| 581 | running_device *printer = dev | |
| 582 | 582 | |
| 583 | 583 | centronics_prime_w(printer, BIT(data, 6)); |
| 584 | 584 | centronics_strobe_w(printer, BIT(data, 7)); |
| r8453 | r8454 | |
| 586 | 586 | |
| 587 | 587 | static WRITE8_DEVICE_HANDLER( mz800_printer_data_w ) |
| 588 | 588 | { |
| 589 | running_device *printer = dev | |
| 589 | running_device *printer = dev | |
| 590 | 590 | centronics_data_w(printer, 0, data); |
| 591 | 591 | } |
| 592 | 592 | |
| r8453 | r8454 | |
| 678 | 678 | /* port EB */ |
| 679 | 679 | WRITE8_HANDLER( mz800_ramaddr_w ) |
| 680 | 680 | { |
| 681 | mz800_ramaddr = (cpu_get_reg( | |
| 681 | mz800_ramaddr = (cpu_get_reg( | |
| 682 | 682 | LOG(1,"mz800_ramaddr_w",("%04X\n", mz800_ramaddr),space->machine); |
| 683 | 683 | } |
| 684 | 684 |
| r8453 | r8454 | |
|---|---|---|
| 248 | 248 | if ((!(vectrex_via_out[PORTB] & 0x10)) && (vectrex_via_out[PORTB] & 0x08)) |
| 249 | 249 | /* BDIR inactive, we can read the PSG. BC1 has to be active. */ |
| 250 | 250 | { |
| 251 | running_device *ay = dev | |
| 251 | running_device *ay = dev | |
| 252 | 252 | |
| 253 | 253 | vectrex_via_out[PORTA] = ay8910_r(ay, 0) |
| 254 | 254 | & ~(vectrex_imager_pinlevel & 0x80); |
| r8453 | r8454 | |
| 284 | 284 | |
| 285 | 285 | TIMER_CALLBACK(vectrex_imager_eye) |
| 286 | 286 | { |
| 287 | running_device *via_0 = | |
| 287 | running_device *via_0 = m | |
| 288 | 288 | int coffset; |
| 289 | 289 | double rtime = (1.0 / vectrex_imager_freq); |
| 290 | 290 |
| r8453 | r8454 | |
|---|---|---|
| 104 | 104 | ddtdata.channel= -1; // not used |
| 105 | 105 | ddtdata.mode= -1; // copy from/to buffer |
| 106 | 106 | printf("ATAPI: DMA one sector to %x, %x remaining\n", atapi_xferbase, atapi_xferlen); |
| 107 | sh4_dma_ddt( | |
| 107 | sh4_dma_ddt(m | |
| 108 | 108 | |
| 109 | 109 | atapi_xferbase += 2048; |
| 110 | 110 | } |
| r8453 | r8454 | |
| 578 | 578 | atapi_xferlen = 0; |
| 579 | 579 | atapi_xfermod = 0; |
| 580 | 580 | |
| 581 | if ( mess_cd_get_cdrom_file( | |
| 581 | if ( mess_cd_get_cdrom_file(m | |
| 582 | 582 | { |
| 583 | 583 | SCSIAllocInstance( machine, &SCSIClassGDROM, &gdrom_device, "cdrom" ); |
| 584 | 584 | } |
| r8453 | r8454 | |
|---|---|---|
| 347 | 347 | |
| 348 | 348 | INLINE void COPS_send_data_if_possible(running_machine *machine) |
| 349 | 349 | { |
| 350 | running_device *via_0 = | |
| 350 | running_device *via_0 = m | |
| 351 | 351 | |
| 352 | 352 | if ((! hold_COPS_data) && fifo_size && (! COPS_Ready)) |
| 353 | 353 | { |
| r8453 | r8454 | |
| 437 | 437 | if (keycode == NMIcode) |
| 438 | 438 | { /* generate NMI interrupt */ |
| 439 | 439 | cputag_set_input_line(machine, "maincpu", M68K_IRQ_7, PULSE_LINE); |
| 440 | cpu_set_input_line_vector( | |
| 440 | cpu_set_input_line_vector(m | |
| 441 | 441 | } |
| 442 | 442 | #endif |
| 443 | 443 | COPS_queue_data(machine, & keycode, 1); |
| r8453 | r8454 | |
| 535 | 535 | static TIMER_CALLBACK(read_COPS_command) |
| 536 | 536 | { |
| 537 | 537 | int command; |
| 538 | running_device *via_0 = | |
| 538 | running_device *via_0 = m | |
| 539 | 539 | |
| 540 | 540 | COPS_Ready = 0; |
| 541 | 541 | |
| r8453 | r8454 | |
| 827 | 827 | |
| 828 | 828 | static WRITE8_DEVICE_HANDLER(COPS_via_out_b) |
| 829 | 829 | { |
| 830 | running_device *via_0 = dev | |
| 830 | running_device *via_0 = dev | |
| 831 | 831 | |
| 832 | 832 | /* pull-up */ |
| 833 | 833 | data |= (~ via_r(via_0, VIA_DDRA)) & 0x01; |
| r8453 | r8454 | |
| 853 | 853 | |
| 854 | 854 | static WRITE8_DEVICE_HANDLER(COPS_via_out_cb2) |
| 855 | 855 | { |
| 856 | running_device *speaker = dev | |
| 856 | running_device *speaker = dev | |
| 857 | 857 | speaker_level_w(speaker, data); |
| 858 | 858 | } |
| 859 | 859 | |
| r8453 | r8454 | |
| 978 | 978 | |
| 979 | 979 | } |
| 980 | 980 | |
| 981 | if (cpu_get_reg( | |
| 981 | if (cpu_get_reg( | |
| 982 | 982 | /* supervisor mode -> force register file 0 */ |
| 983 | 983 | the_seg = 0; |
| 984 | 984 | |
| r8453 | r8454 | |
| 1159 | 1159 | memory_set_direct_update_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), lisa_OPbaseoverride); |
| 1160 | 1160 | memory_set_direct_update_handler(cputag_get_address_space(machine, "fdccpu", ADDRESS_SPACE_PROGRAM), lisa_fdc_OPbaseoverride); |
| 1161 | 1161 | |
| 1162 | m68k_set_reset_callback( | |
| 1162 | m68k_set_reset_callback(m | |
| 1163 | 1163 | |
| 1164 | 1164 | /* init MMU */ |
| 1165 | 1165 | |
| r8453 | r8454 | |
| 1188 | 1188 | init_COPS(machine); |
| 1189 | 1189 | |
| 1190 | 1190 | { |
| 1191 | running_device *via_0 = | |
| 1191 | running_device *via_0 = m | |
| 1192 | 1192 | COPS_via_out_ca2(via_0, 0, 0); /* VIA core forgets to do so */ |
| 1193 | 1193 | } |
| 1194 | 1194 | |
| 1195 | 1195 | /* initialize floppy */ |
| 1196 | 1196 | { |
| 1197 | 1197 | if (lisa_features.floppy_hardware == sony_lisa2) |
| 1198 | sony_set_enable_lines( | |
| 1198 | sony_set_enable_lines(m | |
| 1199 | 1199 | } |
| 1200 | 1200 | } |
| 1201 | 1201 | |
| r8453 | r8454 | |
| 1325 | 1325 | MT1 = offset & 1; |
| 1326 | 1326 | if (MT1 && ! oldMT1) |
| 1327 | 1327 | { |
| 1328 | running_device *fdc = | |
| 1328 | running_device *fdc = m | |
| 1329 | 1329 | |
| 1330 | 1330 | PWM_floppy_motor_speed = (PWM_floppy_motor_speed << 1) & 0xff; |
| 1331 | 1331 | if (applefdc_get_lines(fdc) & APPLEFDC_PH0) |
| r8453 | r8454 | |
| 1347 | 1347 | else |
| 1348 | 1348 | #endif |
| 1349 | 1349 | if (lisa_features.floppy_hardware == sony_lisa210) |
| 1350 | sony_set_sel_line( | |
| 1350 | sony_set_sel_line(m | |
| 1351 | 1351 | break; |
| 1352 | 1352 | case 6: |
| 1353 | 1353 | DISK_DIAG = offset & 1; |
| r8453 | r8454 | |
| 1362 | 1362 | READ8_HANDLER ( lisa_fdc_io_r ) |
| 1363 | 1363 | { |
| 1364 | 1364 | int answer=0; |
| 1365 | running_device *fdc = | |
| 1365 | running_device *fdc = | |
| 1366 | 1366 | |
| 1367 | 1367 | switch ((offset & 0x0030) >> 4) |
| 1368 | 1368 | { |
| r8453 | r8454 | |
| 1389 | 1389 | |
| 1390 | 1390 | WRITE8_HANDLER ( lisa_fdc_io_w ) |
| 1391 | 1391 | { |
| 1392 | running_device *fdc = | |
| 1392 | running_device *fdc = | |
| 1393 | 1393 | |
| 1394 | 1394 | switch ((offset & 0x0030) >> 4) |
| 1395 | 1395 | { |
| r8453 | r8454 | |
| 1522 | 1522 | } |
| 1523 | 1523 | } |
| 1524 | 1524 | |
| 1525 | if (cpu_get_reg( | |
| 1525 | if (cpu_get_reg( | |
| 1526 | 1526 | /* supervisor mode -> force register file 0 */ |
| 1527 | 1527 | the_seg = 0; |
| 1528 | 1528 | |
| r8453 | r8454 | |
| 1626 | 1626 | if ((time_in_frame >= 364) && (time_in_frame <= 375)) |
| 1627 | 1627 | { |
| 1628 | 1628 | answer = videoROM_ptr[videoROM_address|0x80] << 8; |
| 1629 | logerror("reading1 %06X=%04x PC=%06x time=%d\n", address, answer, cpu_get_pc( | |
| 1629 | logerror("reading1 %06X=%04x PC=%06x time=%d\n", address, answer, cpu_get_pc( | |
| 1630 | 1630 | } |
| 1631 | 1631 | else |
| 1632 | 1632 | { |
| 1633 | 1633 | answer = videoROM_ptr[videoROM_address] << 8; |
| 1634 | logerror("reading2 %06X=%04x PC=%06x time=%d\n", address, answer, cpu_get_pc( | |
| 1634 | logerror("reading2 %06X=%04x PC=%06x time=%d\n", address, answer, cpu_get_pc( | |
| 1635 | 1635 | } |
| 1636 | 1636 | } |
| 1637 | 1637 | |
| r8453 | r8454 | |
| 1730 | 1730 | } |
| 1731 | 1731 | } |
| 1732 | 1732 | |
| 1733 | if (cpu_get_reg( | |
| 1733 | if (cpu_get_reg( | |
| 1734 | 1734 | /* supervisor mode -> force register file 0 */ |
| 1735 | 1735 | the_seg = 0; |
| 1736 | 1736 | |
| r8453 | r8454 | |
| 1892 | 1892 | seg &= ~2; |
| 1893 | 1893 | break; |
| 1894 | 1894 | case 0x0010: /* SETUP register SET */ |
| 1895 | logerror("setup SET PC=%x\n", cpu_get_pc( | |
| 1895 | logerror("setup SET PC=%x\n", cpu_get_pc(m | |
| 1896 | 1896 | setup = 1; |
| 1897 | 1897 | break; |
| 1898 | 1898 | case 0x0012: /* SETUP register RESET */ |
| 1899 | logerror("setup UNSET PC=%x\n", cpu_get_pc( | |
| 1899 | logerror("setup UNSET PC=%x\n", cpu_get_pc(m | |
| 1900 | 1900 | setup = 0; |
| 1901 | 1901 | break; |
| 1902 | 1902 | case 0x001A: /* Enable Vertical Retrace Interrupt */ |
| 1903 | logerror("enable retrace PC=%x\n", cpu_get_pc( | |
| 1903 | logerror("enable retrace PC=%x\n", cpu_get_pc(m | |
| 1904 | 1904 | VTMSK = 1; |
| 1905 | 1905 | break; |
| 1906 | 1906 | case 0x0018: /* Disable Vertical Retrace Interrupt */ |
| 1907 | logerror("disable retrace PC=%x\n", cpu_get_pc( | |
| 1907 | logerror("disable retrace PC=%x\n", cpu_get_pc(m | |
| 1908 | 1908 | VTMSK = 0; |
| 1909 | 1909 | set_VTIR(machine, 2); |
| 1910 | 1910 | break; |
| r8453 | r8454 | |
| 1923 | 1923 | |
| 1924 | 1924 | static READ16_HANDLER ( lisa_IO_r ) |
| 1925 | 1925 | { |
| 1926 | running_device *via_0 = devtag_get_device(space->machine, "via6522_0"); | |
| 1927 | running_device *via_1 = devtag_get_device(space->machine, "via6522_1"); | |
| 1926 | running_device *via_0 = space->machine->device("via6522_0"); | |
| 1927 | running_device *via_1 = space->machine->device("via6522_1"); | |
| 1928 | 1928 | int answer=0; |
| 1929 | 1929 | |
| 1930 | 1930 | switch ((offset & 0x7000) >> 12) |
| r8453 | r8454 | |
| 2040 | 2040 | else |
| 2041 | 2041 | answer |= 0x04; |
| 2042 | 2042 | /* huh... we need to emulate some other bits */ |
| 2043 | logerror("read status PC=%x val=%x\n", cpu_get_pc( | |
| 2043 | logerror("read status PC=%x val=%x\n", cpu_get_pc( | |
| 2044 | 2044 | |
| 2045 | 2045 | break; |
| 2046 | 2046 | } |
| r8453 | r8454 | |
| 2052 | 2052 | |
| 2053 | 2053 | static WRITE16_HANDLER ( lisa_IO_w ) |
| 2054 | 2054 | { |
| 2055 | running_device *via_0 = devtag_get_device(space->machine, "via6522_0"); | |
| 2056 | running_device *via_1 = devtag_get_device(space->machine, "via6522_1"); | |
| 2055 | running_device *via_0 = space->machine->device("via6522_0"); | |
| 2056 | running_device *via_1 = space->machine->device("via6522_1"); | |
| 2057 | 2057 | |
| 2058 | 2058 | switch ((offset & 0x7000) >> 12) |
| 2059 | 2059 | { |
| r8453 | r8454 | |
|---|---|---|
| 116 | 116 | |
| 117 | 117 | static WRITE8_DEVICE_HANDLER(sym1_riot_a_w) |
| 118 | 118 | { |
| 119 | logerror("%x: riot_a_w 0x%02x\n", cpu_get_pc( dev | |
| 119 | logerror("%x: riot_a_w 0x%02x\n", cpu_get_pc( dev | |
| 120 | 120 | |
| 121 | 121 | /* save for later use */ |
| 122 | 122 | riot_port_a = data; |
| r8453 | r8454 | |
| 125 | 125 | |
| 126 | 126 | static WRITE8_DEVICE_HANDLER(sym1_riot_b_w) |
| 127 | 127 | { |
| 128 | logerror("%x: riot_b_w 0x%02x\n", cpu_get_pc( dev | |
| 128 | logerror("%x: riot_b_w 0x%02x\n", cpu_get_pc( dev | |
| 129 | 129 | |
| 130 | 130 | /* save for later use */ |
| 131 | 131 | riot_port_b = data; |
| 132 | 132 | |
| 133 | 133 | /* first 4 pins are connected to the 74145 */ |
| 134 | ttl74145_w(dev | |
| 134 | ttl74145_w(dev | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | |
| r8453 | r8454 | |
| 279 | 279 | DRIVER_INIT( sym1 ) |
| 280 | 280 | { |
| 281 | 281 | /* wipe expansion memory banks that are not installed */ |
| 282 | if (messram_get_size( | |
| 282 | if (messram_get_size(m | |
| 283 | 283 | { |
| 284 | 284 | memory_nop_readwrite(cputag_get_address_space( machine, "maincpu", ADDRESS_SPACE_PROGRAM ), |
| 285 | messram_get_size( | |
| 285 | messram_get_size(m | |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | /* allocate a timer to refresh the led display */ |
| r8453 | r8454 | |
| 297 | 297 | memory_install_read_bank(cputag_get_address_space( machine, "maincpu", ADDRESS_SPACE_PROGRAM ),0xf800, 0xffff, 0, 0, "bank1"); |
| 298 | 298 | memory_nop_write(cputag_get_address_space( machine, "maincpu", ADDRESS_SPACE_PROGRAM ),0xf800, 0xffff, 0, 0); |
| 299 | 299 | memory_set_bankptr(machine, "bank1", sym1_monitor + 0x800); |
| 300 | | |
| 300 | m | |
| 301 | 301 | } |
| r8453 | r8454 | |
|---|---|---|
| 43 | 43 | |
| 44 | 44 | static TIMER_CALLBACK( handle_cassette_input ) |
| 45 | 45 | { |
| 46 | UINT8 new_level = ( cassette_input( | |
| 46 | UINT8 new_level = ( cassette_input( m | |
| 47 | 47 | |
| 48 | 48 | if ( new_level != cass_level ) |
| 49 | 49 | { |
| r8453 | r8454 | |
| 56 | 56 | MACHINE_RESET( cgenie ) |
| 57 | 57 | { |
| 58 | 58 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 59 | running_device *ay8910 = | |
| 59 | running_device *ay8910 = m | |
| 60 | 60 | UINT8 *ROM = memory_region(machine, "maincpu"); |
| 61 | 61 | |
| 62 | 62 | /* reset the AY8910 to be quiet, since the cgenie BIOS doesn't */ |
| r8453 | r8454 | |
| 153 | 153 | memset(gfx + i * 8, i, 8); |
| 154 | 154 | |
| 155 | 155 | /* set up RAM */ |
| 156 | memory_install_read_bank(space, 0x4000, 0x4000 + messram_get_size(devtag_get_device(machine, "messram")) - 1, 0, 0, "bank1"); | |
| 157 | memory_install_write8_handler(space, 0x4000, 0x4000 + messram_get_size(devtag_get_device(machine, "messram")) - 1, 0, 0, cgenie_videoram_w); | |
| 158 | machine->generic.videoram.u8 = messram_get_ptr(devtag_get_device(machine, "messram")); | |
| 159 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 156 | memory_install_read_bank(space, 0x4000, 0x4000 + messram_get_size(machine->device("messram")) - 1, 0, 0, "bank1"); | |
| 157 | memory_install_write8_handler(space, 0x4000, 0x4000 + messram_get_size(machine->device("messram")) - 1, 0, 0, cgenie_videoram_w); | |
| 158 | machine->generic.videoram.u8 = messram_get_ptr(machine->device("messram")); | |
| 159 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram"))); | |
| 160 | 160 | timer_pulse(machine, ATTOTIME_IN_HZ(11025), NULL, 0, handle_cassette_input ); |
| 161 | 161 | } |
| 162 | 162 | |
| r8453 | r8454 | |
| 181 | 181 | { |
| 182 | 182 | int port_ff_changed = port_ff ^ data; |
| 183 | 183 | |
| 184 | cassette_output ( | |
| 184 | cassette_output ( | |
| 185 | 185 | |
| 186 | 186 | /* background bits changed ? */ |
| 187 | 187 | if( port_ff_changed & FF_BGD ) |
| r8453 | r8454 | |
| 336 | 336 | |
| 337 | 337 | READ8_HANDLER( cgenie_status_r ) |
| 338 | 338 | { |
| 339 | running_device *fdc = | |
| 339 | running_device *fdc = | |
| 340 | 340 | /* If the floppy isn't emulated, return 0 */ |
| 341 | 341 | if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 ) |
| 342 | 342 | return 0; |
| r8453 | r8454 | |
| 345 | 345 | |
| 346 | 346 | READ8_HANDLER( cgenie_track_r ) |
| 347 | 347 | { |
| 348 | running_device *fdc = | |
| 348 | running_device *fdc = | |
| 349 | 349 | /* If the floppy isn't emulated, return 0xff */ |
| 350 | 350 | if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 ) |
| 351 | 351 | return 0xff; |
| r8453 | r8454 | |
| 354 | 354 | |
| 355 | 355 | READ8_HANDLER( cgenie_sector_r ) |
| 356 | 356 | { |
| 357 | running_device *fdc = | |
| 357 | running_device *fdc = | |
| 358 | 358 | /* If the floppy isn't emulated, return 0xff */ |
| 359 | 359 | if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 ) |
| 360 | 360 | return 0xff; |
| r8453 | r8454 | |
| 363 | 363 | |
| 364 | 364 | READ8_HANDLER(cgenie_data_r ) |
| 365 | 365 | { |
| 366 | running_device *fdc = | |
| 366 | running_device *fdc = | |
| 367 | 367 | /* If the floppy isn't emulated, return 0xff */ |
| 368 | 368 | if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 ) |
| 369 | 369 | return 0xff; |
| r8453 | r8454 | |
| 372 | 372 | |
| 373 | 373 | WRITE8_HANDLER( cgenie_command_w ) |
| 374 | 374 | { |
| 375 | running_device *fdc = | |
| 375 | running_device *fdc = | |
| 376 | 376 | /* If the floppy isn't emulated, return immediately */ |
| 377 | 377 | if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 ) |
| 378 | 378 | return; |
| r8453 | r8454 | |
| 381 | 381 | |
| 382 | 382 | WRITE8_HANDLER( cgenie_track_w ) |
| 383 | 383 | { |
| 384 | running_device *fdc = | |
| 384 | running_device *fdc = | |
| 385 | 385 | /* If the floppy isn't emulated, ignore the write */ |
| 386 | 386 | if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 ) |
| 387 | 387 | return; |
| r8453 | r8454 | |
| 390 | 390 | |
| 391 | 391 | WRITE8_HANDLER( cgenie_sector_w ) |
| 392 | 392 | { |
| 393 | running_device *fdc = | |
| 393 | running_device *fdc = | |
| 394 | 394 | /* If the floppy isn't emulated, ignore the write */ |
| 395 | 395 | if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 ) |
| 396 | 396 | return; |
| r8453 | r8454 | |
| 399 | 399 | |
| 400 | 400 | WRITE8_HANDLER( cgenie_data_w ) |
| 401 | 401 | { |
| 402 | running_device *fdc = | |
| 402 | running_device *fdc = | |
| 403 | 403 | /* If the floppy isn't emulated, ignore the write */ |
| 404 | 404 | if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 ) |
| 405 | 405 | return; |
| r8453 | r8454 | |
| 453 | 453 | |
| 454 | 454 | WRITE8_HANDLER( cgenie_motor_w ) |
| 455 | 455 | { |
| 456 | running_device *fdc = | |
| 456 | running_device *fdc = | |
| 457 | 457 | UINT8 drive = 255; |
| 458 | 458 | |
| 459 | 459 | logerror("cgenie motor_w $%02X\n", data); |
| r8453 | r8454 | |
|---|---|---|
| 16 | 16 | |
| 17 | 17 | static running_device *cassette_device_image(running_machine *machine) |
| 18 | 18 | { |
| 19 | return | |
| 19 | return m | |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | static UINT8 ondra_bank1_status; |
| r8453 | r8454 | |
| 47 | 47 | memory_set_bankptr(machine, "bank1", mem + 0x010000); |
| 48 | 48 | } else { |
| 49 | 49 | memory_install_write_bank(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, "bank1"); |
| 50 | memory_set_bankptr(machine, "bank1", messram_get_ptr( | |
| 50 | memory_set_bankptr(machine, "bank1", messram_get_ptr(m | |
| 51 | 51 | } |
| 52 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 52 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 53 | 53 | if (ondra_bank2_status==0) { |
| 54 | 54 | memory_install_readwrite_bank(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xe000, 0xffff, 0, 0, "bank3"); |
| 55 | memory_set_bankptr(machine, "bank3", messram_get_ptr( | |
| 55 | memory_set_bankptr(machine, "bank3", messram_get_ptr(m | |
| 56 | 56 | } else { |
| 57 | 57 | memory_unmap_write(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xe000, 0xffff, 0, 0); |
| 58 | 58 | memory_install_read8_handler (cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xe000, 0xffff, 0, 0, ondra_keyboard_r); |
| r8453 | r8454 | |
|---|---|---|
| 319 | 319 | |
| 320 | 320 | static TIMER_CALLBACK( kaypro_timer_callback ) |
| 321 | 321 | { |
| 322 | if (cpu_get_reg( | |
| 322 | if (cpu_get_reg(m | |
| 323 | 323 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, ASSERT_LINE); |
| 324 | 324 | } |
| 325 | 325 | |
| r8453 | r8454 | |
| 356 | 356 | ************************************************************/ |
| 357 | 357 | MACHINE_START( kayproii ) |
| 358 | 358 | { |
| 359 | kayproii_z80pio_g = devtag_get_device(machine, "z80pio_g"); | |
| 360 | kayproii_z80pio_s = devtag_get_device(machine, "z80pio_s"); | |
| 361 | kaypro_z80sio = devtag_get_device(machine, "z80sio"); | |
| 362 | kaypro_printer = devtag_get_device(machine, "centronics"); | |
| 363 | kaypro_fdc = devtag_get_device(machine, "wd1793"); | |
| 359 | kayproii_z80pio_g = machine->device("z80pio_g"); | |
| 360 | kayproii_z80pio_s = machine->device("z80pio_s"); | |
| 361 | kaypro_z80sio = machine->device("z80sio"); | |
| 362 | kaypro_printer = machine->device("centronics"); | |
| 363 | kaypro_fdc = machine->device("wd1793"); | |
| 364 | 364 | |
| 365 | 365 | z80pio_astb_w(kayproii_z80pio_s, 0); |
| 366 | 366 | } |
| r8453 | r8454 | |
| 372 | 372 | |
| 373 | 373 | MACHINE_START( kaypro2x ) |
| 374 | 374 | { |
| 375 | kaypro_z80sio = devtag_get_device(machine, "z80sio"); | |
| 376 | kaypro2x_z80sio = devtag_get_device(machine, "z80sio_2x"); | |
| 377 | kaypro_printer = devtag_get_device(machine, "centronics"); | |
| 378 | kaypro_fdc = devtag_get_device(machine, "wd1793"); | |
| 375 | kaypro_z80sio = machine->device("z80sio"); | |
| 376 | kaypro2x_z80sio = machine->device("z80sio_2x"); | |
| 377 | kaypro_printer = machine->device("centronics"); | |
| 378 | kaypro_fdc = machine->device("wd1793"); | |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | MACHINE_RESET( kaypro2x ) |
| r8453 | r8454 | |
| 398 | 398 | |
| 399 | 399 | QUICKLOAD_LOAD( kayproii ) |
| 400 | 400 | { |
| 401 | running_device *cpu = | |
| 401 | running_device *cpu = | |
| 402 | 402 | UINT8 *RAM = memory_region(image.device().machine, "rambank"); |
| 403 | 403 | UINT16 i; |
| 404 | 404 | UINT8 data; |
| r8453 | r8454 | |
| 425 | 425 | QUICKLOAD_LOAD( kaypro2x ) |
| 426 | 426 | { |
| 427 | 427 | const address_space *space = cputag_get_address_space(image.device().machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 428 | running_device *cpu = | |
| 428 | running_device *cpu = | |
| 429 | 429 | UINT8 *RAM = memory_region(image.device().machine, "rambank"); |
| 430 | 430 | UINT16 i; |
| 431 | 431 | UINT8 data; |
| r8453 | r8454 | |
|---|---|---|
| 222 | 222 | super80_shared=0xff; |
| 223 | 223 | timer_set(machine, ATTOTIME_IN_USEC(10), NULL, 0, super80_reset); |
| 224 | 224 | memory_set_bank(machine, "bank1", 1); |
| 225 | super80_z80pio = devtag_get_device(machine, "z80pio"); | |
| 226 | super80_speaker = devtag_get_device(machine, "speaker"); | |
| 227 | super80_cassette = devtag_get_device(machine, "cassette"); | |
| 228 | super80_printer = devtag_get_device(machine, "centronics"); | |
| 225 | super80_z80pio = machine->device("z80pio"); | |
| 226 | super80_speaker = machine->device("speaker"); | |
| 227 | super80_cassette = machine->device("cassette"); | |
| 228 | super80_printer = machine->device("centronics"); | |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | static void driver_init_common( running_machine *machine ) |
| r8453 | r8454 | |
|---|---|---|
| 123 | 123 | }; |
| 124 | 124 | |
| 125 | 125 | /* tms9995_ICount: used to implement memory waitstates (hack) */ |
| 126 | /* NPW 23-Feb-2004 - externs no longer needed because we now use cpu_adjust_icount( | |
| 126 | /* NPW 23-Feb-2004 - externs no longer needed because we now use cpu_adjust_icount( | |
| 127 | 127 | |
| 128 | 128 | enum |
| 129 | 129 | { |
| r8453 | r8454 | |
| 175 | 175 | /* reset cartridge mapper */ |
| 176 | 176 | cartridge_page = 0; |
| 177 | 177 | |
| 178 | expansion_box = | |
| 178 | expansion_box = m | |
| 179 | 179 | |
| 180 | 180 | v9938_reset(0); |
| 181 | 181 | |
| r8453 | r8454 | |
| 236 | 236 | ti99_usbsm_reset(machine, TRUE); |
| 237 | 237 | |
| 238 | 238 | /* reset CPU */ |
| 239 | | |
| 239 | m | |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /* |
| r8453 | r8454 | |
| 268 | 268 | */ |
| 269 | 269 | void inta_callback(running_machine *machine, int state) |
| 270 | 270 | { |
| 271 | tms9901_set_single_int( | |
| 271 | tms9901_set_single_int(m | |
| 272 | 272 | cputag_set_input_line(machine, "maincpu", 1, state ? ASSERT_LINE : CLEAR_LINE); |
| 273 | 273 | } |
| 274 | 274 | |
| r8453 | r8454 | |
| 277 | 277 | */ |
| 278 | 278 | void intb_callback(running_machine *machine, int state) |
| 279 | 279 | { |
| 280 | tms9901_set_single_int( | |
| 280 | tms9901_set_single_int(m | |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | |
| r8453 | r8454 | |
| 295 | 295 | */ |
| 296 | 296 | static READ8_HANDLER ( geneve_speech_r ) |
| 297 | 297 | { |
| 298 | cpu_adjust_icount( | |
| 298 | cpu_adjust_icount( | |
| 299 | 299 | |
| 300 | return tms5220_status_r( | |
| 300 | return tms5220_status_r( | |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | #if 0 |
| 304 | 304 | |
| 305 | 305 | static void speech_kludge_callback(int dummy) |
| 306 | 306 | { |
| 307 | if (! tms5220_readyq_r( | |
| 307 | if (! tms5220_readyq_r( | |
| 308 | 308 | { |
| 309 | 309 | /* Weirdly enough, we are always seeing some problems even though |
| 310 | 310 | everything is working fine. */ |
| r8453 | r8454 | |
| 323 | 323 | */ |
| 324 | 324 | static WRITE8_HANDLER ( geneve_speech_w ) |
| 325 | 325 | { |
| 326 | cpu_adjust_icount( | |
| 326 | cpu_adjust_icount( | |
| 327 | 327 | |
| 328 | 328 | #if 1 |
| 329 | 329 | /* the stupid design of the tms5220 core means that ready is cleared when |
| 330 | 330 | there are 15 bytes in FIFO. It should be 16. Of course, if it were the |
| 331 | 331 | case, we would need to store the value on the bus, which would be more |
| 332 | 332 | complex. */ |
| 333 | if (! tms5220_readyq_r( | |
| 333 | if (! tms5220_readyq_r( | |
| 334 | 334 | { |
| 335 | attotime time_to_ready = double_to_attotime(tms5220_time_to_ready( | |
| 335 | attotime time_to_ready = double_to_attotime(tms5220_time_to_ready( | |
| 336 | 336 | int cycles_to_ready = cputag_attotime_to_clocks(space->machine, "maincpu", time_to_ready); |
| 337 | 337 | |
| 338 | 338 | logerror("time to ready: %f -> %d\n", attotime_to_double(time_to_ready), (int) cycles_to_ready); |
| 339 | 339 | |
| 340 | cpu_adjust_icount( | |
| 340 | cpu_adjust_icount( | |
| 341 | 341 | timer_set(space->machine, attotime_zero, NULL, 0, /*speech_kludge_callback*/NULL); |
| 342 | 342 | } |
| 343 | 343 | #endif |
| 344 | 344 | |
| 345 | tms5220_data_w( | |
| 345 | tms5220_data_w( | |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | READ8_HANDLER ( geneve_r ) |
| r8453 | r8454 | |
| 399 | 399 | case 0xf13d: |
| 400 | 400 | case 0xf13e: |
| 401 | 401 | case 0xf13f: |
| 402 | return mm58274c_r( | |
| 402 | return mm58274c_r( | |
| 403 | 403 | |
| 404 | 404 | default: |
| 405 | 405 | logerror("unmapped read offs=%d\n", (int) offset); |
| r8453 | r8454 | |
| 445 | 445 | case 0x801d: |
| 446 | 446 | case 0x801e: |
| 447 | 447 | case 0x801f: |
| 448 | return mm58274c_r( | |
| 448 | return mm58274c_r( | |
| 449 | 449 | |
| 450 | 450 | default: |
| 451 | 451 | logerror("unmapped read offs=%d\n", (int) offset); |
| r8453 | r8454 | |
| 647 | 647 | #endif |
| 648 | 648 | |
| 649 | 649 | case 0xf120: |
| 650 | sn76496_w( | |
| 650 | sn76496_w( | |
| 651 | 651 | break; |
| 652 | 652 | |
| 653 | 653 | case 0xf130: |
| r8453 | r8454 | |
| 666 | 666 | case 0xf13d: |
| 667 | 667 | case 0xf13e: |
| 668 | 668 | case 0xf13f: |
| 669 | mm58274c_w( | |
| 669 | mm58274c_w( | |
| 670 | 670 | return; |
| 671 | 671 | |
| 672 | 672 | default: |
| r8453 | r8454 | |
| 717 | 717 | case 0x801d: |
| 718 | 718 | case 0x801e: |
| 719 | 719 | case 0x801f: |
| 720 | mm58274c_w( | |
| 720 | mm58274c_w( | |
| 721 | 721 | return; |
| 722 | 722 | |
| 723 | 723 | default: |
| r8453 | r8454 | |
| 733 | 733 | { |
| 734 | 734 | case 1: |
| 735 | 735 | /* sound write */ |
| 736 | sn76496_w( | |
| 736 | sn76496_w( | |
| 737 | 737 | return; |
| 738 | 738 | |
| 739 | 739 | case 3: |
| r8453 | r8454 | |
| 934 | 934 | KeyQueueLen--; |
| 935 | 935 | } |
| 936 | 936 | /* clear keyboard interrupt */ |
| 937 | tms9901_set_single_int( | |
| 937 | tms9901_set_single_int( | |
| 938 | 938 | KeyInBuf = 0; |
| 939 | 939 | } |
| 940 | 940 | } |
| r8453 | r8454 | |
| 955 | 955 | buffer clear is disabled, and key queue is not empty. */ |
| 956 | 956 | if ((! KeyReset) && (mode_flags & mf_keyclock) && (mode_flags & mf_keyclear) && KeyQueueLen) |
| 957 | 957 | { |
| 958 | tms9901_set_single_int( | |
| 958 | tms9901_set_single_int(m | |
| 959 | 959 | KeyInBuf = 1; |
| 960 | 960 | } |
| 961 | 961 | } |
| r8453 | r8454 | |
| 1268 | 1268 | #ifdef UNUSED_FUNCTION |
| 1269 | 1269 | void tms9901_set_int2(int state) |
| 1270 | 1270 | { |
| 1271 | tms9901_set_single_int( | |
| 1271 | tms9901_set_single_int(m | |
| 1272 | 1272 | } |
| 1273 | 1273 | #endif |
| 1274 | 1274 |
| r8453 | r8454 | |
|---|---|---|
| 316 | 316 | |
| 317 | 317 | /* find our WD179x */ |
| 318 | 318 | astring_printf(&tempstring, "%s:%s", device->tag(), "wd179x"); |
| 319 | beta->wd179x = dev | |
| 319 | beta->wd179x = dev | |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | /*------------------------------------------------- |
| r8453 | r8454 | |
|---|---|---|
| 215 | 215 | i82439tx_config *config = (i82439tx_config *)downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config(); |
| 216 | 216 | |
| 217 | 217 | /* get address space we are working on */ |
| 218 | running_device *cpu = dev | |
| 218 | running_device *cpu = dev | |
| 219 | 219 | assert(cpu != NULL); |
| 220 | 220 | |
| 221 | 221 | i82439tx->space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM); |
| r8453 | r8454 | |
|---|---|---|
| 31 | 31 | { |
| 32 | 32 | if (lviv_ppi_port_outputs[0][2] & 0x02) |
| 33 | 33 | { |
| 34 | memory_set_bankptr(machine,"bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 35 | memory_set_bankptr(machine,"bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 34 | memory_set_bankptr(machine,"bank1", messram_get_ptr(machine->device("messram"))); | |
| 35 | memory_set_bankptr(machine,"bank2", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 36 | 36 | } |
| 37 | 37 | else |
| 38 | 38 | { |
| 39 | memory_set_bankptr(machine,"bank1", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x8000); | |
| 40 | memory_set_bankptr(machine,"bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xc000); | |
| 39 | memory_set_bankptr(machine,"bank1", messram_get_ptr(machine->device("messram")) + 0x8000); | |
| 40 | memory_set_bankptr(machine,"bank2", messram_get_ptr(machine->device("messram")) + 0xc000); | |
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
| r8453 | r8454 | |
| 66 | 66 | static READ8_DEVICE_HANDLER ( lviv_ppi_0_portc_r ) |
| 67 | 67 | { |
| 68 | 68 | UINT8 data = lviv_ppi_port_outputs[0][2] & 0x0f; |
| 69 | if (cassette_input(dev | |
| 69 | if (cassette_input(dev | |
| 70 | 70 | data |= 0x10; |
| 71 | 71 | if (lviv_ppi_port_outputs[0][0] & input_port_read(device->machine, "JOY")) |
| 72 | 72 | data |= 0x80; |
| r8453 | r8454 | |
| 86 | 86 | |
| 87 | 87 | static WRITE8_DEVICE_HANDLER ( lviv_ppi_0_portc_w ) /* tape in/out, video memory on/off */ |
| 88 | 88 | { |
| 89 | running_device *speaker = dev | |
| 89 | running_device *speaker = dev | |
| 90 | 90 | lviv_ppi_port_outputs[0][2] = data; |
| 91 | 91 | if (lviv_ppi_port_outputs[0][1]&0x80) |
| 92 | 92 | speaker_level_w(speaker, data&0x01); |
| 93 | cassette_output(dev | |
| 93 | cassette_output(dev | |
| 94 | 94 | lviv_update_memory(device->machine); |
| 95 | 95 | } |
| 96 | 96 | |
| r8453 | r8454 | |
| 147 | 147 | switch ((offset >> 4) & 0x3) |
| 148 | 148 | { |
| 149 | 149 | case 0: |
| 150 | return i8255a_r( | |
| 150 | return i8255a_r( | |
| 151 | 151 | |
| 152 | 152 | case 1: |
| 153 | return i8255a_r( | |
| 153 | return i8255a_r( | |
| 154 | 154 | |
| 155 | 155 | case 2: |
| 156 | 156 | case 3: |
| r8453 | r8454 | |
| 173 | 173 | memory_install_write_bank(cpuspace, 0x8000, 0xbfff, 0, 0, "bank3"); |
| 174 | 174 | memory_unmap_write(cpuspace, 0xC000, 0xffff, 0, 0); |
| 175 | 175 | |
| 176 | memory_set_bankptr(space->machine,"bank1", messram_get_ptr(devtag_get_device(space->machine, "messram"))); | |
| 177 | memory_set_bankptr(space->machine,"bank2", messram_get_ptr(devtag_get_device(space->machine, "messram")) + 0x4000); | |
| 178 | memory_set_bankptr(space->machine,"bank3", messram_get_ptr(devtag_get_device(space->machine, "messram")) + 0x8000); | |
| 176 | memory_set_bankptr(space->machine,"bank1", messram_get_ptr(space->machine->device("messram"))); | |
| 177 | memory_set_bankptr(space->machine,"bank2", messram_get_ptr(space->machine->device("messram")) + 0x4000); | |
| 178 | memory_set_bankptr(space->machine,"bank3", messram_get_ptr(space->machine->device("messram")) + 0x8000); | |
| 179 | 179 | memory_set_bankptr(space->machine,"bank4", memory_region(space->machine, "maincpu") + 0x010000); |
| 180 | 180 | } |
| 181 | 181 | else |
| r8453 | r8454 | |
| 183 | 183 | switch ((offset >> 4) & 0x3) |
| 184 | 184 | { |
| 185 | 185 | case 0: |
| 186 | i8255a_w( | |
| 186 | i8255a_w( | |
| 187 | 187 | break; |
| 188 | 188 | |
| 189 | 189 | case 1: |
| 190 | i8255a_w( | |
| 190 | i8255a_w( | |
| 191 | 191 | break; |
| 192 | 192 | |
| 193 | 193 | case 2: |
| r8453 | r8454 | |
| 224 | 224 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 225 | 225 | memory_set_direct_update_handler(space, lviv_directoverride); |
| 226 | 226 | |
| 227 | lviv_video_ram = messram_get_ptr( | |
| 227 | lviv_video_ram = messram_get_ptr(m | |
| 228 | 228 | |
| 229 | 229 | startup_mem_map = 1; |
| 230 | 230 | |
| r8453 | r8454 | |
| 240 | 240 | |
| 241 | 241 | /*timer_pulse(machine, TIME_IN_NSEC(200), NULL, 0, lviv_draw_pixel);*/ |
| 242 | 242 | |
| 243 | /*memset(messram_get_ptr( | |
| 243 | /*memset(messram_get_ptr(m | |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | |
| r8453 | r8454 | |
| 266 | 266 | /* Set registers */ |
| 267 | 267 | lo = data[0x14112] & 0x0ff; |
| 268 | 268 | hi = data[0x14111] & 0x0ff; |
| 269 | cpu_set_reg( | |
| 269 | cpu_set_reg(m | |
| 270 | 270 | lo = data[0x14114] & 0x0ff; |
| 271 | 271 | hi = data[0x14113] & 0x0ff; |
| 272 | cpu_set_reg( | |
| 272 | cpu_set_reg(m | |
| 273 | 273 | lo = data[0x14116] & 0x0ff; |
| 274 | 274 | hi = data[0x14115] & 0x0ff; |
| 275 | cpu_set_reg( | |
| 275 | cpu_set_reg(m | |
| 276 | 276 | lo = data[0x14118] & 0x0ff; |
| 277 | 277 | hi = data[0x14117] & 0x0ff; |
| 278 | cpu_set_reg( | |
| 278 | cpu_set_reg(m | |
| 279 | 279 | lo = data[0x14119] & 0x0ff; |
| 280 | 280 | hi = data[0x1411a] & 0x0ff; |
| 281 | cpu_set_reg( | |
| 281 | cpu_set_reg(m | |
| 282 | 282 | lo = data[0x1411b] & 0x0ff; |
| 283 | 283 | hi = data[0x1411c] & 0x0ff; |
| 284 | cpu_set_reg( | |
| 284 | cpu_set_reg(m | |
| 285 | 285 | |
| 286 | 286 | /* Memory dump */ |
| 287 | memcpy (messram_get_ptr(devtag_get_device(machine, "messram")), data+0x0011, 0xc000); | |
| 288 | memcpy (messram_get_ptr(devtag_get_device(machine, "messram"))+0xc000, data+0x10011, 0x4000); | |
| 287 | memcpy (messram_get_ptr(machine->device("messram")), data+0x0011, 0xc000); | |
| 288 | memcpy (messram_get_ptr(machine->device("messram"))+0xc000, data+0x10011, 0x4000); | |
| 289 | 289 | |
| 290 | 290 | /* Ports */ |
| 291 | 291 | lviv_ppi_port_outputs[0][0] = data[0x14011+0xc0]; |
| r8453 | r8454 | |
| 297 | 297 | |
| 298 | 298 | static void dump_registers(running_machine *machine) |
| 299 | 299 | { |
| 300 | logerror("PC = %04x\n", (unsigned) cpu_get_reg(devtag_get_device(machine, "maincpu"), I8085_PC)); | |
| 301 | logerror("SP = %04x\n", (unsigned) cpu_get_reg(devtag_get_device(machine, "maincpu"), I8085_SP)); | |
| 302 | logerror("AF = %04x\n", (unsigned) cpu_get_reg(devtag_get_device(machine, "maincpu"), I8085_AF)); | |
| 303 | logerror("BC = %04x\n", (unsigned) cpu_get_reg(devtag_get_device(machine, "maincpu"), I8085_BC)); | |
| 304 | logerror("DE = %04x\n", (unsigned) cpu_get_reg(devtag_get_device(machine, "maincpu"), I8085_DE)); | |
| 305 | logerror("HL = %04x\n", (unsigned) cpu_get_reg(devtag_get_device(machine, "maincpu"), I8085_HL)); | |
| 300 | logerror("PC = %04x\n", (unsigned) cpu_get_reg(machine->device("maincpu"), I8085_PC)); | |
| 301 | logerror("SP = %04x\n", (unsigned) cpu_get_reg(machine->device("maincpu"), I8085_SP)); | |
| 302 | logerror("AF = %04x\n", (unsigned) cpu_get_reg(machine->device("maincpu"), I8085_AF)); | |
| 303 | logerror("BC = %04x\n", (unsigned) cpu_get_reg(machine->device("maincpu"), I8085_BC)); | |
| 304 | logerror("DE = %04x\n", (unsigned) cpu_get_reg(machine->device("maincpu"), I8085_DE)); | |
| 305 | logerror("HL = %04x\n", (unsigned) cpu_get_reg(machine->device("maincpu"), I8085_HL)); | |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | static int lviv_verify_snapshot (UINT8 * data, UINT32 size) |
| r8453 | r8454 | |
|---|---|---|
| 50 | 50 | static running_device *cassette_device_image(running_machine *machine) |
| 51 | 51 | { |
| 52 | 52 | if (exidy_fe & 0x20) |
| 53 | return | |
| 53 | return m | |
| 54 | 54 | else |
| 55 | return | |
| 55 | return m | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
| r8453 | r8454 | |
| 203 | 203 | { |
| 204 | 204 | if (data & 0x20) |
| 205 | 205 | { |
| 206 | cassette_change_state(devtag_get_device(space->machine, "cassette1"), CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER); | |
| 207 | cassette_change_state(devtag_get_device(space->machine, "cassette2"), CASSETTE_SPEAKER_ENABLED, CASSETTE_MASK_SPEAKER); | |
| 206 | cassette_change_state(space->machine->device("cassette1"), CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER); | |
| 207 | cassette_change_state(space->machine->device("cassette2"), CASSETTE_SPEAKER_ENABLED, CASSETTE_MASK_SPEAKER); | |
| 208 | 208 | } |
| 209 | 209 | else |
| 210 | 210 | { |
| 211 | cassette_change_state(devtag_get_device(space->machine, "cassette2"), CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER); | |
| 212 | cassette_change_state(devtag_get_device(space->machine, "cassette1"), CASSETTE_SPEAKER_ENABLED, CASSETTE_MASK_SPEAKER); | |
| 211 | cassette_change_state(space->machine->device("cassette2"), CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER); | |
| 212 | cassette_change_state(space->machine->device("cassette1"), CASSETTE_SPEAKER_ENABLED, CASSETTE_MASK_SPEAKER); | |
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | else |
| 216 | 216 | { |
| 217 | cassette_change_state(devtag_get_device(space->machine, "cassette2"), CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER); | |
| 218 | cassette_change_state(devtag_get_device(space->machine, "cassette1"), CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER); | |
| 217 | cassette_change_state(space->machine->device("cassette2"), CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER); | |
| 218 | cassette_change_state(space->machine->device("cassette1"), CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER); | |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | /* cassette 1 motor */ |
| 222 | cassette_change_state( | |
| 222 | cassette_change_state( | |
| 223 | 223 | (data & 0x10) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); |
| 224 | 224 | |
| 225 | 225 | /* cassette 2 motor */ |
| 226 | cassette_change_state( | |
| 226 | cassette_change_state( | |
| 227 | 227 | (data & 0x20) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); |
| 228 | 228 | |
| 229 | 229 | if ((data & EXIDY_CASSETTE_MOTOR_MASK) && (~data & 0x80)) |
| r8453 | r8454 | |
| 256 | 256 | |
| 257 | 257 | WRITE8_HANDLER(exidy_ff_w) |
| 258 | 258 | { |
| 259 | running_device *printer = devtag_get_device(space->machine, "centronics"); | |
| 260 | running_device *dac_device = devtag_get_device(space->machine, "dac"); | |
| 259 | running_device *printer = space->machine->device("centronics"); | |
| 260 | running_device *dac_device = space->machine->device("dac"); | |
| 261 | 261 | /* reading the config switch */ |
| 262 | 262 | switch (input_port_read(space->machine, "CONFIG") & 0x06) |
| 263 | 263 | { |
| r8453 | r8454 | |
| 333 | 333 | This uses bit 7. The other bits have been set high (=nothing plugged in). |
| 334 | 334 | This fixes those games that use a joystick. */ |
| 335 | 335 | |
| 336 | running_device *printer = | |
| 336 | running_device *printer = | |
| 337 | 337 | UINT8 data=0x7f; |
| 338 | 338 | |
| 339 | 339 | /* bit 7 = printer busy |
| r8453 | r8454 | |
| 386 | 386 | if ((execute_address != 0xc858) && autorun) |
| 387 | 387 | memory_write_word_16le(space, 0xf028, execute_address); |
| 388 | 388 | |
| 389 | cpu_set_reg( | |
| 389 | cpu_set_reg(m | |
| 390 | 390 | } |
| 391 | 391 | else |
| 392 | 392 | { |
| 393 | 393 | if (autorun) |
| 394 | cpu_set_reg( | |
| 394 | cpu_set_reg(m | |
| 395 | 395 | } |
| 396 | 396 | } |
| 397 | 397 | |
| r8453 | r8454 | |
| 402 | 402 | SNAPSHOT_LOAD(exidy) |
| 403 | 403 | { |
| 404 | 404 | UINT8 *ptr = memory_region(image.device().machine, "maincpu"); |
| 405 | running_device *cpu = | |
| 405 | running_device *cpu = | |
| 406 | 406 | UINT8 header[28]; |
| 407 | 407 | |
| 408 | 408 | /* check size */ |
| r8453 | r8454 | |
| 457 | 457 | cass_data.input.length = 0; |
| 458 | 458 | cass_data.input.bit = 1; |
| 459 | 459 | |
| 460 | exidy_ay31015 = | |
| 460 | exidy_ay31015 = m | |
| 461 | 461 | |
| 462 | 462 | exidy_fe_w(space, 0, 0); |
| 463 | 463 |
| r8453 | r8454 | |
|---|---|---|
| 130 | 130 | interrupt_level_reg = 0; |
| 131 | 131 | interrupt_mask_reg = 0xf8; |
| 132 | 132 | interrupt_trig_reg = 0x0; |
| 133 | cpu_set_irq_callback( | |
| 133 | cpu_set_irq_callback(m | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | WRITE8_HANDLER( pc88sr_outport_30 ) |
| r8453 | r8454 | |
| 144 | 144 | /* bit 3,4,6 not implemented */ |
| 145 | 145 | /* bit 7 incorrect behavior */ |
| 146 | 146 | pc88_state *state = (pc88_state *)space->machine->driver_data; |
| 147 | running_device *speaker = | |
| 147 | running_device *speaker = | |
| 148 | 148 | |
| 149 | 149 | /* printer */ |
| 150 | 150 | centronics_strobe_w(state->centronics, BIT(data, 0)); |
| r8453 | r8454 | |
| 651 | 651 | |
| 652 | 652 | static void pc88sr_ch_reset(running_machine *machine, int hireso) |
| 653 | 653 | { |
| 654 | running_device *speaker = | |
| 654 | running_device *speaker = m | |
| 655 | 655 | int a; |
| 656 | 656 | |
| 657 | 657 | // old code was allocating/freeing a smaller region depending on the "MEM" config, |
| r8453 | r8454 | |
| 759 | 759 | else |
| 760 | 760 | cputag_resume(machine, "sub", SUSPEND_REASON_DISABLE); |
| 761 | 761 | |
| 762 | cpu_set_input_line_vector( | |
| 762 | cpu_set_input_line_vector(m | |
| 763 | 763 | |
| 764 | 764 | floppy_mon_w(floppy_get_device(machine, 0), CLEAR_LINE); |
| 765 | 765 | floppy_mon_w(floppy_get_device(machine, 1), CLEAR_LINE); |
| r8453 | r8454 | |
| 847 | 847 | pc88_state *state = (pc88_state *)machine->driver_data; |
| 848 | 848 | |
| 849 | 849 | /* find devices */ |
| 850 | state->upd765 = devtag_get_device(machine, UPD765_TAG); | |
| 851 | state->upd1990a = devtag_get_device(machine, UPD1990A_TAG); | |
| 852 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 853 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); | |
| 850 | state->upd765 = machine->device(UPD765_TAG); | |
| 851 | state->upd1990a = machine->device(UPD1990A_TAG); | |
| 852 | state->cassette = machine->device(CASSETTE_TAG); | |
| 853 | state->centronics = machine->device(CENTRONICS_TAG); | |
| 854 | 854 | |
| 855 | 855 | /* initialize RTC */ |
| 856 | 856 | upd1990a_cs_w(state->upd1990a, 1); |
| r8453 | r8454 | |
|---|---|---|
| 84 | 84 | acia6551_t *acia; |
| 85 | 85 | |
| 86 | 86 | /* NPW 29-Nov-2008 - These two lines are a hack and indicate why our "serial" infrastructure needs to be updated */ |
| 87 | device = | |
| 87 | device = m | |
| 88 | 88 | acia = get_token(device); |
| 89 | 89 | |
| 90 | 90 | acia->connection.input_state = state; |
| r8453 | r8454 | |
|---|---|---|
| 211 | 211 | pcode_GROMs.addr = 0; |
| 212 | 212 | pcode_GROMs.data_ptr = ti99_pcode_grom; |
| 213 | 213 | |
| 214 | expansion_box = | |
| 214 | expansion_box = m | |
| 215 | 215 | |
| 216 | 216 | ti99_peb_set_card_handlers(expansion_box, 0x1f00, &pcode_handlers); |
| 217 | 217 | } |
| r8453 | r8454 | |
|---|---|---|
| 127 | 127 | void pc1403_outc(running_device *device, int data) |
| 128 | 128 | { |
| 129 | 129 | pc1403_portc = data; |
| 130 | // logerror("%g pc %.4x outc %.2x\n", attotime_to_double(timer_get_time(device->machine)), cpu_get_pc(dev | |
| 130 | // logerror("%g pc %.4x outc %.2x\n", attotime_to_double(timer_get_time(device->machine)), cpu_get_pc(dev | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | |
| r8453 | r8454 | |
| 144 | 144 | /* currently enough to save the external ram */ |
| 145 | 145 | NVRAM_HANDLER( pc1403 ) |
| 146 | 146 | { |
| 147 | running_device *main_cpu = | |
| 147 | running_device *main_cpu = m | |
| 148 | 148 | UINT8 *ram = memory_region(machine, "maincpu") + 0x8000; |
| 149 | 149 | UINT8 *cpu = sc61860_internal_ram(main_cpu); |
| 150 | 150 |
| r8453 | r8454 | |
|---|---|---|
| 30 | 30 | static void mc68328_set_interrupt_line(running_device *device, UINT32 line, UINT32 active) |
| 31 | 31 | { |
| 32 | 32 | mc68328_t* mc68328 = mc68328_get_safe_token( device ); |
| 33 | running_device *cpu = dev | |
| 33 | running_device *cpu = dev | |
| 34 | 34 | |
| 35 | 35 | if(active) |
| 36 | 36 | { |
| r8453 | r8454 | |
| 263 | 263 | |
| 264 | 264 | static TIMER_CALLBACK( mc68328_timer1_hit ) |
| 265 | 265 | { |
| 266 | running_device *device = | |
| 266 | running_device *device = m | |
| 267 | 267 | |
| 268 | 268 | mc68328_timer_compare_event(device, 0); |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | static TIMER_CALLBACK( mc68328_timer2_hit ) |
| 272 | 272 | { |
| 273 | running_device *device = | |
| 273 | running_device *device = m | |
| 274 | 274 | |
| 275 | 275 | mc68328_timer_compare_event(device, 1); |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | static TIMER_CALLBACK( mc68328_pwm_transition ) |
| 279 | 279 | { |
| 280 | running_device *device = | |
| 280 | running_device *device = m | |
| 281 | 281 | mc68328_t* mc68328 = mc68328_get_safe_token( device ); |
| 282 | 282 | |
| 283 | 283 | if(mc68328->regs.pwmw >= mc68328->regs.pwmp || mc68328->regs.pwmw == 0 || mc68328->regs.pwmp == 0) |
| r8453 | r8454 | |
| 325 | 325 | |
| 326 | 326 | static TIMER_CALLBACK( mc68328_rtc_tick ) |
| 327 | 327 | { |
| 328 | running_device *device = | |
| 328 | running_device *device = m | |
| 329 | 329 | mc68328_t* mc68328 = mc68328_get_safe_token( device ); |
| 330 | 330 | |
| 331 | 331 | if(mc68328->regs.rtcctl & RTCCTL_ENABLE) |
| r8453 | r8454 | |
|---|---|---|
| 44 | 44 | |
| 45 | 45 | MACHINE_START( partner ) |
| 46 | 46 | { |
| 47 | running_device *fdc = | |
| 47 | running_device *fdc = m | |
| 48 | 48 | wd17xx_set_pause_time(fdc, 10); |
| 49 | 49 | } |
| 50 | 50 | |
| r8453 | r8454 | |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | static READ8_HANDLER ( partner_floppy_r ) { |
| 83 | running_device *fdc = | |
| 83 | running_device *fdc = | |
| 84 | 84 | |
| 85 | 85 | if (offset<0x100) { |
| 86 | 86 | switch(offset & 3) { |
| r8453 | r8454 | |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | static WRITE8_HANDLER ( partner_floppy_w ) { |
| 99 | running_device *fdc = | |
| 99 | running_device *fdc = | |
| 100 | 100 | |
| 101 | 101 | if (offset<0x100) { |
| 102 | 102 | switch(offset & 3) { |
| r8453 | r8454 | |
| 159 | 159 | memory_set_bankptr(machine, "bank1", rom + 0x10000); |
| 160 | 160 | } else { |
| 161 | 161 | if (partner_mem_page==7) { |
| 162 | memory_set_bankptr(machine, "bank1", messram_get_ptr( | |
| 162 | memory_set_bankptr(machine, "bank1", messram_get_ptr(m | |
| 163 | 163 | } else { |
| 164 | memory_set_bankptr(machine, "bank1", messram_get_ptr( | |
| 164 | memory_set_bankptr(machine, "bank1", messram_get_ptr(m | |
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | // BANK 2 (0x0800 - 0x3fff) |
| 169 | 169 | if (partner_mem_page==7) { |
| 170 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 170 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 171 | 171 | } else { |
| 172 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 172 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | // BANK 3 (0x4000 - 0x5fff) |
| 176 | 176 | if (partner_mem_page==7) { |
| 177 | memory_set_bankptr(machine, "bank3", messram_get_ptr( | |
| 177 | memory_set_bankptr(machine, "bank3", messram_get_ptr(m | |
| 178 | 178 | } else { |
| 179 | 179 | if (partner_mem_page==10) { |
| 180 | 180 | //window 1 |
| 181 | 181 | memory_unmap_write(space, 0x4000, 0x5fff, 0, 0); |
| 182 | 182 | partner_window_1(machine, 3, 0, rom); |
| 183 | 183 | } else { |
| 184 | memory_set_bankptr(machine, "bank3", messram_get_ptr( | |
| 184 | memory_set_bankptr(machine, "bank3", messram_get_ptr(m | |
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | // BANK 4 (0x6000 - 0x7fff) |
| 189 | 189 | if (partner_mem_page==7) { |
| 190 | memory_set_bankptr(machine, "bank4", messram_get_ptr( | |
| 190 | memory_set_bankptr(machine, "bank4", messram_get_ptr(m | |
| 191 | 191 | } else { |
| 192 | memory_set_bankptr(machine, "bank4", messram_get_ptr( | |
| 192 | memory_set_bankptr(machine, "bank4", messram_get_ptr(m | |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | // BANK 5 (0x8000 - 0x9fff) |
| r8453 | r8454 | |
| 207 | 207 | partner_window_1(machine, 5, 0, rom); |
| 208 | 208 | break; |
| 209 | 209 | case 7: |
| 210 | memory_set_bankptr(machine, "bank5", messram_get_ptr( | |
| 210 | memory_set_bankptr(machine, "bank5", messram_get_ptr(m | |
| 211 | 211 | break; |
| 212 | 212 | default: |
| 213 | memory_set_bankptr(machine, "bank5", messram_get_ptr( | |
| 213 | memory_set_bankptr(machine, "bank5", messram_get_ptr(m | |
| 214 | 214 | break; |
| 215 | 215 | } |
| 216 | 216 | |
| r8453 | r8454 | |
| 229 | 229 | memory_set_bankptr(machine, "bank6", rom + 0x12000); // BASIC |
| 230 | 230 | break; |
| 231 | 231 | case 7: |
| 232 | memory_set_bankptr(machine, "bank6", messram_get_ptr( | |
| 232 | memory_set_bankptr(machine, "bank6", messram_get_ptr(m | |
| 233 | 233 | break; |
| 234 | 234 | default: |
| 235 | memory_set_bankptr(machine, "bank6", messram_get_ptr( | |
| 235 | memory_set_bankptr(machine, "bank6", messram_get_ptr(m | |
| 236 | 236 | break; |
| 237 | 237 | } |
| 238 | 238 | |
| r8453 | r8454 | |
| 252 | 252 | memory_set_bankptr(machine, "bank7", rom + 0x13800); // BASIC |
| 253 | 253 | break; |
| 254 | 254 | case 7: |
| 255 | memory_set_bankptr(machine, "bank7", messram_get_ptr( | |
| 255 | memory_set_bankptr(machine, "bank7", messram_get_ptr(m | |
| 256 | 256 | break; |
| 257 | 257 | default: |
| 258 | memory_set_bankptr(machine, "bank7", messram_get_ptr( | |
| 258 | memory_set_bankptr(machine, "bank7", messram_get_ptr(m | |
| 259 | 259 | break; |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | // BANK 8 (0xc000 - 0xc7ff) |
| 263 | 263 | switch (partner_mem_page) { |
| 264 | 264 | case 7: |
| 265 | memory_set_bankptr(machine, "bank8", messram_get_ptr( | |
| 265 | memory_set_bankptr(machine, "bank8", messram_get_ptr(m | |
| 266 | 266 | break; |
| 267 | 267 | case 8: |
| 268 | 268 | case 10: |
| r8453 | r8454 | |
| 270 | 270 | memory_set_bankptr(machine, "bank8", rom + 0x10000); |
| 271 | 271 | break; |
| 272 | 272 | default: |
| 273 | memory_set_bankptr(machine, "bank8", messram_get_ptr( | |
| 273 | memory_set_bankptr(machine, "bank8", messram_get_ptr(m | |
| 274 | 274 | break; |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | // BANK 9 (0xc800 - 0xcfff) |
| 278 | 278 | switch (partner_mem_page) { |
| 279 | 279 | case 7: |
| 280 | memory_set_bankptr(machine, "bank9", messram_get_ptr( | |
| 280 | memory_set_bankptr(machine, "bank9", messram_get_ptr(m | |
| 281 | 281 | break; |
| 282 | 282 | case 8: |
| 283 | 283 | case 9: |
| r8453 | r8454 | |
| 290 | 290 | memory_set_bankptr(machine, "bank9", rom + 0x10800); |
| 291 | 291 | break; |
| 292 | 292 | default: |
| 293 | memory_set_bankptr(machine, "bank9", messram_get_ptr( | |
| 293 | memory_set_bankptr(machine, "bank9", messram_get_ptr(m | |
| 294 | 294 | break; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | // BANK 10 (0xd000 - 0xd7ff) |
| 298 | 298 | switch (partner_mem_page) { |
| 299 | 299 | case 7: |
| 300 | memory_set_bankptr(machine, "bank10", messram_get_ptr( | |
| 300 | memory_set_bankptr(machine, "bank10", messram_get_ptr(m | |
| 301 | 301 | break; |
| 302 | 302 | case 8: |
| 303 | 303 | case 9: |
| r8453 | r8454 | |
| 306 | 306 | partner_window_2(machine, 10, 0x0800, rom); |
| 307 | 307 | break; |
| 308 | 308 | default: |
| 309 | memory_set_bankptr(machine, "bank10", messram_get_ptr( | |
| 309 | memory_set_bankptr(machine, "bank10", messram_get_ptr(m | |
| 310 | 310 | break; |
| 311 | 311 | } |
| 312 | 312 |
| r8453 | r8454 | |
|---|---|---|
| 147 | 147 | { |
| 148 | 148 | const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 149 | 149 | /* Set up the handlers for MESS's dynamically-sized RAM. */ |
| 150 | memory_install_readwrite_bank(space,0x0000, messram_get_size(devtag_get_device(machine, "messram")) - 1, 0, 0, "bank1"); | |
| 151 | memory_set_bankptr(machine,"bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 150 | memory_install_readwrite_bank(space,0x0000, messram_get_size(machine->device("messram")) - 1, 0, 0, "bank1"); | |
| 151 | memory_set_bankptr(machine,"bank1", messram_get_ptr(machine->device("messram"))); | |
| 152 | 152 | |
| 153 | 153 | /* Poll the keyboard input ports periodically. These include both |
| 154 | 154 | ordinary keys and the RESET and CLEAR SCREEN pushbutton |
| r8453 | r8454 | |
| 245 | 245 | |
| 246 | 246 | end_addr = start_addr + datasize - 1; |
| 247 | 247 | |
| 248 | if ((start_addr < 0xE000 && end_addr > messram_get_size( | |
| 248 | if ((start_addr < 0xE000 && end_addr > messram_get_size( | |
| 249 | 249 | || end_addr > 0xEFFF) |
| 250 | 250 | { |
| 251 | 251 | logerror("apple1 - Snapshot won't fit in this memory configuration;\n" |
| r8453 | r8454 | |
| 283 | 283 | int port, bit; |
| 284 | 284 | int key_pressed; |
| 285 | 285 | UINT32 shiftkeys, ctrlkeys; |
| 286 | running_device *pia = | |
| 286 | running_device *pia = m | |
| 287 | 287 | static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3" }; |
| 288 | 288 | |
| 289 | 289 | /* This holds the values of all the input ports for ordinary keys |
| r8453 | r8454 | |
| 375 | 375 | |
| 376 | 376 | static TIMER_CALLBACK(apple1_kbd_strobe_end) |
| 377 | 377 | { |
| 378 | running_device *pia = | |
| 378 | running_device *pia = m | |
| 379 | 379 | |
| 380 | 380 | /* End of the keyboard strobe pulse. */ |
| 381 | 381 | pia6821_ca1_w(pia, 0, 0); |
| r8453 | r8454 | |
| 419 | 419 | |
| 420 | 420 | static TIMER_CALLBACK(apple1_dsp_ready_start) |
| 421 | 421 | { |
| 422 | running_device *pia = | |
| 422 | running_device *pia = m | |
| 423 | 423 | |
| 424 | 424 | /* When the display asserts \RDA to signal it is ready, it |
| 425 | 425 | triggers a 74123 one-shot to send a 3.5-usec low pulse to PIA |
| r8453 | r8454 | |
| 431 | 431 | |
| 432 | 432 | static TIMER_CALLBACK(apple1_dsp_ready_end) |
| 433 | 433 | { |
| 434 | running_device *pia = | |
| 434 | running_device *pia = m | |
| 435 | 435 | |
| 436 | 436 | /* The one-shot pulse has ended; return CB1 to high, so we can do |
| 437 | 437 | another display write. */ |
| r8453 | r8454 | |
| 493 | 493 | |
| 494 | 494 | static running_device *cassette_device_image(running_machine *machine) |
| 495 | 495 | { |
| 496 | return | |
| 496 | return m | |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | /* The cassette output signal for writing tapes is generated by a |
| r8453 | r8454 | |
|---|---|---|
| 109 | 109 | */ |
| 110 | 110 | void ti99_ide_reset(running_machine *machine, int in_tms9995_mode) |
| 111 | 111 | { |
| 112 | expansion_box = | |
| 112 | expansion_box = m | |
| 113 | 113 | ti99_peb_set_card_handlers(expansion_box, 0x1000, & ide_handlers); |
| 114 | 114 | |
| 115 | 115 | cur_page = 0; |
| r8453 | r8454 | |
| 187 | 187 | static READ8_HANDLER(ide_mem_r) |
| 188 | 188 | { |
| 189 | 189 | int reply = 0; |
| 190 | running_device *ide_rtc = | |
| 190 | running_device *ide_rtc = | |
| 191 | 191 | |
| 192 | 192 | if ((offset <= 0xff) && (sram_enable == sram_enable_dip)) |
| 193 | 193 | { /* registers */ |
| r8453 | r8454 | |
| 212 | 212 | case 2: /* IDE registers set 1 (CS1Fx) */ |
| 213 | 213 | if (tms9995_mode ? (!(offset & 1)) : (offset & 1)) |
| 214 | 214 | { /* first read triggers 16-bit read cycle */ |
| 215 | running_device *ide_device = | |
| 215 | running_device *ide_device = | |
| 216 | 216 | input_latch = (! (offset & 0x10)) ? ide_bus_r(ide_device, 0, (offset >> 1) & 0x7) : 0; |
| 217 | 217 | } |
| 218 | 218 | |
| r8453 | r8454 | |
| 224 | 224 | case 3: /* IDE registers set 2 (CS3Fx) */ |
| 225 | 225 | if (tms9995_mode ? (!(offset & 1)) : (offset & 1)) |
| 226 | 226 | { /* first read triggers 16-bit read cycle */ |
| 227 | running_device *ide_device = | |
| 227 | running_device *ide_device = | |
| 228 | 228 | input_latch = (! (offset & 0x10)) ? ide_bus_r(ide_device, 1, (offset >> 1) & 0x7) : 0; |
| 229 | 229 | } |
| 230 | 230 | |
| r8453 | r8454 | |
| 251 | 251 | */ |
| 252 | 252 | static WRITE8_HANDLER(ide_mem_w) |
| 253 | 253 | { |
| 254 | running_device *ide_rtc = | |
| 254 | running_device *ide_rtc = | |
| 255 | 255 | |
| 256 | 256 | if (cru_register & cru_reg_page_switching) |
| 257 | 257 | { |
| r8453 | r8454 | |
| 294 | 294 | |
| 295 | 295 | if (tms9995_mode ? (offset & 1) : (!(offset & 1))) |
| 296 | 296 | { /* second write triggers 16-bit write cycle */ |
| 297 | running_device *ide_device = | |
| 297 | running_device *ide_device = | |
| 298 | 298 | ide_bus_w(ide_device, 0, (offset >> 1) & 0x7, output_latch); |
| 299 | 299 | } |
| 300 | 300 | break; |
| r8453 | r8454 | |
| 314 | 314 | |
| 315 | 315 | if (tms9995_mode ? (offset & 1) : (!(offset & 1))) |
| 316 | 316 | { /* second write triggers 16-bit write cycle */ |
| 317 | running_device *ide_device = | |
| 317 | running_device *ide_device = | |
| 318 | 318 | ide_bus_w(ide_device, 1, (offset >> 1) & 0x7, output_latch); |
| 319 | 319 | } |
| 320 | 320 | break; |
| r8453 | r8454 | |
|---|---|---|
| 296 | 296 | } |
| 297 | 297 | WRITE8_HANDLER( hector_color_b_w ) |
| 298 | 298 | { |
| 299 | running_device *discrete = | |
| 299 | running_device *discrete = | |
| 300 | 300 | hector_color[1] = data & 0x07; |
| 301 | 301 | hector_color[3] = (data >> 3) & 0x07; |
| 302 | 302 | |
| r8453 | r8454 | |
| 314 | 314 | |
| 315 | 315 | static running_device *cassette_device_image(running_machine *machine) |
| 316 | 316 | { |
| 317 | return | |
| 317 | return m | |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | |
| r8453 | r8454 | |
| 329 | 329 | WRITE8_HANDLER( hector_mx40_io_port_w) |
| 330 | 330 | { |
| 331 | 331 | if ((offset &0x0ff) == 0xf0) /* Port A => to printer*/ |
| 332 | printer_output( | |
| 332 | printer_output( | |
| 333 | 333 | if ((offset &0x0ff) == 0x40) /* Port page 0*/ |
| 334 | 334 | memory_set_bank(space->machine, "bank2", HECTORMX_BANK_PAGE0); |
| 335 | 335 | if ((offset &0x0ff) == 0x41) /* Port page 1*/ |
| r8453 | r8454 | |
| 346 | 346 | WRITE8_HANDLER( hector_mx80_io_port_w) |
| 347 | 347 | { |
| 348 | 348 | if ((offset &0x0ff) == 0xf0) /* Port A => to printer*/ |
| 349 | printer_output( | |
| 349 | printer_output( | |
| 350 | 350 | if ((offset &0x0ff) == 0x40) /* Port page 0*/ |
| 351 | 351 | memory_set_bank(space->machine, "bank2", HECTORMX_BANK_PAGE0); |
| 352 | 352 | if ((offset &0x0ff) == 0x41) /* Port page 1*/ |
| r8453 | r8454 | |
| 558 | 558 | void Update_Sound(const address_space *space, UINT8 data) |
| 559 | 559 | { |
| 560 | 560 | /* keep device*/ |
| 561 | running_device *sn76477 = | |
| 561 | running_device *sn76477 = | |
| 562 | 562 | |
| 563 | 563 | /* MIXER*/ |
| 564 | 564 | sn76477_mixer_a_w(sn76477, ((ValMixer & 0x04)==4) ? 1 : 0); |
| r8453 | r8454 | |
|---|---|---|
| 324 | 324 | assert_always((interrupt_bit < ARRAY_LENGTH(interrupt_names)) && (interrupt_names[interrupt_bit] != NULL), "Raising invalid interrupt"); |
| 325 | 325 | |
| 326 | 326 | logerror("bebox_set_irq_bit(): pc[0]=0x%08x pc[1]=0x%08x %s interrupt #%u (%s)\n", |
| 327 | (unsigned) cpu_get_reg(devtag_get_device(machine, "ppc1"), STATE_GENPC), | |
| 328 | (unsigned) cpu_get_reg(devtag_get_device(machine, "ppc2"), STATE_GENPC), | |
| 327 | (unsigned) cpu_get_reg(machine->device("ppc1"), STATE_GENPC), | |
| 328 | (unsigned) cpu_get_reg(machine->device("ppc2"), STATE_GENPC), | |
| 329 | 329 | val ? "Asserting" : "Clearing", |
| 330 | 330 | interrupt_bit, interrupt_names[interrupt_bit]); |
| 331 | 331 | } |
| r8453 | r8454 | |
| 431 | 431 | |
| 432 | 432 | static running_device * bebox_get_device(running_machine *machine ) |
| 433 | 433 | { |
| 434 | return | |
| 434 | return m | |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | |
| r8453 | r8454 | |
| 497 | 497 | |
| 498 | 498 | static running_device *ide_device(running_machine *machine) |
| 499 | 499 | { |
| 500 | return | |
| 500 | return m | |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | static READ8_HANDLER( bebox_800001F0_8_r ) { return ide_controller_r(ide_device(space->machine), offset + 0x1F0, 1); } |
| r8453 | r8454 | |
| 854 | 854 | } |
| 855 | 855 | |
| 856 | 856 | static int bebox_get_out2(running_machine *machine) { |
| 857 | return pit8253_get_output( | |
| 857 | return pit8253_get_output(m | |
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | static const struct kbdc8042_interface bebox_8042_interface = |
| r8453 | r8454 | |
| 1043 | 1043 | |
| 1044 | 1044 | |
| 1045 | 1045 | static TIMER_CALLBACK( bebox_get_devices ) { |
| 1046 | bebox_devices.pic8259_master = devtag_get_device(machine, "pic8259_master"); | |
| 1047 | bebox_devices.pic8259_slave = devtag_get_device(machine, "pic8259_slave"); | |
| 1048 | bebox_devices.dma8237_1 = devtag_get_device(machine, "dma8237_1"); | |
| 1049 | bebox_devices.dma8237_2 = devtag_get_device(machine, "dma8237_2"); | |
| 1046 | bebox_devices.pic8259_master = machine->device("pic8259_master"); | |
| 1047 | bebox_devices.pic8259_slave = machine->device("pic8259_slave"); | |
| 1048 | bebox_devices.dma8237_1 = machine->device("dma8237_1"); | |
| 1049 | bebox_devices.dma8237_2 = machine->device("dma8237_2"); | |
| 1050 | 1050 | } |
| 1051 | 1051 | |
| 1052 | 1052 | |
| r8453 | r8454 | |
| 1101 | 1101 | intelflash_init(machine, 0, FLASH_FUJITSU_29F016A, memory_region(machine, "user1")); |
| 1102 | 1102 | |
| 1103 | 1103 | /* install MESS managed RAM */ |
| 1104 | memory_install_readwrite_bank(space_0, 0, messram_get_size(devtag_get_device(machine, "messram")) - 1, 0, 0x02000000, "bank3"); | |
| 1105 | memory_install_readwrite_bank(space_1, 0, messram_get_size(devtag_get_device(machine, "messram")) - 1, 0, 0x02000000, "bank3"); | |
| 1106 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 1104 | memory_install_readwrite_bank(space_0, 0, messram_get_size(machine->device("messram")) - 1, 0, 0x02000000, "bank3"); | |
| 1105 | memory_install_readwrite_bank(space_1, 0, messram_get_size(machine->device("messram")) - 1, 0, 0x02000000, "bank3"); | |
| 1106 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram"))); | |
| 1107 | 1107 | |
| 1108 | 1108 | mc146818_init(machine, MC146818_STANDARD); |
| 1109 | 1109 | pc_vga_init(machine, &bebox_vga_interface, &cirrus_svga_interface); |
| r8453 | r8454 | |
|---|---|---|
| 512 | 512 | c9060->riot0 = device->subdevice(M6532_0_TAG); |
| 513 | 513 | c9060->riot1 = device->subdevice(M6532_1_TAG); |
| 514 | 514 | c9060->via = device->subdevice(M6522_TAG); |
| 515 | c9060->bus = dev | |
| 515 | c9060->bus = dev | |
| 516 | 516 | |
| 517 | 517 | /* register for state saving */ |
| 518 | 518 | // state_save_register_device_item(device, 0, c9060->); |
| r8453 | r8454 | |
|---|---|---|
| 74 | 74 | */ |
| 75 | 75 | |
| 76 | 76 | const address_space *program = cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM); |
| 77 | running_device *messram = | |
| 77 | running_device *messram = m | |
| 78 | 78 | |
| 79 | 79 | // UINT8 cbm_mode = data >> 7 & 0x01; |
| 80 | 80 | UINT8 rom_page = data >> 4 & 0x07; |
| r8453 | r8454 | |
| 404 | 404 | MACHINE_START( mtx512 ) |
| 405 | 405 | { |
| 406 | 406 | mtx_state *state = (mtx_state *)machine->driver_data; |
| 407 | running_device *messram = | |
| 407 | running_device *messram = m | |
| 408 | 408 | |
| 409 | 409 | /* find devices */ |
| 410 | state->z80ctc = devtag_get_device(machine, Z80CTC_TAG); | |
| 411 | state->z80dart = devtag_get_device(machine, Z80DART_TAG); | |
| 412 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 410 | state->z80ctc = machine->device(Z80CTC_TAG); | |
| 411 | state->z80dart = machine->device(Z80DART_TAG); | |
| 412 | state->cassette = machine->device(CASSETTE_TAG); | |
| 413 | 413 | |
| 414 | 414 | /* configure memory */ |
| 415 | 415 | memory_set_bankptr(machine, "bank1", memory_region(machine, "user1")); |
| r8453 | r8454 | |
|---|---|---|
| 477 | 477 | /* Set Reset and INTR/INTRM Vector */ |
| 478 | 478 | MACHINE_RESET( intv ) |
| 479 | 479 | { |
| 480 | cpu_set_input_line_vector( | |
| 480 | cpu_set_input_line_vector(m | |
| 481 | 481 | |
| 482 | 482 | /* These are actually the same vector, and INTR is unused */ |
| 483 | cpu_set_input_line_vector(devtag_get_device(machine, "maincpu"), CP1610_INT_INTRM, 0x1004); | |
| 484 | cpu_set_input_line_vector(devtag_get_device(machine, "maincpu"), CP1610_INT_INTR, 0x1004); | |
| 483 | cpu_set_input_line_vector(machine->device("maincpu"), CP1610_INT_INTRM, 0x1004); | |
| 484 | cpu_set_input_line_vector(machine->device("maincpu"), CP1610_INT_INTR, 0x1004); | |
| 485 | 485 | |
| 486 | 486 | /* Set initial PC */ |
| 487 | cpu_set_reg( | |
| 487 | cpu_set_reg(m | |
| 488 | 488 | |
| 489 | 489 | return; |
| 490 | 490 | } |
| r8453 | r8454 | |
|---|---|---|
| 70 | 70 | dat = (dat << 2) ^0xff; |
| 71 | 71 | if (input_port_read(device->machine, "LINE12")!=0xff) dat ^= 0x02; |
| 72 | 72 | |
| 73 | level = cassette_input(dev | |
| 73 | level = cassette_input(dev | |
| 74 | 74 | if (level >= 0) |
| 75 | 75 | { |
| 76 | 76 | dat ^= 0x01; |
| r8453 | r8454 | |
| 98 | 98 | } |
| 99 | 99 | static WRITE8_DEVICE_HANDLER (specialist_8255_portc_w ) |
| 100 | 100 | { |
| 101 | running_device *dac_device = dev | |
| 101 | running_device *dac_device = dev | |
| 102 | 102 | |
| 103 | 103 | specialist_8255_portc = data; |
| 104 | 104 | |
| 105 | cassette_output(dev | |
| 105 | cassette_output(dev | |
| 106 | 106 | |
| 107 | 107 | dac_data_w(dac_device, data & 0x20); //beeper |
| 108 | 108 | |
| r8453 | r8454 | |
| 132 | 132 | |
| 133 | 133 | READ8_HANDLER( specialist_keyboard_r ) |
| 134 | 134 | { |
| 135 | return i8255a_r( | |
| 135 | return i8255a_r( | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | WRITE8_HANDLER( specialist_keyboard_w ) |
| 139 | 139 | { |
| 140 | i8255a_w( | |
| 140 | i8255a_w( | |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | |
| r8453 | r8454 | |
| 147 | 147 | |
| 148 | 148 | static WRITE8_HANDLER( video_memory_w ) |
| 149 | 149 | { |
| 150 | messram_get_ptr( | |
| 150 | messram_get_ptr( | |
| 151 | 151 | specimx_colorram[offset] = specimx_color; |
| 152 | 152 | } |
| 153 | 153 | |
| r8453 | r8454 | |
| 166 | 166 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 167 | 167 | memory_install_write_bank(space, 0xc000, 0xffbf, 0, 0, "bank3"); |
| 168 | 168 | memory_install_write_bank(space, 0xffc0, 0xffdf, 0, 0, "bank4"); |
| 169 | memory_set_bankptr(machine, "bank4", messram_get_ptr( | |
| 169 | memory_set_bankptr(machine, "bank4", messram_get_ptr(m | |
| 170 | 170 | switch(i) |
| 171 | 171 | { |
| 172 | 172 | case 0 : |
| 173 | 173 | memory_install_write_bank(space, 0x0000, 0x8fff, 0, 0, "bank1"); |
| 174 | 174 | memory_install_write8_handler(space, 0x9000, 0xbfff, 0, 0, video_memory_w); |
| 175 | 175 | |
| 176 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 177 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x9000); | |
| 178 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xc000); | |
| 176 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram"))); | |
| 177 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0x9000); | |
| 178 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0xc000); | |
| 179 | 179 | break; |
| 180 | 180 | case 1 : |
| 181 | 181 | memory_install_write_bank(space, 0x0000, 0x8fff, 0, 0, "bank1"); |
| 182 | 182 | memory_install_write_bank(space, 0x9000, 0xbfff, 0, 0, "bank2"); |
| 183 | 183 | |
| 184 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x10000); | |
| 185 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x19000); | |
| 186 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x1c000); | |
| 184 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram")) + 0x10000); | |
| 185 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0x19000); | |
| 186 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x1c000); | |
| 187 | 187 | break; |
| 188 | 188 | case 2 : |
| 189 | 189 | memory_unmap_write(space, 0x0000, 0x8fff, 0, 0); |
| r8453 | r8454 | |
| 193 | 193 | memory_set_bankptr(machine, "bank2", memory_region(machine, "maincpu") + 0x19000); |
| 194 | 194 | if (data & 0x80) |
| 195 | 195 | { |
| 196 | memory_set_bankptr(machine, "bank3", messram_get_ptr( | |
| 196 | memory_set_bankptr(machine, "bank3", messram_get_ptr(m | |
| 197 | 197 | } |
| 198 | 198 | else |
| 199 | 199 | { |
| 200 | memory_set_bankptr(machine, "bank3", messram_get_ptr( | |
| 200 | memory_set_bankptr(machine, "bank3", messram_get_ptr(m | |
| 201 | 201 | } |
| 202 | 202 | break; |
| 203 | 203 | } |
| r8453 | r8454 | |
| 251 | 251 | |
| 252 | 252 | MACHINE_START( specimx ) |
| 253 | 253 | { |
| 254 | running_device *fdc = | |
| 254 | running_device *fdc = m | |
| 255 | 255 | wd17xx_dden_w(fdc, ASSERT_LINE); |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | static TIMER_CALLBACK( setup_pit8253_gates ) |
| 259 | 259 | { |
| 260 | running_device *pit8253 = | |
| 260 | running_device *pit8253 = m | |
| 261 | 261 | |
| 262 | 262 | pit8253_gate0_w(pit8253, 0); |
| 263 | 263 | pit8253_gate1_w(pit8253, 0); |
| r8453 | r8454 | |
| 269 | 269 | specimx_set_bank(machine, 2,0x00); // Initiali load ROM disk |
| 270 | 270 | specimx_color = 0x70; |
| 271 | 271 | timer_set(machine, attotime_zero, NULL, 0, setup_pit8253_gates ); |
| 272 | wd17xx_set_pause_time( | |
| 272 | wd17xx_set_pause_time(m | |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | READ8_HANDLER ( specimx_disk_ctrl_r ) |
| r8453 | r8454 | |
| 279 | 279 | |
| 280 | 280 | WRITE8_HANDLER( specimx_disk_ctrl_w ) |
| 281 | 281 | { |
| 282 | running_device *fdc = | |
| 282 | running_device *fdc = | |
| 283 | 283 | |
| 284 | 284 | switch(offset) |
| 285 | 285 | { |
| r8453 | r8454 | |
| 320 | 320 | case 1: |
| 321 | 321 | case 2: |
| 322 | 322 | case 3: |
| 323 | memory_set_bankptr(machine, "bank1", messram_get_ptr( | |
| 323 | memory_set_bankptr(machine, "bank1", messram_get_ptr(m | |
| 324 | 324 | break; |
| 325 | 325 | case 0: |
| 326 | 326 | memory_unmap_write(space, 0x0000, 0x3fff, 0, 0); |
| r8453 | r8454 | |
| 332 | 332 | case 1: |
| 333 | 333 | case 2: |
| 334 | 334 | case 3: |
| 335 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 335 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 336 | 336 | break; |
| 337 | 337 | case 0: |
| 338 | 338 | memory_unmap_write(space, 0x4000, 0x8fff, 0, 0); |
| r8453 | r8454 | |
| 344 | 344 | case 1: |
| 345 | 345 | case 2: |
| 346 | 346 | case 3: |
| 347 | memory_set_bankptr(machine, "bank3", messram_get_ptr( | |
| 347 | memory_set_bankptr(machine, "bank3", messram_get_ptr(m | |
| 348 | 348 | break; |
| 349 | 349 | case 0: |
| 350 | 350 | memory_unmap_write(space, 0x9000, 0xbfff, 0, 0); |
| r8453 | r8454 | |
| 356 | 356 | case 1: |
| 357 | 357 | case 2: |
| 358 | 358 | case 3: |
| 359 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x10000*(bank4-1) + 0x0c000); | |
| 360 | memory_set_bankptr(machine, "bank5", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x10000*(bank4-1) + 0x0f000); | |
| 361 | memory_set_bankptr(machine, "bank6", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x10000*(bank4-1) + 0x0f800); | |
| 359 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x10000*(bank4-1) + 0x0c000); | |
| 360 | memory_set_bankptr(machine, "bank5", messram_get_ptr(machine->device("messram")) + 0x10000*(bank4-1) + 0x0f000); | |
| 361 | memory_set_bankptr(machine, "bank6", messram_get_ptr(machine->device("messram")) + 0x10000*(bank4-1) + 0x0f800); | |
| 362 | 362 | break; |
| 363 | 363 | case 0: |
| 364 | 364 | memory_unmap_write(space, 0xc000, 0xefff, 0, 0); |
| r8453 | r8454 | |
| 416 | 416 | |
| 417 | 417 | WRITE8_HANDLER( erik_disk_reg_w ) |
| 418 | 418 | { |
| 419 | running_device *fdc = | |
| 419 | running_device *fdc = | |
| 420 | 420 | |
| 421 | 421 | wd17xx_set_side (fdc,data & 1); |
| 422 | 422 | wd17xx_set_drive(fdc,(data >> 1) & 1); |
| r8453 | r8454 | |
|---|---|---|
| 101 | 101 | |
| 102 | 102 | WRITE8_HANDLER( mikro80_tape_w ) |
| 103 | 103 | { |
| 104 | cassette_output( | |
| 104 | cassette_output( | |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
| 108 | 108 | READ8_HANDLER( mikro80_tape_r ) |
| 109 | 109 | { |
| 110 | double level = cassette_input( | |
| 110 | double level = cassette_input( | |
| 111 | 111 | if (level < 0) { |
| 112 | 112 | return 0x00; |
| 113 | 113 | } |
| r8453 | r8454 | |
|---|---|---|
| 445 | 445 | case 0x0d: i186.intr.in_service &= ~0x20; break; |
| 446 | 446 | case 0x0e: i186.intr.in_service &= ~0x40; break; |
| 447 | 447 | case 0x0f: i186.intr.in_service &= ~0x80; break; |
| 448 | default: logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", cpu_get_pc( | |
| 448 | default: logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", cpu_get_pc(m | |
| 449 | 449 | } |
| 450 | 450 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", attotime_to_double(timer_get_time(machine)), data & 0x1f); |
| 451 | 451 | } |
| r8453 | r8454 | |
| 654 | 654 | diff = new_control ^ t->control; |
| 655 | 655 | if (diff & 0x001c) |
| 656 | 656 | logerror("%05X:ERROR! -unsupported timer mode %04X\n", |
| 657 | cpu_get_pc( | |
| 657 | cpu_get_pc(m | |
| 658 | 658 | |
| 659 | 659 | /* if we have real changes, update things */ |
| 660 | 660 | if (diff != 0) |
| r8453 | r8454 | |
| 753 | 753 | diff = new_control ^ d->control; |
| 754 | 754 | if ((LOG_DMA) && (diff & 0x6811)) |
| 755 | 755 | logerror("%05X:ERROR! - unsupported DMA mode %04X\n", |
| 756 | cpu_get_pc( | |
| 756 | cpu_get_pc(m | |
| 757 | 757 | |
| 758 | 758 | /* if we're going live, set a timer */ |
| 759 | 759 | if ((diff & 0x0002) && (new_control & 0x0002)) |
| r8453 | r8454 | |
| 790 | 790 | static void drq_callback(running_machine *machine, int which) |
| 791 | 791 | { |
| 792 | 792 | struct dma_state *dma = &i186.dma[which]; |
| 793 | const address_space *memory_space = cpu_get_address_space(devtag_get_device(machine, MAINCPU_TAG), ADDRESS_SPACE_PROGRAM); | |
| 794 | const address_space *io_space = cpu_get_address_space(devtag_get_device(machine, MAINCPU_TAG), ADDRESS_SPACE_IO); | |
| 793 | const address_space *memory_space = cpu_get_address_space(machine->device(MAINCPU_TAG), ADDRESS_SPACE_PROGRAM); | |
| 794 | const address_space *io_space = cpu_get_address_space(machine->device(MAINCPU_TAG), ADDRESS_SPACE_IO); | |
| 795 | 795 | |
| 796 | 796 | const address_space *src_space; |
| 797 | 797 | const address_space *dest_space; |
| r8453 | r8454 | |
| 806 | 806 | if(!(dma->control & ST_STOP)) |
| 807 | 807 | { |
| 808 | 808 | logerror("%05X:ERROR! - drq%d with dma channel stopped\n", |
| 809 | cpu_get_pc( | |
| 809 | cpu_get_pc(m | |
| 810 | 810 | |
| 811 | 811 | return; |
| 812 | 812 | } |
| r8453 | r8454 | |
| 926 | 926 | case 0x12: |
| 927 | 927 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll\n", cpu_get_pc(space->cpu)); |
| 928 | 928 | if (i186.intr.poll_status & 0x8000) |
| 929 | int_callback( | |
| 929 | int_callback( | |
| 930 | 930 | return i186.intr.poll_status; |
| 931 | 931 | |
| 932 | 932 | case 0x13: |
| r8453 | r8454 | |
| 1429 | 1429 | |
| 1430 | 1430 | void (*dump_dssi)(running_device *,UINT16, UINT16) = NULL; |
| 1431 | 1431 | |
| 1432 | running_device *cpu = dev | |
| 1432 | running_device *cpu = dev | |
| 1433 | 1433 | |
| 1434 | 1434 | UINT16 ax = cpu_get_reg(cpu,I8086_AX); |
| 1435 | 1435 | UINT16 bx = cpu_get_reg(cpu,I8086_BX); |
| r8453 | r8454 | |
| 1943 | 1943 | static void nimbus_bank_memory(running_machine *machine) |
| 1944 | 1944 | { |
| 1945 | 1945 | const address_space *space = cputag_get_address_space( machine, MAINCPU_TAG, ADDRESS_SPACE_PROGRAM ); |
| 1946 | int ramsize = messram_get_size( | |
| 1946 | int ramsize = messram_get_size(m | |
| 1947 | 1947 | int ramblock = 0; |
| 1948 | 1948 | int blockno; |
| 1949 | 1949 | char bank[10]; |
| 1950 | UINT8 *ram = &messram_get_ptr( | |
| 1950 | UINT8 *ram = &messram_get_ptr(m | |
| 1951 | 1951 | UINT8 *map_blocks[3]; |
| 1952 | 1952 | UINT8 *map_base; |
| 1953 | 1953 | int map_blockno; |
| r8453 | r8454 | |
| 2230 | 2230 | READ8_HANDLER( nimbus_disk_r ) |
| 2231 | 2231 | { |
| 2232 | 2232 | int result = 0; |
| 2233 | running_device *fdc = devtag_get_device(space->machine, FDC_TAG); | |
| 2234 | running_device *hdc = devtag_get_device(space->machine, SCSIBUS_TAG); | |
| 2233 | running_device *fdc = space->machine->device(FDC_TAG); | |
| 2234 | running_device *hdc = space->machine->device(SCSIBUS_TAG); | |
| 2235 | 2235 | |
| 2236 | 2236 | int pc=cpu_get_pc(space->cpu); |
| 2237 | running_device *drive = | |
| 2237 | running_device *drive = | |
| 2238 | 2238 | |
| 2239 | 2239 | switch(offset*2) |
| 2240 | 2240 | { |
| r8453 | r8454 | |
| 2298 | 2298 | |
| 2299 | 2299 | WRITE8_HANDLER( nimbus_disk_w ) |
| 2300 | 2300 | { |
| 2301 | running_device *fdc = devtag_get_device(space->machine, FDC_TAG); | |
| 2302 | running_device *hdc = devtag_get_device(space->machine, SCSIBUS_TAG); | |
| 2301 | running_device *fdc = space->machine->device(FDC_TAG); | |
| 2302 | running_device *hdc = space->machine->device(SCSIBUS_TAG); | |
| 2303 | 2303 | int pc=cpu_get_pc(space->cpu); |
| 2304 | 2304 | UINT8 reg400_old = nimbus_drives.reg400; |
| 2305 | 2305 | |
| r8453 | r8454 | |
| 2350 | 2350 | |
| 2351 | 2351 | static void hdc_reset(running_machine *machine) |
| 2352 | 2352 | { |
| 2353 | running_device *hdc = | |
| 2353 | running_device *hdc = m | |
| 2354 | 2354 | |
| 2355 | 2355 | init_scsibus(hdc); |
| 2356 | 2356 | |
| r8453 | r8454 | |
| 2366 | 2366 | |
| 2367 | 2367 | static void hdc_ctrl_write(running_machine *machine, UINT8 data) |
| 2368 | 2368 | { |
| 2369 | running_device *hdc = | |
| 2369 | running_device *hdc = m | |
| 2370 | 2370 | |
| 2371 | 2371 | // If we enable the HDC interupt, and an interrupt is pending, go deal with it. |
| 2372 | 2372 | if(((data & HDC_IRQ_MASK) && (~nimbus_drives.reg410_out & HDC_IRQ_MASK)) && |
| r8453 | r8454 | |
| 2381 | 2381 | |
| 2382 | 2382 | static void hdc_post_rw(running_machine *machine) |
| 2383 | 2383 | { |
| 2384 | running_device *hdc = | |
| 2384 | running_device *hdc = m | |
| 2385 | 2385 | |
| 2386 | 2386 | if((nimbus_drives.reg410_in & HDC_REQ_MASK)==0) |
| 2387 | 2387 | set_scsi_line(hdc,SCSI_LINE_ACK,0); |
| r8453 | r8454 | |
| 2580 | 2580 | |
| 2581 | 2581 | READ8_HANDLER( pc8031_port_r ) |
| 2582 | 2582 | { |
| 2583 | running_device *er59256 = | |
| 2583 | running_device *er59256 = | |
| 2584 | 2584 | int pc=cpu_get_pc(space->cpu); |
| 2585 | 2585 | UINT8 result = 0; |
| 2586 | 2586 | |
| r8453 | r8454 | |
| 2597 | 2597 | |
| 2598 | 2598 | WRITE8_HANDLER( pc8031_port_w ) |
| 2599 | 2599 | { |
| 2600 | running_device *er59256 = | |
| 2600 | running_device *er59256 = | |
| 2601 | 2601 | int pc=cpu_get_pc(space->cpu); |
| 2602 | 2602 | |
| 2603 | 2603 | switch (offset) |
| r8453 | r8454 | |
| 2631 | 2631 | WRITE8_HANDLER( iou_w ) |
| 2632 | 2632 | { |
| 2633 | 2633 | int pc=cpu_get_pc(space->cpu); |
| 2634 | running_device *msm5205 = | |
| 2634 | running_device *msm5205 = | |
| 2635 | 2635 | |
| 2636 | 2636 | if(LOG_IOU) |
| 2637 | 2637 | logerror("Nimbus IOUW %08X write of %02X to %04X\n",pc,data,(offset*2)+0x92); |
| r8453 | r8454 | |
| 2664 | 2664 | |
| 2665 | 2665 | static void sound_reset(running_machine *machine) |
| 2666 | 2666 | { |
| 2667 | //running_device *ay8910 = devtag_get_device(machine, AY8910_TAG); | |
| 2668 | running_device *msm5205 = devtag_get_device(machine, MSM5205_TAG); | |
| 2667 | //running_device *ay8910 = machine->device(AY8910_TAG); | |
| 2668 | running_device *msm5205 = machine->device(MSM5205_TAG); | |
| 2669 | 2669 | |
| 2670 | 2670 | //ay8910_reset_ym(ay8910); |
| 2671 | 2671 | msm5205_reset_w(msm5205, 1); |
| r8453 | r8454 | |
| 2678 | 2678 | |
| 2679 | 2679 | READ8_HANDLER( sound_ay8910_r ) |
| 2680 | 2680 | { |
| 2681 | running_device *ay8910 = | |
| 2681 | running_device *ay8910 = | |
| 2682 | 2682 | UINT8 result=0; |
| 2683 | 2683 | |
| 2684 | 2684 | if ((offset*2)==0) |
| r8453 | r8454 | |
| 2690 | 2690 | WRITE8_HANDLER( sound_ay8910_w ) |
| 2691 | 2691 | { |
| 2692 | 2692 | int pc=cpu_get_pc(space->cpu); |
| 2693 | running_device *ay8910 = | |
| 2693 | running_device *ay8910 = | |
| 2694 | 2694 | |
| 2695 | 2695 | if(LOG_SOUND) |
| 2696 | 2696 | logerror("Nimbus SoundW %05X write of %02X to %04X\n",pc,data,(offset*2)+0xE0); |
| r8453 | r8454 | |
| 2705 | 2705 | |
| 2706 | 2706 | WRITE8_HANDLER( sound_ay8910_porta_w ) |
| 2707 | 2707 | { |
| 2708 | running_device *msm5205 = | |
| 2708 | running_device *msm5205 = | |
| 2709 | 2709 | |
| 2710 | 2710 | msm5205_data_w(msm5205, data); |
| 2711 | 2711 | |
| r8453 | r8454 | |
| 2715 | 2715 | |
| 2716 | 2716 | WRITE8_HANDLER( sound_ay8910_portb_w ) |
| 2717 | 2717 | { |
| 2718 | running_device *msm5205 = | |
| 2718 | running_device *msm5205 = | |
| 2719 | 2719 | |
| 2720 | 2720 | if((data & 0x07)!=last_playmode) |
| 2721 | 2721 | { |
| r8453 | r8454 | |
| 2758 | 2758 | { |
| 2759 | 2759 | UINT8 x = 0; |
| 2760 | 2760 | UINT8 y = 0; |
| 2761 | // int pc=cpu_get_pc( | |
| 2761 | // int pc=cpu_get_pc(m | |
| 2762 | 2762 | |
| 2763 | 2763 | UINT8 intstate_x; |
| 2764 | 2764 | UINT8 intstate_y; |
| r8453 | r8454 | |
| 2904 | 2904 | |
| 2905 | 2905 | */ |
| 2906 | 2906 | UINT8 result; |
| 2907 | // int pc=cpu_get_pc( | |
| 2907 | // int pc=cpu_get_pc( | |
| 2908 | 2908 | |
| 2909 | 2909 | _mouse_joy_state *state = &nimbus_mouse; |
| 2910 | 2910 |
| r8453 | r8454 | |
|---|---|---|
| 50 | 50 | UINT8 val = 0; |
| 51 | 51 | val |= mz80k_vertical ? 0x80 : 0x00; |
| 52 | 52 | val |= (mz80k_cursor_cnt > 31) ? 0x40 : 0x00; |
| 53 | val |= (cassette_get_state(dev | |
| 53 | val |= (cassette_get_state(dev | |
| 54 | 54 | |
| 55 | if (cassette_input(dev | |
| 55 | if (cassette_input(dev | |
| 56 | 56 | val |= 0x20; |
| 57 | 57 | |
| 58 | 58 | return val; |
| r8453 | r8454 | |
| 73 | 73 | |
| 74 | 74 | static WRITE_LINE_DEVICE_HANDLER( pit_out0_changed ) |
| 75 | 75 | { |
| 76 | running_device *speaker = dev | |
| 76 | running_device *speaker = dev | |
| 77 | 77 | if((prev_state==0) && (state==1)) { |
| 78 | 78 | speaker_level ^= 1; |
| 79 | 79 | } |
| r8453 | r8454 | |
| 112 | 112 | } |
| 113 | 113 | WRITE8_HANDLER(mz80k_strobe_w) |
| 114 | 114 | { |
| 115 | running_device *pit = | |
| 115 | running_device *pit = | |
| 116 | 116 | pit8253_gate0_w(pit, BIT(data, 0)); |
| 117 | 117 | } |
| r8453 | r8454 | |
|---|---|---|
| 956 | 956 | c1571->via1 = device->subdevice(M6522_1_TAG); |
| 957 | 957 | c1571->cia = device->subdevice(M6526_TAG); |
| 958 | 958 | c1571->wd1770 = device->subdevice(WD1770_TAG); |
| 959 | c1571->serial_bus = dev | |
| 959 | c1571->serial_bus = dev | |
| 960 | 960 | c1571->image = device->subdevice(FLOPPY_0); |
| 961 | 961 | |
| 962 | 962 | /* install image callbacks */ |
| r8453 | r8454 | |
|---|---|---|
| 76 | 76 | |
| 77 | 77 | static TIMER_DEVICE_CALLBACK( clock_tick ) |
| 78 | 78 | { |
| 79 | running_device *device = | |
| 79 | running_device *device = | |
| 80 | 80 | abc77_t *abc77 = get_safe_token(device); |
| 81 | 81 | |
| 82 | 82 | abc77->clock = !abc77->clock; |
| r8453 | r8454 | |
| 102 | 102 | |
| 103 | 103 | static READ8_HANDLER( abc77_clock_r ) |
| 104 | 104 | { |
| 105 | running_device *device = | |
| 105 | running_device *device = | |
| 106 | 106 | abc77_t *abc77 = get_safe_token(device); |
| 107 | 107 | |
| 108 | 108 | return abc77->clock; |
| r8453 | r8454 | |
| 114 | 114 | |
| 115 | 115 | static READ8_HANDLER( abc77_data_r ) |
| 116 | 116 | { |
| 117 | running_device *device = | |
| 117 | running_device *device = | |
| 118 | 118 | abc77_t *abc77 = get_safe_token(device); |
| 119 | 119 | |
| 120 | 120 | static const char *const keynames[] = { "ABC77_X0", "ABC77_X1", "ABC77_X2", "ABC77_X3", "ABC77_X4", "ABC77_X5", "ABC77_X6", "ABC77_X7", "ABC77_X8", "ABC77_X9", "ABC77_X10", "ABC77_X11" }; |
| r8453 | r8454 | |
| 128 | 128 | |
| 129 | 129 | static WRITE8_HANDLER( abc77_data_w ) |
| 130 | 130 | { |
| 131 | running_device *device = devtag_get_device(space->machine, ABC77_TAG); | |
| 132 | running_device *discrete = devtag_get_device(space->machine, "discrete"); | |
| 131 | running_device *device = space->machine->device(ABC77_TAG); | |
| 132 | running_device *discrete = space->machine->device("discrete"); | |
| 133 | 133 | abc77_t *abc77 = get_safe_token(device); |
| 134 | 134 | |
| 135 | 135 | abc77->keylatch = data & 0x0f; |
| r8453 | r8454 | |
| 412 | 412 | |
| 413 | 413 | /* find our CPU */ |
| 414 | 414 | astring_printf(&tempstring, "%s:%s", device->tag(), I8035_TAG); |
| 415 | abc77->cpu = dev | |
| 415 | abc77->cpu = dev | |
| 416 | 416 | |
| 417 | 417 | /* allocate reset timer */ |
| 418 | 418 | abc77->reset_timer = timer_alloc(device->machine, reset_tick, (FPTR *) device); |
| r8453 | r8454 | |
|---|---|---|
| 86 | 86 | |
| 87 | 87 | WRITE8_HANDLER( ut88_sound_w ) |
| 88 | 88 | { |
| 89 | running_device *dac_device = | |
| 89 | running_device *dac_device = | |
| 90 | 90 | dac_data_w(dac_device, data); //beeper |
| 91 | cassette_output( | |
| 91 | cassette_output( | |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | |
| 95 | 95 | READ8_HANDLER( ut88_tape_r ) |
| 96 | 96 | { |
| 97 | double level = cassette_input( | |
| 97 | double level = cassette_input( | |
| 98 | 98 | if (level < 0) { |
| 99 | 99 | return 0x00; |
| 100 | 100 | } |
| r8453 | r8454 | |
|---|---|---|
| 266 | 266 | |
| 267 | 267 | /* find device */ |
| 268 | 268 | (*tailptr)->next = NULL; |
| 269 | (*tailptr)->device = dev | |
| 269 | (*tailptr)->device = dev | |
| 270 | 270 | |
| 271 | 271 | if ((*tailptr)->device == NULL) |
| 272 | 272 | { |
| r8453 | r8454 | |
|---|---|---|
| 84 | 84 | { |
| 85 | 85 | memory_install_read_bank(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), start, start + size - 1, 0, mirror - size, "bank1"); |
| 86 | 86 | memory_install_write_bank(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), start, start + size - 1, 0, mirror - size, "bank1"); |
| 87 | memory_set_bankptr( machine, "bank1", messram_get_ptr( | |
| 87 | memory_set_bankptr( machine, "bank1", messram_get_ptr(m | |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | DRIVER_INIT( cybikov1 ) |
| 91 | 91 | { |
| 92 | 92 | _logerror( 0, ("init_cybikov1\n")); |
| 93 | init_ram_handler(machine, 0x200000, messram_get_size( | |
| 93 | init_ram_handler(machine, 0x200000, messram_get_size(m | |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | DRIVER_INIT( cybikov2 ) |
| 97 | 97 | { |
| 98 | 98 | _logerror( 0, ("init_cybikov2\n")); |
| 99 | init_ram_handler(machine, 0x200000, messram_get_size( | |
| 99 | init_ram_handler(machine, 0x200000, messram_get_size(m | |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | DRIVER_INIT( cybikoxt ) |
| 103 | 103 | { |
| 104 | 104 | _logerror( 0, ("init_cybikoxt\n")); |
| 105 | init_ram_handler(machine, 0x400000, messram_get_size( | |
| 105 | init_ram_handler(machine, 0x400000, messram_get_size(m | |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | //////////////////// |
| r8453 | r8454 | |
| 182 | 182 | |
| 183 | 183 | static void cybiko_pcf8593_load(running_machine *machine, mame_file *file) |
| 184 | 184 | { |
| 185 | running_device *device = | |
| 185 | running_device *device = m | |
| 186 | 186 | pcf8593_load(device, file); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | static void cybiko_pcf8593_save(running_machine *machine, mame_file *file) |
| 190 | 190 | { |
| 191 | running_device *device = | |
| 191 | running_device *device = m | |
| 192 | 192 | pcf8593_save(device, file); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | static void cybiko_at45dbxx_load(running_machine *machine, mame_file *file) |
| 196 | 196 | { |
| 197 | running_device *device = | |
| 197 | running_device *device = m | |
| 198 | 198 | at45dbxx_load(device, file); |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | static void cybiko_at45dbxx_save(running_machine *machine, mame_file *file) |
| 202 | 202 | { |
| 203 | running_device *device = | |
| 203 | running_device *device = m | |
| 204 | 204 | at45dbxx_save(device, file); |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | static void cybiko_sst39vfx_load(running_machine *machine, mame_file *file) |
| 208 | 208 | { |
| 209 | running_device *device = | |
| 209 | running_device *device = m | |
| 210 | 210 | sst39vfx_load(device, file); |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | static void cybiko_sst39vfx_save(running_machine *machine, mame_file *file) |
| 214 | 214 | { |
| 215 | running_device *device = | |
| 215 | running_device *device = m | |
| 216 | 216 | sst39vfx_save(device, file); |
| 217 | 217 | } |
| 218 | 218 | |
| r8453 | r8454 | |
| 231 | 231 | |
| 232 | 232 | MACHINE_START( cybikov2 ) |
| 233 | 233 | { |
| 234 | running_device *flash2 = | |
| 234 | running_device *flash2 = m | |
| 235 | 235 | |
| 236 | 236 | _logerror( 0, ("machine_start_cybikov2\n")); |
| 237 | 237 | // real-time clock |
| r8453 | r8454 | |
| 249 | 249 | |
| 250 | 250 | MACHINE_START( cybikoxt ) |
| 251 | 251 | { |
| 252 | running_device *flash2 = | |
| 252 | running_device *flash2 = m | |
| 253 | 253 | _logerror( 0, ("machine_start_cybikoxt\n")); |
| 254 | 254 | // real-time clock |
| 255 | 255 | nvram_system_load( machine, "rtc", cybiko_pcf8593_load, 0); |
| r8453 | r8454 | |
| 478 | 478 | // serial dataflash |
| 479 | 479 | case H8S_IO_PORT3 : |
| 480 | 480 | { |
| 481 | running_device *device = | |
| 481 | running_device *device = | |
| 482 | 482 | if (at45dbxx_pin_so(device)) data = data | H8S_P3_RXD1; |
| 483 | 483 | } |
| 484 | 484 | break; |
| r8453 | r8454 | |
| 488 | 488 | // real-time clock |
| 489 | 489 | case H8S_IO_PORTF : |
| 490 | 490 | { |
| 491 | running_device *device = | |
| 491 | running_device *device = | |
| 492 | 492 | data = H8S_PF_PF2; |
| 493 | 493 | if (pcf8593_pin_sda_r(device)) data |= H8S_PF_PF0; |
| 494 | 494 | } |
| r8453 | r8454 | |
| 505 | 505 | |
| 506 | 506 | static WRITE8_HANDLER( cybiko_io_reg_w ) |
| 507 | 507 | { |
| 508 | running_device *rtc = devtag_get_device(space->machine, "rtc"); | |
| 509 | running_device *speaker = devtag_get_device(space->machine, "speaker"); | |
| 508 | running_device *rtc = space->machine->device("rtc"); | |
| 509 | running_device *speaker = space->machine->device("speaker"); | |
| 510 | 510 | |
| 511 | 511 | _logerror( 2, ("cybiko_io_reg_w (%08X/%02X)\n", offset, data)); |
| 512 | 512 | switch (offset) |
| r8453 | r8454 | |
| 516 | 516 | // serial dataflash |
| 517 | 517 | case H8S_IO_P3DR : |
| 518 | 518 | { |
| 519 | running_device *device = | |
| 519 | running_device *device = | |
| 520 | 520 | at45dbxx_pin_cs ( device, (data & H8S_P3_SCK0) ? 0 : 1); |
| 521 | 521 | at45dbxx_pin_si ( device, (data & H8S_P3_TXD1) ? 1 : 0); |
| 522 | 522 | at45dbxx_pin_sck( device, (data & H8S_P3_SCK1) ? 1 : 0); |
| r8453 | r8454 | |
|---|---|---|
| 28 | 28 | if (BIT(pp01_video_write_mode,3)) { |
| 29 | 29 | // Copy mode |
| 30 | 30 | if(BIT(pp01_video_write_mode,0)) { |
| 31 | messram_get_ptr( | |
| 31 | messram_get_ptr(m | |
| 32 | 32 | } else { |
| 33 | messram_get_ptr( | |
| 33 | messram_get_ptr(m | |
| 34 | 34 | } |
| 35 | 35 | if(BIT(pp01_video_write_mode,1)) { |
| 36 | messram_get_ptr( | |
| 36 | messram_get_ptr(m | |
| 37 | 37 | } else { |
| 38 | messram_get_ptr( | |
| 38 | messram_get_ptr(m | |
| 39 | 39 | } |
| 40 | 40 | if(BIT(pp01_video_write_mode,2)) { |
| 41 | messram_get_ptr( | |
| 41 | messram_get_ptr(m | |
| 42 | 42 | } else { |
| 43 | messram_get_ptr( | |
| 43 | messram_get_ptr(m | |
| 44 | 44 | } |
| 45 | 45 | } else { |
| 46 | 46 | if (block==0) { |
| 47 | messram_get_ptr( | |
| 47 | messram_get_ptr(m | |
| 48 | 48 | } |
| 49 | 49 | if (block==1) { |
| 50 | messram_get_ptr( | |
| 50 | messram_get_ptr(m | |
| 51 | 51 | } |
| 52 | 52 | if (block==2) { |
| 53 | messram_get_ptr( | |
| 53 | messram_get_ptr(m | |
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | } |
| r8453 | r8454 | |
| 119 | 119 | break; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | memory_set_bankptr(machine, bank, messram_get_ptr( | |
| 122 | memory_set_bankptr(machine, bank, messram_get_ptr(m | |
| 123 | 123 | } else if (data>=0xF8) { |
| 124 | 124 | memory_install_read_bank (space, startaddr, endaddr, 0, 0, bank); |
| 125 | 125 | memory_unmap_write(space, startaddr, endaddr, 0, 0); |
| r8453 | r8454 | |
|---|---|---|
| 128 | 128 | |
| 129 | 129 | battery_ram = (UINT8*)malloc(state->cart[0].sram_max); |
| 130 | 130 | ptr = battery_ram; |
| 131 | device_image_interface *image = dynamic_cast<device_image_interface *>( | |
| 131 | device_image_interface *image = dynamic_cast<device_image_interface *>(m | |
| 132 | 132 | image->battery_load(battery_ram, state->cart[0].sram_max, 0xff); |
| 133 | 133 | |
| 134 | 134 | if (state->cart[0].mode == SNES_MODE_20) |
| r8453 | r8454 | |
| 205 | 205 | ptr += 0x2000; |
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | device_image_interface *image = dynamic_cast<device_image_interface *>( | |
| 208 | device_image_interface *image = dynamic_cast<device_image_interface *>(m | |
| 209 | 209 | image->battery_save(battery_ram, state->cart[0].sram_max); |
| 210 | 210 | |
| 211 | 211 | free(battery_ram); |
| r8453 | r8454 | |
| 235 | 235 | |
| 236 | 236 | battery_ram = (UINT8*)malloc(0x20000); |
| 237 | 237 | ptr = battery_ram; |
| 238 | device_image_interface *image = dynamic_cast<device_image_interface *>( | |
| 238 | device_image_interface *image = dynamic_cast<device_image_interface *>(m | |
| 239 | 239 | image->battery_load(battery_ram, 0x20000, 0); |
| 240 | 240 | |
| 241 | 241 | if (strcmp(cart_tag, "slot_a") == 0) |
| r8453 | r8454 | |
| 271 | 271 | { |
| 272 | 272 | memmove(ptr + ii * 0x8000, &snes_ram[0x608000 + (ii * 0x010000)], 0x8000); |
| 273 | 273 | } |
| 274 | device_image_interface *image = dynamic_cast<device_image_interface *>( | |
| 274 | device_image_interface *image = dynamic_cast<device_image_interface *>(m | |
| 275 | 275 | image->battery_save(battery_ram, 0x20000); |
| 276 | 276 | } |
| 277 | 277 | |
| r8453 | r8454 | |
| 281 | 281 | { |
| 282 | 282 | memmove(ptr + ii * 0x8000, &snes_ram[0x708000 + (ii * 0x010000)], 0x8000); |
| 283 | 283 | } |
| 284 | device_image_interface *image = dynamic_cast<device_image_interface *>( | |
| 284 | device_image_interface *image = dynamic_cast<device_image_interface *>(m | |
| 285 | 285 | image->battery_save(battery_ram, 0x20000); |
| 286 | 286 | } |
| 287 | 287 |
| r8453 | r8454 | |
|---|---|---|
| 203 | 203 | else |
| 204 | 204 | { |
| 205 | 205 | /* RAM */ |
| 206 | if (end_r >= messram_get_size(devtag_get_device(machine, "messram"))) | |
| 207 | end_r = messram_get_size(devtag_get_device(machine, "messram")) - 1; | |
| 206 | if (end_r >= messram_get_size(machine->device("messram"))) | |
| 207 | end_r = messram_get_size(machine->device("messram")) - 1; | |
| 208 | 208 | offset = meminfo.read_mem & APPLE2_MEM_MASK; |
| 209 | 209 | if (end_r >= begin) |
| 210 | rbase = &messram_get_ptr( | |
| 210 | rbase = &messram_get_ptr(m | |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /* install the actual handlers */ |
| r8453 | r8454 | |
| 286 | 286 | else |
| 287 | 287 | { |
| 288 | 288 | /* RAM */ |
| 289 | if (end_w >= messram_get_size(devtag_get_device(machine, "messram"))) | |
| 290 | end_w = messram_get_size(devtag_get_device(machine, "messram")) - 1; | |
| 289 | if (end_w >= messram_get_size(machine->device("messram"))) | |
| 290 | end_w = messram_get_size(machine->device("messram")) - 1; | |
| 291 | 291 | offset = meminfo.write_mem & APPLE2_MEM_MASK; |
| 292 | 292 | if (end_w >= begin) |
| 293 | wbase = &messram_get_ptr( | |
| 293 | wbase = &messram_get_ptr(m | |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | |
| r8453 | r8454 | |
| 857 | 857 | void apple2_setvar(running_machine *machine, UINT32 val, UINT32 mask) |
| 858 | 858 | { |
| 859 | 859 | LOG(("apple2_setvar(): val=0x%06x mask=0x%06x pc=0x%04x\n", val, mask, |
| 860 | (unsigned int) cpu_get_reg( | |
| 860 | (unsigned int) cpu_get_reg(m | |
| 861 | 861 | |
| 862 | 862 | assert((val & mask) == val); |
| 863 | 863 | |
| r8453 | r8454 | |
| 1018 | 1018 | //CMemory::mState |= CMemory::kVBLBar; // N: VBL' is true // FIX: MESS? |
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | return messram_get_ptr( | |
| 1021 | return messram_get_ptr(m | |
| 1022 | 1022 | } |
| 1023 | 1023 | |
| 1024 | 1024 | |
| r8453 | r8454 | |
| 1094 | 1094 | static WRITE8_HANDLER ( apple2_mainram0400_w ) |
| 1095 | 1095 | { |
| 1096 | 1096 | offset += 0x400; |
| 1097 | messram_get_ptr( | |
| 1097 | messram_get_ptr( | |
| 1098 | 1098 | } |
| 1099 | 1099 | |
| 1100 | 1100 | static WRITE8_HANDLER ( apple2_mainram2000_w ) |
| 1101 | 1101 | { |
| 1102 | 1102 | offset += 0x2000; |
| 1103 | messram_get_ptr( | |
| 1103 | messram_get_ptr( | |
| 1104 | 1104 | } |
| 1105 | 1105 | |
| 1106 | 1106 | static WRITE8_HANDLER ( apple2_auxram0400_w ) |
| 1107 | 1107 | { |
| 1108 | 1108 | offset += 0x10400; |
| 1109 | messram_get_ptr( | |
| 1109 | messram_get_ptr( | |
| 1110 | 1110 | } |
| 1111 | 1111 | |
| 1112 | 1112 | static WRITE8_HANDLER ( apple2_auxram2000_w ) |
| 1113 | 1113 | { |
| 1114 | 1114 | offset += 0x12000; |
| 1115 | messram_get_ptr( | |
| 1115 | messram_get_ptr( | |
| 1116 | 1116 | } |
| 1117 | 1117 | |
| 1118 | 1118 | |
| r8453 | r8454 | |
| 1264 | 1264 | { |
| 1265 | 1265 | if (!offset) |
| 1266 | 1266 | { |
| 1267 | running_device *speaker_device = | |
| 1267 | running_device *speaker_device = | |
| 1268 | 1268 | |
| 1269 | 1269 | if (a2_speaker_state == 1) |
| 1270 | 1270 | { |
| r8453 | r8454 | |
| 1334 | 1334 | |
| 1335 | 1335 | static running_device *cassette_device_image(running_machine *machine) |
| 1336 | 1336 | { |
| 1337 | return | |
| 1337 | return m | |
| 1338 | 1338 | } |
| 1339 | 1339 | |
| 1340 | 1340 | READ8_HANDLER ( apple2_c06x_r ) |
| r8453 | r8454 | |
| 1562 | 1562 | { |
| 1563 | 1563 | apple2_fdc_diskreg = data & 0xC0; |
| 1564 | 1564 | if (apple2_fdc_has_35(machine)) |
| 1565 | sony_set_sel_line( | |
| 1565 | sony_set_sel_line( m | |
| 1566 | 1566 | } |
| 1567 | 1567 | |
| 1568 | 1568 | |
| r8453 | r8454 | |
| 1613 | 1613 | if (memory_region_length(machine, "maincpu") < 0x8000) |
| 1614 | 1614 | a2_mask &= ~VAR_ROMSWITCH; |
| 1615 | 1615 | |
| 1616 | if (messram_get_size( | |
| 1616 | if (messram_get_size(m | |
| 1617 | 1617 | a2_mask &= ~(VAR_RAMRD | VAR_RAMWRT | VAR_80STORE | VAR_ALTZP | VAR_80COL); |
| 1618 | 1618 | } |
| 1619 | 1619 |
| r8453 | r8454 | |
|---|---|---|
| 71 | 71 | static void c64_nmi( running_machine *machine ) |
| 72 | 72 | { |
| 73 | 73 | static int nmilevel = 0; |
| 74 | running_device *cia_1 = | |
| 74 | running_device *cia_1 = m | |
| 75 | 75 | int cia1irq = mos6526_irq_r(cia_1); |
| 76 | 76 | |
| 77 | 77 | if (nmilevel != (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq) /* KEY_RESTORE */ |
| r8453 | r8454 | |
| 101 | 101 | |
| 102 | 102 | static READ8_DEVICE_HANDLER( c64_cia0_port_a_r ) |
| 103 | 103 | { |
| 104 | UINT8 cia0portb = mos6526_pb_r(dev | |
| 104 | UINT8 cia0portb = mos6526_pb_r(dev | |
| 105 | 105 | |
| 106 | 106 | return cbm_common_cia0_port_a_r(device, cia0portb); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | static READ8_DEVICE_HANDLER( c64_cia0_port_b_r ) |
| 110 | 110 | { |
| 111 | UINT8 cia0porta = mos6526_pa_r(dev | |
| 111 | UINT8 cia0porta = mos6526_pa_r(dev | |
| 112 | 112 | |
| 113 | 113 | return cbm_common_cia0_port_b_r(device, cia0porta); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | static WRITE8_DEVICE_HANDLER( c64_cia0_port_b_w ) |
| 117 | 117 | { |
| 118 | running_device *vic2 = dev | |
| 118 | running_device *vic2 = dev | |
| 119 | 119 | vic2_lightpen_write(vic2, data & 0x10); |
| 120 | 120 | } |
| 121 | 121 | |
| r8453 | r8454 | |
| 138 | 138 | |
| 139 | 139 | void c64_vic_interrupt( running_machine *machine, int level ) |
| 140 | 140 | { |
| 141 | running_device *cia_0 = | |
| 141 | running_device *cia_0 = m | |
| 142 | 142 | #if 1 |
| 143 | 143 | if (level != vicirq) |
| 144 | 144 | { |
| r8453 | r8454 | |
| 201 | 201 | static READ8_DEVICE_HANDLER( c64_cia1_port_a_r ) |
| 202 | 202 | { |
| 203 | 203 | UINT8 value = 0xff; |
| 204 | running_device *serbus = dev | |
| 204 | running_device *serbus = dev | |
| 205 | 205 | |
| 206 | 206 | if (!cbm_iec_clk_r(serbus)) |
| 207 | 207 | value &= ~0x40; |
| r8453 | r8454 | |
| 215 | 215 | static WRITE8_DEVICE_HANDLER( c64_cia1_port_a_w ) |
| 216 | 216 | { |
| 217 | 217 | static const int helper[4] = {0xc000, 0x8000, 0x4000, 0x0000}; |
| 218 | running_device *serbus = dev | |
| 218 | running_device *serbus = dev | |
| 219 | 219 | |
| 220 | 220 | cbm_iec_clk_w(serbus, device, !(data & 0x10)); |
| 221 | 221 | cbm_iec_data_w(serbus, device, !(data & 0x20)); |
| r8453 | r8454 | |
| 265 | 265 | |
| 266 | 266 | WRITE8_HANDLER( c64_write_io ) |
| 267 | 267 | { |
| 268 | running_device *cia_0 = devtag_get_device(space->machine, "cia_0"); | |
| 269 | running_device *cia_1 = devtag_get_device(space->machine, "cia_1"); | |
| 270 | running_device *sid = devtag_get_device(space->machine, "sid6581"); | |
| 271 | running_device *vic2 = devtag_get_device(space->machine, "vic2"); | |
| 268 | running_device *cia_0 = space->machine->device("cia_0"); | |
| 269 | running_device *cia_1 = space->machine->device("cia_1"); | |
| 270 | running_device *sid = space->machine->device("sid6581"); | |
| 271 | running_device *vic2 = space->machine->device("vic2"); | |
| 272 | 272 | |
| 273 | 273 | c64_io_mirror[offset] = data; |
| 274 | 274 | if (offset < 0x400) |
| r8453 | r8454 | |
| 302 | 302 | |
| 303 | 303 | READ8_HANDLER( c64_read_io ) |
| 304 | 304 | { |
| 305 | running_device *cia_0 = devtag_get_device(space->machine, "cia_0"); | |
| 306 | running_device *cia_1 = devtag_get_device(space->machine, "cia_1"); | |
| 307 | running_device *sid = devtag_get_device(space->machine, "sid6581"); | |
| 308 | running_device *vic2 = devtag_get_device(space->machine, "vic2"); | |
| 305 | running_device *cia_0 = space->machine->device("cia_0"); | |
| 306 | running_device *cia_1 = space->machine->device("cia_1"); | |
| 307 | running_device *sid = space->machine->device("sid6581"); | |
| 308 | running_device *vic2 = space->machine->device("vic2"); | |
| 309 | 309 | |
| 310 | 310 | if (offset < 0x400) |
| 311 | 311 | return vic2_port_r(vic2, offset & 0x3ff); |
| r8453 | r8454 | |
| 591 | 591 | { |
| 592 | 592 | if (direction & 0x08) |
| 593 | 593 | { |
| 594 | cassette_output(dev | |
| 594 | cassette_output(dev | |
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | if (direction & 0x20) |
| 598 | 598 | { |
| 599 | 599 | if(!(data & 0x20)) |
| 600 | 600 | { |
| 601 | cassette_change_state(dev | |
| 601 | cassette_change_state(dev | |
| 602 | 602 | timer_adjust_periodic(datasette_timer, attotime_zero, 0, ATTOTIME_IN_HZ(44100)); |
| 603 | 603 | } |
| 604 | 604 | else |
| 605 | 605 | { |
| 606 | cassette_change_state(dev | |
| 606 | cassette_change_state(dev | |
| 607 | 607 | timer_reset(datasette_timer, attotime_never); |
| 608 | 608 | } |
| 609 | 609 | } |
| r8453 | r8454 | |
| 622 | 622 | |
| 623 | 623 | if (c64_tape_on) |
| 624 | 624 | { |
| 625 | if ((cassette_get_state(dev | |
| 625 | if ((cassette_get_state(dev | |
| 626 | 626 | data &= ~0x10; |
| 627 | 627 | else |
| 628 | 628 | data |= 0x10; |
| r8453 | r8454 | |
| 636 | 636 | { |
| 637 | 637 | running_machine *machine = device->machine; |
| 638 | 638 | int pot1 = 0xff, pot2 = 0xff, pot3 = 0xff, pot4 = 0xff, temp; |
| 639 | UINT8 cia0porta = mos6526_pa_r( | |
| 639 | UINT8 cia0porta = mos6526_pa_r(m | |
| 640 | 640 | int controller1 = input_port_read(machine, "CTRLSEL") & 0x07; |
| 641 | 641 | int controller2 = input_port_read(machine, "CTRLSEL") & 0x70; |
| 642 | 642 | |
| r8453 | r8454 | |
| 746 | 746 | |
| 747 | 747 | TIMER_CALLBACK( c64_tape_timer ) |
| 748 | 748 | { |
| 749 | double tmp = cassette_input(devtag_get_device(machine, "cassette")); | |
| 750 | running_device *cia_0 = devtag_get_device(machine, "cia_0"); | |
| 749 | double tmp = cassette_input(machine->device("cassette")); | |
| 750 | running_device *cia_0 = machine->device("cia_0"); | |
| 751 | 751 | |
| 752 | 752 | mos6526_flag_w(cia_0, tmp > +0.0); |
| 753 | 753 | } |
| r8453 | r8454 | |
|---|---|---|
| 249 | 249 | // Burst transfers will halt the CPU until the transfer is complete |
| 250 | 250 | if((dmac->reg[channel].dcr & 0xc0) == 0x00) // Burst transfer |
| 251 | 251 | { |
| 252 | running_device *cpu = dev | |
| 252 | running_device *cpu = dev | |
| 253 | 253 | cpu_set_input_line(cpu, INPUT_LINE_HALT, ASSERT_LINE); |
| 254 | 254 | timer_adjust_periodic(dmac->timer[channel], attotime_zero, channel, dmac->burst_clock[channel]); |
| 255 | 255 | } |
| r8453 | r8454 | |
| 431 | 431 | // Burst transfer |
| 432 | 432 | if((dmac->reg[x].dcr & 0xc0) == 0x00) |
| 433 | 433 | { |
| 434 | running_device *cpu = dev | |
| 434 | running_device *cpu = dev | |
| 435 | 435 | cpu_set_input_line(cpu, INPUT_LINE_HALT, CLEAR_LINE); |
| 436 | 436 | } |
| 437 | 437 |
| r8453 | r8454 | |
|---|---|---|
| 579 | 579 | static void alloc_sram(running_machine *machine) |
| 580 | 580 | { |
| 581 | 581 | genesis_sram = auto_alloc_array(machine, UINT16, (genesis_sram_end - genesis_sram_start + 1) / sizeof(UINT16)); |
| 582 | device_image_interface *image = dynamic_cast<device_image_interface *>( | |
| 582 | device_image_interface *image = dynamic_cast<device_image_interface *>(m | |
| 583 | 583 | image->battery_load(genesis_sram, genesis_sram_end - genesis_sram_start + 1, 0x00); |
| 584 | 584 | memcpy(megadriv_backupram, genesis_sram, genesis_sram_end - genesis_sram_start + 1); |
| 585 | 585 | } |
| r8453 | r8454 | |
|---|---|---|
| 285 | 285 | hsgpl.cur_bank = 0; |
| 286 | 286 | hsgpl.cru_reg = 0; |
| 287 | 287 | |
| 288 | expansion_box = | |
| 288 | expansion_box = m | |
| 289 | 289 | |
| 290 | 290 | /* Card is enabled on startup. */ |
| 291 | 291 | ti99_set_hsgpl_crdena(1); |
| r8453 | r8454 | |
|---|---|---|
| 247 | 247 | |
| 248 | 248 | void pc_speaker_set_spkrdata(running_machine *machine, UINT8 data) |
| 249 | 249 | { |
| 250 | running_device *speaker = | |
| 250 | running_device *speaker = m | |
| 251 | 251 | pc_state *st = (pc_state *)machine->driver_data; |
| 252 | 252 | st->pc_spkrdata = data ? 1 : 0; |
| 253 | 253 | speaker_level_w( speaker, pc_speaker_get_spk(machine) ); |
| r8453 | r8454 | |
| 256 | 256 | |
| 257 | 257 | void pc_speaker_set_input(running_machine *machine, UINT8 data) |
| 258 | 258 | { |
| 259 | running_device *speaker = | |
| 259 | running_device *speaker = m | |
| 260 | 260 | pc_state *st = (pc_state *)machine->driver_data; |
| 261 | 261 | st->pc_input = data ? 1 : 0; |
| 262 | 262 | speaker_level_w( speaker, pc_speaker_get_spk(machine) ); |
| r8453 | r8454 | |
| 617 | 617 | * 6-7 The number of floppy disk drives |
| 618 | 618 | */ |
| 619 | 619 | data = input_port_read(device->machine, "DSW0") & 0xF3; |
| 620 | switch ( messram_get_size( | |
| 620 | switch ( messram_get_size(m | |
| 621 | 621 | { |
| 622 | 622 | case 16 * 1024: |
| 623 | 623 | data |= 0x00; |
| r8453 | r8454 | |
| 668 | 668 | /* read hi nibble of SW2 */ |
| 669 | 669 | data = data & 0xf0; |
| 670 | 670 | |
| 671 | switch ( messram_get_size( | |
| 671 | switch ( messram_get_size(m | |
| 672 | 672 | { |
| 673 | 673 | case 64 * 1024: data |= 0x00; break; |
| 674 | 674 | case 128 * 1024: data |= 0x02; break; |
| r8453 | r8454 | |
| 686 | 686 | case 896 * 1024: data |= 0x0B; break; |
| 687 | 687 | case 960 * 1024: data |= 0x0D; break; |
| 688 | 688 | } |
| 689 | if ( messram_get_size( | |
| 689 | if ( messram_get_size(m | |
| 690 | 690 | data |= 0x0D; |
| 691 | 691 | |
| 692 | 692 | PIO_LOG(1,"PIO_C_r (hi)",("$%02x\n", data)); |
| r8453 | r8454 | |
| 700 | 700 | |
| 701 | 701 | if ( ! ( st->ppi_portb & 0x08 ) ) |
| 702 | 702 | { |
| 703 | double tap_val = cassette_input( dev | |
| 703 | double tap_val = cassette_input( dev | |
| 704 | 704 | |
| 705 | 705 | if ( tap_val < 0 ) |
| 706 | 706 | { |
| r8453 | r8454 | |
| 736 | 736 | static WRITE8_DEVICE_HANDLER ( ibm5150_ppi_portb_w ) |
| 737 | 737 | { |
| 738 | 738 | pc_state *st = (pc_state *)device->machine->driver_data; |
| 739 | running_device *keyboard = dev | |
| 739 | running_device *keyboard = dev | |
| 740 | 740 | |
| 741 | 741 | /* KB controller port B */ |
| 742 | 742 | st->ppi_portb = data; |
| r8453 | r8454 | |
| 746 | 746 | pit8253_gate2_w(st->pit8253, BIT(data, 0)); |
| 747 | 747 | pc_speaker_set_spkrdata( device->machine, data & 0x02 ); |
| 748 | 748 | |
| 749 | cassette_change_state( dev | |
| 749 | cassette_change_state( dev | |
| 750 | 750 | |
| 751 | 751 | st->ppi_clock_signal = ( st->ppi_keyb_clock ) ? 1 : 0; |
| 752 | 752 | kb_keytronic_clock_w(keyboard, st->ppi_clock_signal); |
| r8453 | r8454 | |
| 773 | 773 | WRITE8_HANDLER( ibm5150_kb_set_clock_signal ) |
| 774 | 774 | { |
| 775 | 775 | pc_state *st = (pc_state *)space->machine->driver_data; |
| 776 | running_device *keyboard = | |
| 776 | running_device *keyboard = | |
| 777 | 777 | |
| 778 | 778 | if ( st->ppi_clock_signal != data ) |
| 779 | 779 | { |
| r8453 | r8454 | |
| 807 | 807 | WRITE8_HANDLER( ibm5150_kb_set_data_signal ) |
| 808 | 808 | { |
| 809 | 809 | pc_state *st = (pc_state *)space->machine->driver_data; |
| 810 | running_device *keyboard = | |
| 810 | running_device *keyboard = | |
| 811 | 811 | |
| 812 | 812 | st->ppi_data_signal = data; |
| 813 | 813 | |
| r8453 | r8454 | |
| 894 | 894 | static WRITE8_DEVICE_HANDLER( ibm5160_ppi_portb_w ) |
| 895 | 895 | { |
| 896 | 896 | pc_state *st = (pc_state *)device->machine->driver_data; |
| 897 | running_device *keyboard = dev | |
| 897 | running_device *keyboard = dev | |
| 898 | 898 | |
| 899 | 899 | /* PPI controller port B*/ |
| 900 | 900 | st->ppi_portb = data; |
| r8453 | r8454 | |
| 991 | 991 | /* KB controller port B */ |
| 992 | 992 | st->ppi_portb = data; |
| 993 | 993 | st->ppi_portc_switch_high = data & 0x08; |
| 994 | pit8253_gate2_w(dev | |
| 994 | pit8253_gate2_w(dev | |
| 995 | 995 | pc_speaker_set_spkrdata( device->machine, data & 0x02 ); |
| 996 | 996 | |
| 997 | cassette_change_state( dev | |
| 997 | cassette_change_state( dev | |
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | 1000 | |
| r8453 | r8454 | |
| 1026 | 1026 | static READ8_DEVICE_HANDLER ( pcjr_ppi_portc_r ) |
| 1027 | 1027 | { |
| 1028 | 1028 | pc_state *st = (pc_state *)device->machine->driver_data; |
| 1029 | int timer2_output = pit8253_get_output( dev | |
| 1029 | int timer2_output = pit8253_get_output( dev | |
| 1030 | 1030 | int data=0xff; |
| 1031 | 1031 | |
| 1032 | 1032 | data&=~0x80; |
| 1033 | 1033 | data &= ~0x04; /* floppy drive installed */ |
| 1034 | if ( messram_get_size(dev | |
| 1034 | if ( messram_get_size(dev | |
| 1035 | 1035 | data &= ~0x08; |
| 1036 | 1036 | data = ( data & ~0x01 ) | ( pcjr_keyb.latch ? 0x01: 0x00 ); |
| 1037 | 1037 | if ( ! ( st->ppi_portb & 0x08 ) ) |
| 1038 | 1038 | { |
| 1039 | double tap_val = cassette_input( dev | |
| 1039 | double tap_val = cassette_input( dev | |
| 1040 | 1040 | |
| 1041 | 1041 | if ( tap_val < 0 ) |
| 1042 | 1042 | { |
| r8453 | r8454 | |
| 1095 | 1095 | |
| 1096 | 1096 | static running_device * pc_get_device(running_machine *machine ) |
| 1097 | 1097 | { |
| 1098 | return | |
| 1098 | return m | |
| 1099 | 1099 | } |
| 1100 | 1100 | |
| 1101 | 1101 | static const struct pc_fdc_interface fdc_interface_nc = |
| r8453 | r8454 | |
| 1151 | 1151 | init_pc_common(machine, flags, set_keyb_int_func); |
| 1152 | 1152 | |
| 1153 | 1153 | /* MESS managed RAM */ |
| 1154 | if ( messram_get_ptr(devtag_get_device(machine, "messram")) ) | |
| 1155 | memory_set_bankptr( machine, "bank10", messram_get_ptr(devtag_get_device(machine, "messram")) ); | |
| 1154 | if ( messram_get_ptr(machine->device("messram")) ) | |
| 1155 | memory_set_bankptr( machine, "bank10", messram_get_ptr(machine->device("messram")) ); | |
| 1156 | 1156 | |
| 1157 | 1157 | /* FDC/HDC hardware */ |
| 1158 | 1158 | pc_hdc_setup(machine, set_hdc_int_func); |
| r8453 | r8454 | |
| 1326 | 1326 | { |
| 1327 | 1327 | pc_state *st = (pc_state *)machine->driver_data; |
| 1328 | 1328 | |
| 1329 | st->pic8259 = devtag_get_device(machine, "pic8259"); | |
| 1330 | st->dma8237 = devtag_get_device(machine, "dma8237"); | |
| 1331 | st->pit8253 = devtag_get_device(machine, "pit8253"); | |
| 1329 | st->pic8259 = machine->device("pic8259"); | |
| 1330 | st->dma8237 = machine->device("dma8237"); | |
| 1331 | st->pit8253 = machine->device("pit8253"); | |
| 1332 | 1332 | pc_fdc_init( machine, &fdc_interface_nc ); |
| 1333 | 1333 | } |
| 1334 | 1334 | |
| 1335 | 1335 | |
| 1336 | 1336 | MACHINE_RESET( pc ) |
| 1337 | 1337 | { |
| 1338 | running_device *speaker = | |
| 1338 | running_device *speaker = m | |
| 1339 | 1339 | pc_state *st = (pc_state *)machine->driver_data; |
| 1340 | 1340 | memset(st,0,sizeof(st)); |
| 1341 | st->maincpu = | |
| 1341 | st->maincpu = m | |
| 1342 | 1342 | cpu_set_irq_callback(st->maincpu, pc_irq_callback); |
| 1343 | 1343 | |
| 1344 | 1344 | st->u73_q2 = 0; |
| 1345 | 1345 | st->out1 = 0; |
| 1346 | 1346 | st->pc_spkrdata = 0; |
| 1347 | 1347 | st->pc_input = 0; |
| 1348 | pc_mouse_set_serial_port( | |
| 1348 | pc_mouse_set_serial_port( m | |
| 1349 | 1349 | pc_hdc_set_dma8237_device( st->dma8237 ); |
| 1350 | 1350 | speaker_level_w( speaker, 0 ); |
| 1351 | 1351 | } |
| r8453 | r8454 | |
| 1357 | 1357 | pc_fdc_init( machine, &pcjr_fdc_interface_nc ); |
| 1358 | 1358 | pcjr_keyb.keyb_signal_timer = timer_alloc(machine, pcjr_keyb_signal_callback, NULL ); |
| 1359 | 1359 | pc_int_delay_timer = timer_alloc(machine, pcjr_delayed_pic8259_irq, NULL ); |
| 1360 | st->maincpu = | |
| 1360 | st->maincpu = m | |
| 1361 | 1361 | cpu_set_irq_callback(st->maincpu, pc_irq_callback); |
| 1362 | 1362 | |
| 1363 | st->pic8259 = | |
| 1363 | st->pic8259 = m | |
| 1364 | 1364 | st->dma8237 = NULL; |
| 1365 | st->pit8253 = | |
| 1365 | st->pit8253 = m | |
| 1366 | 1366 | } |
| 1367 | 1367 | |
| 1368 | 1368 | |
| 1369 | 1369 | MACHINE_RESET( pcjr ) |
| 1370 | 1370 | { |
| 1371 | running_device *speaker = | |
| 1371 | running_device *speaker = m | |
| 1372 | 1372 | pc_state *st = (pc_state *)machine->driver_data; |
| 1373 | 1373 | memset(st,0,sizeof(st)); |
| 1374 | 1374 | st->u73_q2 = 0; |
| 1375 | 1375 | st->out1 = 0; |
| 1376 | 1376 | st->pc_spkrdata = 0; |
| 1377 | 1377 | st->pc_input = 0; |
| 1378 | pc_mouse_set_serial_port( | |
| 1378 | pc_mouse_set_serial_port( m | |
| 1379 | 1379 | pc_hdc_set_dma8237_device( st->dma8237 ); |
| 1380 | 1380 | speaker_level_w( speaker, 0 ); |
| 1381 | 1381 |
| r8453 | r8454 | |
|---|---|---|
| 44 | 44 | memory_install_read_bank (space, 0xf000, 0xf7ff, 0, 0, "bank3"); |
| 45 | 45 | memory_install_read_bank (space, 0xf800, 0xffff, 0, 0, "bank4"); |
| 46 | 46 | memory_set_bankptr(machine, "bank1", rom + 0x8000); |
| 47 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 47 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 48 | 48 | memory_set_bankptr(machine, "bank3", rom + 0xf000); |
| 49 | 49 | memory_set_bankptr(machine, "bank4", rom + 0xf800); |
| 50 | 50 | |
| r8453 | r8454 | |
| 58 | 58 | |
| 59 | 59 | WRITE8_HANDLER( pecom_bank_w ) |
| 60 | 60 | { |
| 61 | running_device *cdp1869 = | |
| 61 | running_device *cdp1869 = | |
| 62 | 62 | const address_space *space2 = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 63 | 63 | UINT8 *rom = memory_region(space->machine, "maincpu"); |
| 64 | 64 | memory_install_write_bank(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, "bank1"); |
| 65 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr( | |
| 65 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr( | |
| 66 | 66 | |
| 67 | 67 | if (data==2) |
| 68 | 68 | { |
| r8453 | r8454 | |
| 95 | 95 | Address is available on address bus during reading of value from port, and that is |
| 96 | 96 | used to determine keyboard line reading |
| 97 | 97 | */ |
| 98 | UINT16 addr = cpu_get_reg( | |
| 98 | UINT16 addr = cpu_get_reg( | |
| 99 | 99 | /* just in case somone is reading non existing ports */ |
| 100 | 100 | if (addr<0x7cca || addr>0x7ce3) return 0; |
| 101 | 101 | return input_port_read(space->machine, keynames[addr - 0x7cca]) & 0x03; |
| r8453 | r8454 | |
| 111 | 111 | |
| 112 | 112 | static running_device *cassette_device_image(running_machine *machine) |
| 113 | 113 | { |
| 114 | return | |
| 114 | return m | |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | static CDP1802_EF_READ( pecom64_ef_r ) |
| r8453 | r8454 | |
|---|---|---|
| 381 | 381 | if ( pce_cd.cdda_status != PCE_CD_CDDA_OFF ) |
| 382 | 382 | { |
| 383 | 383 | pce_cd.cdda_status = PCE_CD_CDDA_OFF; |
| 384 | cdda_stop_audio( | |
| 384 | cdda_stop_audio( m | |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | pce_cd.current_frame = frame; |
| r8453 | r8454 | |
| 430 | 430 | if ( pce_cd.cdda_play_mode ) |
| 431 | 431 | { |
| 432 | 432 | pce_cd.cdda_status = PCE_CD_CDDA_PLAYING; |
| 433 | cdda_start_audio( | |
| 433 | cdda_start_audio( m | |
| 434 | 434 | } |
| 435 | 435 | else |
| 436 | 436 | { |
| 437 | 437 | pce_cd.cdda_status = PCE_CD_CDDA_OFF; |
| 438 | cdda_stop_audio( | |
| 438 | cdda_stop_audio( m | |
| 439 | 439 | pce_cd.end_frame = pce_cd.last_frame; |
| 440 | 440 | } |
| 441 | 441 | |
| r8453 | r8454 | |
| 477 | 477 | { |
| 478 | 478 | if ( pce_cd.cdda_status == PCE_CD_CDDA_PAUSED ) |
| 479 | 479 | { |
| 480 | cdda_pause_audio( | |
| 480 | cdda_pause_audio( m | |
| 481 | 481 | } |
| 482 | 482 | else |
| 483 | 483 | { |
| 484 | cdda_start_audio( | |
| 484 | cdda_start_audio( m | |
| 485 | 485 | } |
| 486 | 486 | pce_cd.cdda_status = PCE_CD_CDDA_PLAYING; |
| 487 | 487 | } |
| 488 | 488 | else |
| 489 | 489 | { |
| 490 | 490 | pce_cd.cdda_status = PCE_CD_CDDA_OFF; |
| 491 | cdda_stop_audio( | |
| 491 | cdda_stop_audio( m | |
| 492 | 492 | pce_cd.end_frame = pce_cd.last_frame; |
| 493 | 493 | // assert( NULL == pce_cd_nec_set_audio_stop_position ); |
| 494 | 494 | } |
| r8453 | r8454 | |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | pce_cd.cdda_status = PCE_CD_CDDA_PAUSED; |
| 519 | pce_cd.current_frame = cdda_get_audio_lba( devtag_get_device( machine, "cdda" ) ); | |
| 520 | cdda_pause_audio( devtag_get_device( machine, "cdda" ), 1 ); | |
| 519 | pce_cd.current_frame = cdda_get_audio_lba( machine->device( "cdda" ) ); | |
| 520 | cdda_pause_audio( machine->device( "cdda" ), 1 ); | |
| 521 | 521 | pce_cd_reply_status_byte( SCSI_STATUS_OK ); |
| 522 | 522 | } |
| 523 | 523 | |
| r8453 | r8454 | |
| 540 | 540 | { |
| 541 | 541 | case PCE_CD_CDDA_PAUSED: |
| 542 | 542 | pce_cd.data_buffer[0] = 2; |
| 543 | frame = cdda_get_audio_lba( | |
| 543 | frame = cdda_get_audio_lba( m | |
| 544 | 544 | break; |
| 545 | 545 | case PCE_CD_CDDA_PLAYING: |
| 546 | 546 | pce_cd.data_buffer[0] = 0; |
| 547 | frame = cdda_get_audio_lba( | |
| 547 | frame = cdda_get_audio_lba( m | |
| 548 | 548 | break; |
| 549 | 549 | default: |
| 550 | 550 | pce_cd.data_buffer[0] = 3; |
| r8453 | r8454 | |
| 951 | 951 | |
| 952 | 952 | pce_cd.subcode_buffer = auto_alloc_array(machine, UINT8, 96 ); |
| 953 | 953 | |
| 954 | device = | |
| 954 | device = m | |
| 955 | 955 | if ( device ) |
| 956 | 956 | { |
| 957 | 957 | pce_cd.cd = mess_cd_get_cdrom_file(device); |
| 958 | 958 | if ( pce_cd.cd ) |
| 959 | 959 | { |
| 960 | 960 | pce_cd.toc = cdrom_get_toc( pce_cd.cd ); |
| 961 | cdda_set_cdrom( | |
| 961 | cdda_set_cdrom( m | |
| 962 | 962 | pce_cd.last_frame = cdrom_get_track_start( pce_cd.cd, cdrom_get_last_track( pce_cd.cd ) - 1 ); |
| 963 | 963 | pce_cd.last_frame += pce_cd.toc->tracks[ cdrom_get_last_track( pce_cd.cd ) - 1 ].frames; |
| 964 | 964 | pce_cd.end_frame = pce_cd.last_frame; |
| r8453 | r8454 | |
| 1044 | 1044 | /* Reset ADPCM hardware */ |
| 1045 | 1045 | pce_cd.adpcm_read_ptr = 0; |
| 1046 | 1046 | pce_cd.adpcm_write_ptr = 0; |
| 1047 | msm5205_reset_w( | |
| 1047 | msm5205_reset_w( | |
| 1048 | 1048 | } |
| 1049 | 1049 | if ( data & 0x10 ) |
| 1050 | 1050 | { |
| r8453 | r8454 | |
|---|---|---|
| 263 | 263 | |
| 264 | 264 | /* tms9900_ICount: used to implement memory waitstates (hack) */ |
| 265 | 265 | /* tms9995_ICount: used to implement memory waitstates (hack) */ |
| 266 | /* NPW 23-Feb-2004 - externs no longer needed because we now use cpu_adjust_icount( | |
| 266 | /* NPW 23-Feb-2004 - externs no longer needed because we now use cpu_adjust_icount( | |
| 267 | 267 | |
| 268 | 268 | /* Link to the cartridge system. */ |
| 269 | 269 | static running_device *cartslots; |
| r8453 | r8454 | |
| 407 | 407 | |
| 408 | 408 | /* Find the cartslot device and cache it. This is a string search, */ |
| 409 | 409 | /* and we don't want to repeat it on each memory access. */ |
| 410 | cartslots = | |
| 410 | cartslots = m | |
| 411 | 411 | assert(cartslots != NULL); |
| 412 | 412 | } |
| 413 | 413 | |
| r8453 | r8454 | |
| 424 | 424 | console_GROMs.raddr_LSB = FALSE; |
| 425 | 425 | console_GROMs.waddr_LSB = FALSE; |
| 426 | 426 | |
| 427 | expansion_box = | |
| 427 | expansion_box = m | |
| 428 | 428 | |
| 429 | 429 | /* set up scratch pad pointer */ |
| 430 | 430 | memory_set_bankptr(machine, "bank1", memory_region(machine, "maincpu") + offset_sram); |
| r8453 | r8454 | |
| 441 | 441 | handset_buflen = 0; |
| 442 | 442 | handset_clock = 0; |
| 443 | 443 | handset_ack = 0; |
| 444 | tms9901_set_single_int( | |
| 444 | tms9901_set_single_int(m | |
| 445 | 445 | |
| 446 | 446 | /* read config */ |
| 447 | 447 | xRAM_kind = input_port_read(machine, "RAM"); |
| r8453 | r8454 | |
| 651 | 651 | */ |
| 652 | 652 | READ16_HANDLER ( ti99_nop_8_r ) |
| 653 | 653 | { |
| 654 | cpu_adjust_icount( | |
| 654 | cpu_adjust_icount( | |
| 655 | 655 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 656 | 656 | |
| 657 | 657 | return (0); |
| r8453 | r8454 | |
| 659 | 659 | |
| 660 | 660 | WRITE16_HANDLER ( ti99_nop_8_w ) |
| 661 | 661 | { |
| 662 | cpu_adjust_icount( | |
| 662 | cpu_adjust_icount( | |
| 663 | 663 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 664 | 664 | } |
| 665 | 665 | |
| r8453 | r8454 | |
| 728 | 728 | */ |
| 729 | 729 | WRITE16_HANDLER ( ti99_wsnd_w ) |
| 730 | 730 | { |
| 731 | cpu_adjust_icount( | |
| 731 | cpu_adjust_icount( | |
| 732 | 732 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 733 | 733 | |
| 734 | sn76496_w( | |
| 734 | sn76496_w( | |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | /* |
| r8453 | r8454 | |
| 739 | 739 | */ |
| 740 | 740 | READ16_HANDLER ( ti99_rvdp_r ) |
| 741 | 741 | { |
| 742 | cpu_adjust_icount( | |
| 742 | cpu_adjust_icount( | |
| 743 | 743 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 744 | 744 | |
| 745 | 745 | if (offset & 1) |
| r8453 | r8454 | |
| 757 | 757 | */ |
| 758 | 758 | WRITE16_HANDLER ( ti99_wvdp_w ) |
| 759 | 759 | { |
| 760 | cpu_adjust_icount( | |
| 760 | cpu_adjust_icount( | |
| 761 | 761 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 762 | 762 | |
| 763 | 763 | if (offset & 1) |
| r8453 | r8454 | |
| 775 | 775 | */ |
| 776 | 776 | static READ16_HANDLER ( ti99_rspeech_r ) |
| 777 | 777 | { |
| 778 | cpu_adjust_icount( | |
| 778 | cpu_adjust_icount( | |
| 779 | 779 | |
| 780 | return ((int) tms5220_status_r( | |
| 780 | return ((int) tms5220_status_r( | |
| 781 | 781 | } |
| 782 | 782 | |
| 783 | 783 | #if 0 |
| r8453 | r8454 | |
| 801 | 801 | */ |
| 802 | 802 | static WRITE16_HANDLER ( ti99_wspeech_w ) |
| 803 | 803 | { |
| 804 | cpu_adjust_icount( | |
| 804 | cpu_adjust_icount( | |
| 805 | 805 | |
| 806 | 806 | #if 1 |
| 807 | 807 | /* the stupid design of the tms5220 core means that ready is cleared */ |
| 808 | 808 | /* when there are 15 bytes in FIFO. It should be 16. Of course, if */ |
| 809 | 809 | /* it were the case, we would need to store the value on the bus, */ |
| 810 | 810 | /* which would be more complex. */ |
| 811 | if (! tms5220_readyq_r( | |
| 811 | if (! tms5220_readyq_r( | |
| 812 | 812 | { |
| 813 | attotime time_to_ready = double_to_attotime(tms5220_time_to_ready( | |
| 813 | attotime time_to_ready = double_to_attotime(tms5220_time_to_ready( | |
| 814 | 814 | int cycles_to_ready = cputag_attotime_to_clocks(space->machine, "maincpu", time_to_ready); |
| 815 | 815 | |
| 816 | 816 | logerror("time to ready: %f -> %d\n", attotime_to_double(time_to_ready), (int) cycles_to_ready); |
| 817 | 817 | |
| 818 | cpu_adjust_icount( | |
| 818 | cpu_adjust_icount( | |
| 819 | 819 | timer_set(space->machine, attotime_zero, NULL, 0, /*speech_kludge_callback*/NULL); |
| 820 | 820 | } |
| 821 | 821 | #endif |
| 822 | 822 | |
| 823 | tms5220_data_w( | |
| 823 | tms5220_data_w( | |
| 824 | 824 | } |
| 825 | 825 | |
| 826 | 826 | static UINT8 GROM_dataread(running_machine *machine, offs_t offset) |
| r8453 | r8454 | |
| 896 | 896 | { |
| 897 | 897 | UINT16 reply, replycart; |
| 898 | 898 | |
| 899 | cpu_adjust_icount( | |
| 899 | cpu_adjust_icount( | |
| 900 | 900 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 901 | 901 | |
| 902 | 902 | /* This implementation features a multislot cartridge system which */ |
| r8453 | r8454 | |
| 981 | 981 | */ |
| 982 | 982 | WRITE16_HANDLER ( ti99_grom_w ) |
| 983 | 983 | { |
| 984 | cpu_adjust_icount( | |
| 984 | cpu_adjust_icount( | |
| 985 | 985 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 986 | 986 | |
| 987 | 987 | if (offset & 1) |
| r8453 | r8454 | |
| 1075 | 1075 | handset_clock = ! handset_clock; |
| 1076 | 1076 | handset_buf >>= 4; |
| 1077 | 1077 | handset_buflen--; |
| 1078 | tms9901_set_single_int( | |
| 1078 | tms9901_set_single_int(m | |
| 1079 | 1079 | |
| 1080 | 1080 | if (handset_buflen == 1) |
| 1081 | 1081 | { |
| r8453 | r8454 | |
| 1122 | 1122 | handset_clock = 1; |
| 1123 | 1123 | handset_buf = ~ message; |
| 1124 | 1124 | handset_buflen = 3; |
| 1125 | tms9901_set_single_int( | |
| 1125 | tms9901_set_single_int(m | |
| 1126 | 1126 | } |
| 1127 | 1127 | |
| 1128 | 1128 | /* |
| r8453 | r8454 | |
| 1499 | 1499 | */ |
| 1500 | 1500 | void tms9901_set_int1(running_machine *machine, int state) |
| 1501 | 1501 | { |
| 1502 | tms9901_set_single_int( | |
| 1502 | tms9901_set_single_int(m | |
| 1503 | 1503 | } |
| 1504 | 1504 | |
| 1505 | 1505 | /* |
| r8453 | r8454 | |
| 1507 | 1507 | */ |
| 1508 | 1508 | void tms9901_set_int2(running_machine *machine, int state) |
| 1509 | 1509 | { |
| 1510 | tms9901_set_single_int( | |
| 1510 | tms9901_set_single_int(m | |
| 1511 | 1511 | } |
| 1512 | 1512 | |
| 1513 | 1513 | /* |
| r8453 | r8454 | |
| 1592 | 1592 | |
| 1593 | 1593 | /* we don't take CS2 into account, as CS2 is a write-only unit */ |
| 1594 | 1594 | #if 0 |
| 1595 | if (cassette_input(dev | |
| 1595 | if (cassette_input(dev | |
| 1596 | 1596 | answer |= 8; |
| 1597 | 1597 | #endif |
| 1598 | 1598 | |
| r8453 | r8454 | |
| 1627 | 1627 | /* we don't take CS2 into account, as CS2 is a write-only unit */ |
| 1628 | 1628 | if ( (ti99_model != model_99_8) && (ti99_model != model_99_4p)) |
| 1629 | 1629 | { |
| 1630 | if (cassette_input(dev | |
| 1630 | if (cassette_input(dev | |
| 1631 | 1631 | answer |= 8; |
| 1632 | 1632 | } |
| 1633 | 1633 | else |
| 1634 | 1634 | { |
| 1635 | if (cassette_input(dev | |
| 1635 | if (cassette_input(dev | |
| 1636 | 1636 | answer |= 8; |
| 1637 | 1637 | } |
| 1638 | 1638 | |
| r8453 | r8454 | |
| 1697 | 1697 | |
| 1698 | 1698 | /* we don't take CS2 into account, as CS2 is a write-only unit */ |
| 1699 | 1699 | #if 0 |
| 1700 | if (cassette_input( | |
| 1700 | if (cassette_input(m | |
| 1701 | 1701 | answer |= 8; |
| 1702 | 1702 | #endif |
| 1703 | 1703 | |
| r8453 | r8454 | |
| 1713 | 1713 | |
| 1714 | 1714 | if ( (ti99_model != model_99_8) && (ti99_model != model_99_4p)) |
| 1715 | 1715 | { |
| 1716 | img = dev | |
| 1716 | img = dev | |
| 1717 | 1717 | } |
| 1718 | 1718 | else |
| 1719 | 1719 | { |
| 1720 | img = dev | |
| 1720 | img = dev | |
| 1721 | 1721 | } |
| 1722 | 1722 | cassette_change_state(img, data ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); |
| 1723 | 1723 | } |
| r8453 | r8454 | |
| 1743 | 1743 | { |
| 1744 | 1744 | if ((ti99_model != model_99_8) && (ti99_model != model_99_4p)) /* 99/8 only has one tape port!!! */ |
| 1745 | 1745 | { |
| 1746 | cassette_output(devtag_get_device(device->machine, "cassette1"), data ? +1 : -1); | |
| 1747 | cassette_output(devtag_get_device(device->machine, "cassette2"), data ? +1 : -1); | |
| 1746 | cassette_output(device->machine->device("cassette1"), data ? +1 : -1); | |
| 1747 | cassette_output(device->machine->device("cassette2"), data ? +1 : -1); | |
| 1748 | 1748 | } |
| 1749 | 1749 | else |
| 1750 | 1750 | { |
| 1751 | cassette_output(dev | |
| 1751 | cassette_output(dev | |
| 1752 | 1752 | } |
| 1753 | 1753 | } |
| 1754 | 1754 | |
| r8453 | r8454 | |
| 1816 | 1816 | /* low 8 kb: 0x2000-0x3fff */ |
| 1817 | 1817 | static READ16_HANDLER ( ti99_TIxramlow_r ) |
| 1818 | 1818 | { |
| 1819 | cpu_adjust_icount( | |
| 1819 | cpu_adjust_icount( | |
| 1820 | 1820 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 1821 | 1821 | |
| 1822 | 1822 | return xRAM_ptr[offset]; |
| r8453 | r8454 | |
| 1824 | 1824 | |
| 1825 | 1825 | static WRITE16_HANDLER ( ti99_TIxramlow_w ) |
| 1826 | 1826 | { |
| 1827 | cpu_adjust_icount( | |
| 1827 | cpu_adjust_icount( | |
| 1828 | 1828 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 1829 | 1829 | COMBINE_DATA(xRAM_ptr + offset); |
| 1830 | 1830 | } |
| r8453 | r8454 | |
| 1832 | 1832 | /* high 24 kb: 0xa000-0xffff */ |
| 1833 | 1833 | static READ16_HANDLER ( ti99_TIxramhigh_r ) |
| 1834 | 1834 | { |
| 1835 | cpu_adjust_icount( | |
| 1835 | cpu_adjust_icount( | |
| 1836 | 1836 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 1837 | 1837 | return xRAM_ptr[offset+0x1000]; |
| 1838 | 1838 | } |
| 1839 | 1839 | |
| 1840 | 1840 | static WRITE16_HANDLER ( ti99_TIxramhigh_w ) |
| 1841 | 1841 | { |
| 1842 | cpu_adjust_icount( | |
| 1842 | cpu_adjust_icount( | |
| 1843 | 1843 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 1844 | 1844 | |
| 1845 | 1845 | COMBINE_DATA(xRAM_ptr + offset+0x1000); |
| r8453 | r8454 | |
| 1921 | 1921 | /* low 8 kb: 0x2000-0x3fff */ |
| 1922 | 1922 | static READ16_HANDLER ( ti99_sAMSxramlow_r ) |
| 1923 | 1923 | { |
| 1924 | cpu_adjust_icount( | |
| 1924 | cpu_adjust_icount( | |
| 1925 | 1925 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 1926 | 1926 | |
| 1927 | 1927 | if (sAMS_mapper_on) |
| r8453 | r8454 | |
| 1932 | 1932 | |
| 1933 | 1933 | static WRITE16_HANDLER ( ti99_sAMSxramlow_w ) |
| 1934 | 1934 | { |
| 1935 | cpu_adjust_icount( | |
| 1935 | cpu_adjust_icount( | |
| 1936 | 1936 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 1937 | 1937 | |
| 1938 | 1938 | if (sAMS_mapper_on) |
| r8453 | r8454 | |
| 1944 | 1944 | /* high 24 kb: 0xa000-0xffff */ |
| 1945 | 1945 | static READ16_HANDLER ( ti99_sAMSxramhigh_r ) |
| 1946 | 1946 | { |
| 1947 | cpu_adjust_icount( | |
| 1947 | cpu_adjust_icount( | |
| 1948 | 1948 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 1949 | 1949 | |
| 1950 | 1950 | if (sAMS_mapper_on) |
| r8453 | r8454 | |
| 1955 | 1955 | |
| 1956 | 1956 | static WRITE16_HANDLER ( ti99_sAMSxramhigh_w ) |
| 1957 | 1957 | { |
| 1958 | cpu_adjust_icount( | |
| 1958 | cpu_adjust_icount( | |
| 1959 | 1959 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 1960 | 1960 | |
| 1961 | 1961 | if (sAMS_mapper_on) |
| r8453 | r8454 | |
| 2064 | 2064 | /* low 8 kb: 0x2000-0x3fff */ |
| 2065 | 2065 | static READ16_HANDLER ( ti99_myarcxramlow_r ) |
| 2066 | 2066 | { |
| 2067 | cpu_adjust_icount( | |
| 2067 | cpu_adjust_icount( | |
| 2068 | 2068 | return xRAM_ptr[myarc_cur_page_offset + offset]; |
| 2069 | 2069 | } |
| 2070 | 2070 | |
| 2071 | 2071 | static WRITE16_HANDLER ( ti99_myarcxramlow_w ) |
| 2072 | 2072 | { |
| 2073 | cpu_adjust_icount( | |
| 2073 | cpu_adjust_icount( | |
| 2074 | 2074 | COMBINE_DATA(xRAM_ptr + myarc_cur_page_offset + offset); |
| 2075 | 2075 | } |
| 2076 | 2076 | |
| 2077 | 2077 | /* high 24 kb: 0xa000-0xffff */ |
| 2078 | 2078 | static READ16_HANDLER ( ti99_myarcxramhigh_r ) |
| 2079 | 2079 | { |
| 2080 | cpu_adjust_icount( | |
| 2080 | cpu_adjust_icount( | |
| 2081 | 2081 | return xRAM_ptr[myarc_cur_page_offset + offset+0x1000]; |
| 2082 | 2082 | } |
| 2083 | 2083 | |
| 2084 | 2084 | static WRITE16_HANDLER ( ti99_myarcxramhigh_w ) |
| 2085 | 2085 | { |
| 2086 | cpu_adjust_icount( | |
| 2086 | cpu_adjust_icount( | |
| 2087 | 2087 | COMBINE_DATA(xRAM_ptr + myarc_cur_page_offset + offset+0x1000); |
| 2088 | 2088 | } |
| 2089 | 2089 | |
| r8453 | r8454 | |
| 2205 | 2205 | */ |
| 2206 | 2206 | READ16_HANDLER ( ti99_rv38_r ) |
| 2207 | 2207 | { |
| 2208 | cpu_adjust_icount( | |
| 2208 | cpu_adjust_icount( | |
| 2209 | 2209 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 2210 | 2210 | |
| 2211 | 2211 | if (offset & 1) |
| r8453 | r8454 | |
| 2223 | 2223 | */ |
| 2224 | 2224 | WRITE16_HANDLER ( ti99_wv38_w ) |
| 2225 | 2225 | { |
| 2226 | cpu_adjust_icount( | |
| 2226 | cpu_adjust_icount( | |
| 2227 | 2227 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 2228 | 2228 | |
| 2229 | 2229 | switch (offset & 3) |
| r8453 | r8454 | |
| 2253 | 2253 | static void ti99_evpc_reset(running_machine *machine) |
| 2254 | 2254 | { |
| 2255 | 2255 | ti99_evpc_DSR = memory_region(machine, region_dsr) + offset_evpc_dsr; |
| 2256 | running_device *box = | |
| 2256 | running_device *box = m | |
| 2257 | 2257 | |
| 2258 | 2258 | RAMEN = 0; |
| 2259 | 2259 | evpc_dsr_page = 0; |
| r8453 | r8454 | |
| 2493 | 2493 | console_GROMs.data_ptr = memory_region(machine, region_grom); |
| 2494 | 2494 | create_grom_high2k(0x0000, 0x5fff); |
| 2495 | 2495 | |
| 2496 | multicart8 = | |
| 2496 | multicart8 = m | |
| 2497 | 2497 | assert (multicart8 != NULL); |
| 2498 | 2498 | } |
| 2499 | 2499 | |
| r8453 | r8454 | |
| 2508 | 2508 | console_GROMs.raddr_LSB = FALSE; |
| 2509 | 2509 | console_GROMs.waddr_LSB = FALSE; |
| 2510 | 2510 | |
| 2511 | expansion_box = | |
| 2511 | expansion_box = m | |
| 2512 | 2512 | |
| 2513 | 2513 | ti99_8_enable_rom_and_ports = 1; /* ??? maybe there is a pull-up */ |
| 2514 | 2514 | /* MZ: already setting this in driver init, otherwise machine locks up */ |
| r8453 | r8454 | |
| 2519 | 2519 | KeyCol = 0; |
| 2520 | 2520 | AlphaLockLine = 0; |
| 2521 | 2521 | |
| 2522 | tms9901_set_single_int( | |
| 2522 | tms9901_set_single_int(m | |
| 2523 | 2523 | |
| 2524 | 2524 | xRAM_kind = RAM_99_8; |
| 2525 | 2525 | has_speech = TRUE; |
| r8453 | r8454 | |
| 2722 | 2722 | /* speech read: >9000 */ |
| 2723 | 2723 | if (! (offset & 1)) |
| 2724 | 2724 | { |
| 2725 | cpu_adjust_icount(devtag_get_device(space->machine, "maincpu"),-16*4); /* this is just a minimum, it can be more */ | |
| 2726 | reply = tms5220_status_r(devtag_get_device(space->machine, "tms5220"), 0); | |
| 2725 | cpu_adjust_icount(space->machine->device("maincpu"),-16*4); /* this is just a minimum, it can be more */ | |
| 2726 | reply = tms5220_status_r(space->machine->device("tms5220"), 0); | |
| 2727 | 2727 | } |
| 2728 | 2728 | break; |
| 2729 | 2729 | |
| r8453 | r8454 | |
| 2822 | 2822 | case 1: |
| 2823 | 2823 | /* sound write + RAM */ |
| 2824 | 2824 | if (offset < 0x8410) |
| 2825 | sn76496_w( | |
| 2825 | sn76496_w( | |
| 2826 | 2826 | else |
| 2827 | 2827 | sRAM_ptr_8[offset & 0x1fff] = data; |
| 2828 | 2828 | break; |
| r8453 | r8454 | |
| 2874 | 2874 | /* speech write */ |
| 2875 | 2875 | if (! (offset & 1)) |
| 2876 | 2876 | { |
| 2877 | cpu_adjust_icount( | |
| 2877 | cpu_adjust_icount( | |
| 2878 | 2878 | |
| 2879 | 2879 | // the stupid design of the tms5220 core means that ready is cleared when |
| 2880 | 2880 | // there are 15 bytes in FIFO. It should be 16. Of course, if it were the |
| 2881 | 2881 | // case, we would need to store the value on the bus, which would be more |
| 2882 | 2882 | // complex. |
| 2883 | if (! tms5220_readyq_r( | |
| 2883 | if (! tms5220_readyq_r( | |
| 2884 | 2884 | { |
| 2885 | attotime time_to_ready = double_to_attotime(tms5220_time_to_ready( | |
| 2885 | attotime time_to_ready = double_to_attotime(tms5220_time_to_ready( | |
| 2886 | 2886 | double d = cputag_attotime_to_clocks(space->machine, "maincpu", time_to_ready); |
| 2887 | 2887 | int cycles_to_ready = ((int) (d + 3)) & ~3; |
| 2888 | 2888 | |
| 2889 | 2889 | logerror("time to ready: %f -> %d\n", attotime_to_double(time_to_ready) |
| 2890 | 2890 | , (int) cycles_to_ready); |
| 2891 | 2891 | |
| 2892 | cpu_adjust_icount( | |
| 2892 | cpu_adjust_icount( | |
| 2893 | 2893 | timer_set(space->machine, attotime_zero, NULL, 0, /*speech_kludge_callback*/NULL); |
| 2894 | 2894 | } |
| 2895 | 2895 | |
| 2896 | tms5220_data_w( | |
| 2896 | tms5220_data_w( | |
| 2897 | 2897 | } |
| 2898 | 2898 | break; |
| 2899 | 2899 | |
| r8453 | r8454 | |
| 3189 | 3189 | |
| 3190 | 3190 | UINT8* mem = memory_region(machine, "maincpu"); |
| 3191 | 3191 | |
| 3192 | expansion_box = | |
| 3192 | expansion_box = m | |
| 3193 | 3193 | |
| 3194 | 3194 | /* set up system ROM and scratch pad pointers */ |
| 3195 | 3195 | memory_set_bankptr(machine, "bank1", mem + offset_rom0_4p); /* system ROM */ |
| r8453 | r8454 | |
| 3202 | 3202 | KeyCol = 0; |
| 3203 | 3203 | AlphaLockLine = 0; |
| 3204 | 3204 | |
| 3205 | tms9901_set_single_int( | |
| 3205 | tms9901_set_single_int(m | |
| 3206 | 3206 | |
| 3207 | 3207 | xRAM_kind = RAM_99_4P; |
| 3208 | 3208 | has_speech = input_port_read(machine, "SPEECH"); |
| r8453 | r8454 | |
| 3461 | 3461 | } |
| 3462 | 3462 | else |
| 3463 | 3463 | { |
| 3464 | cpu_adjust_icount( | |
| 3464 | cpu_adjust_icount( | |
| 3465 | 3465 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 3466 | 3466 | |
| 3467 | 3467 | if (hsgpl_crdena) |
| r8453 | r8454 | |
| 3483 | 3483 | } |
| 3484 | 3484 | else |
| 3485 | 3485 | { |
| 3486 | cpu_adjust_icount( | |
| 3486 | cpu_adjust_icount( | |
| 3487 | 3487 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 3488 | 3488 | |
| 3489 | 3489 | if (hsgpl_crdena) |
| r8453 | r8454 | |
| 3499 | 3499 | { |
| 3500 | 3500 | UINT16 value = 0; |
| 3501 | 3501 | // HSGPL is located on 8-bit bus |
| 3502 | cpu_adjust_icount( | |
| 3502 | cpu_adjust_icount( | |
| 3503 | 3503 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 3504 | 3504 | |
| 3505 | 3505 | // When crdena is false, we must still be able to query the address |
| r8453 | r8454 | |
| 3516 | 3516 | WRITE16_HANDLER ( ti99_4p_grom_w ) |
| 3517 | 3517 | { |
| 3518 | 3518 | // HSGPL is located on 8-bit bus |
| 3519 | cpu_adjust_icount( | |
| 3519 | cpu_adjust_icount( | |
| 3520 | 3520 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 3521 | 3521 | |
| 3522 | 3522 | if (hsgpl_crdena || (offset & 1)) |
| r8453 | r8454 | |
|---|---|---|
| 92 | 92 | /* currently enough to save the external ram */ |
| 93 | 93 | NVRAM_HANDLER( pc1251 ) |
| 94 | 94 | { |
| 95 | running_device *main_cpu = | |
| 95 | running_device *main_cpu = m | |
| 96 | 96 | UINT8 *ram = memory_region(machine, "maincpu") + 0x8000; |
| 97 | 97 | UINT8 *cpu = sc61860_internal_ram(main_cpu); |
| 98 | 98 |
| r8453 | r8454 | |
|---|---|---|
| 108 | 108 | int changed; |
| 109 | 109 | |
| 110 | 110 | /* NPW 29-Nov-2008 - These two lines are a hack and indicate why our "serial" infrastructure needs to be updated */ |
| 111 | device = | |
| 111 | device = m | |
| 112 | 112 | uart = get_token(device); |
| 113 | 113 | |
| 114 | 114 | changed = uart->connection.input_state^state; |
| r8453 | r8454 | |
|---|---|---|
| 420 | 420 | static void clr_serin(running_device *device, int ser_delay) |
| 421 | 421 | { |
| 422 | 422 | atari_fdc_t *fdc = get_safe_token(device); |
| 423 | running_device *pokey = dev | |
| 423 | running_device *pokey = dev | |
| 424 | 424 | fdc->serin_chksum = 0; |
| 425 | 425 | fdc->serin_offs = 0; |
| 426 | 426 | fdc->serin_count = 0; |
| r8453 | r8454 | |
| 705 | 705 | |
| 706 | 706 | if (fdc->serin_count) |
| 707 | 707 | { |
| 708 | running_device *pokey = dev | |
| 708 | running_device *pokey = dev | |
| 709 | 709 | |
| 710 | 710 | data = fdc->serin_buff[fdc->serin_offs]; |
| 711 | 711 | ser_delay = 2 * 40; |
| r8453 | r8454 | |
| 730 | 730 | |
| 731 | 731 | WRITE8_DEVICE_HANDLER ( atari_serout_w ) |
| 732 | 732 | { |
| 733 | running_device *pia = dev | |
| 733 | running_device *pia = dev | |
| 734 | 734 | atari_fdc_t *fdc = get_safe_token(device); |
| 735 | 735 | |
| 736 | 736 | /* ignore serial commands if no floppy image is specified */ |
| r8453 | r8454 | |
|---|---|---|
| 20 | 20 | va_start( v, s_fmt ); |
| 21 | 21 | vsprintf( buf, s_fmt, v ); |
| 22 | 22 | va_end( v ); |
| 23 | logerror( "%08x: %s", (unsigned) cpu_get_pc( | |
| 23 | logerror( "%08x: %s", (unsigned) cpu_get_pc(m | |
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 |
| r8453 | r8454 | |
|---|---|---|
| 59 | 59 | |
| 60 | 60 | static READ8_HANDLER(sysreg_r) |
| 61 | 61 | { |
| 62 | return messram_get_ptr( | |
| 62 | return messram_get_ptr( | |
| 63 | 63 | } |
| 64 | 64 | static WRITE8_HANDLER(sysreg_w) |
| 65 | 65 | { |
| r8453 | r8454 | |
| 82 | 82 | |
| 83 | 83 | static READ8_HANDLER(text_r) |
| 84 | 84 | { |
| 85 | if (attr == 3) text_attr=messram_get_ptr(devtag_get_device(space->machine, "messram"))[0x40400+offset]; | |
| 86 | return messram_get_ptr(devtag_get_device(space->machine, "messram"))[0x40000+offset]; | |
| 85 | if (attr == 3) text_attr=messram_get_ptr(space->machine->device("messram"))[0x40400+offset]; | |
| 86 | return messram_get_ptr(space->machine->device("messram"))[0x40000+offset]; | |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | static WRITE8_HANDLER(text_w) |
| 90 | 90 | { |
| 91 | messram_get_ptr( | |
| 91 | messram_get_ptr( | |
| 92 | 92 | switch (attr) { |
| 93 | 93 | case 0: break; |
| 94 | case 1: messram_get_ptr(devtag_get_device(space->machine, "messram"))[0x40400+offset]=0x01;break; | |
| 95 | case 2: messram_get_ptr(devtag_get_device(space->machine, "messram"))[0x40400+offset]=0x00;break; | |
| 96 | case 3: messram_get_ptr(devtag_get_device(space->machine, "messram"))[0x40400+offset]=text_attr;break; | |
| 94 | case 1: messram_get_ptr(space->machine->device("messram"))[0x40400+offset]=0x01;break; | |
| 95 | case 2: messram_get_ptr(space->machine->device("messram"))[0x40400+offset]=0x00;break; | |
| 96 | case 3: messram_get_ptr(space->machine->device("messram"))[0x40400+offset]=text_attr;break; | |
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | static READ8_HANDLER(gzu_r) |
| 101 | 101 | { |
| 102 | UINT8 *addr = messram_get_ptr( | |
| 102 | UINT8 *addr = messram_get_ptr( | |
| 103 | 103 | UINT8 p0 = addr[offset]; |
| 104 | 104 | UINT8 p1 = addr[offset + 0x4000]; |
| 105 | 105 | UINT8 p2 = addr[offset + 0x8000]; |
| r8453 | r8454 | |
| 133 | 133 | |
| 134 | 134 | static WRITE8_HANDLER(gzu_w) |
| 135 | 135 | { |
| 136 | UINT8 *addr = messram_get_ptr( | |
| 136 | UINT8 *addr = messram_get_ptr( | |
| 137 | 137 | UINT8 *plane_0 = addr; |
| 138 | 138 | UINT8 *plane_1 = addr + 0x4000; |
| 139 | 139 | UINT8 *plane_2 = addr + 0x8000; |
| r8453 | r8454 | |
| 161 | 161 | |
| 162 | 162 | static READ8_HANDLER(devices_r) |
| 163 | 163 | { |
| 164 | running_device *ppi1 = devtag_get_device(space->machine, "ppi8255_1"); | |
| 165 | running_device *ppi2 = devtag_get_device(space->machine, "ppi8255_2"); | |
| 166 | running_device *ppi3 = devtag_get_device(space->machine, "ppi8255_3"); | |
| 167 | running_device *pit = devtag_get_device(space->machine, "pit8253"); | |
| 168 | running_device *pic = devtag_get_device(space->machine, "pic8259"); | |
| 169 | running_device *rs232 = devtag_get_device(space->machine, "rs232"); | |
| 170 | running_device *lan = devtag_get_device(space->machine, "lan"); | |
| 171 | running_device *fdc = devtag_get_device(space->machine, "wd1793"); | |
| 164 | running_device *ppi1 = space->machine->device("ppi8255_1"); | |
| 165 | running_device *ppi2 = space->machine->device("ppi8255_2"); | |
| 166 | running_device *ppi3 = space->machine->device("ppi8255_3"); | |
| 167 | running_device *pit = space->machine->device("pit8253"); | |
| 168 | running_device *pic = space->machine->device("pic8259"); | |
| 169 | running_device *rs232 = space->machine->device("rs232"); | |
| 170 | running_device *lan = space->machine->device("lan"); | |
| 171 | running_device *fdc = space->machine->device("wd1793"); | |
| 172 | 172 | |
| 173 | 173 | switch(offset & 0x38) |
| 174 | 174 | { |
| r8453 | r8454 | |
| 200 | 200 | |
| 201 | 201 | static WRITE8_HANDLER(devices_w) |
| 202 | 202 | { |
| 203 | running_device *ppi1 = devtag_get_device(space->machine, "ppi8255_1"); | |
| 204 | running_device *ppi2 = devtag_get_device(space->machine, "ppi8255_2"); | |
| 205 | running_device *ppi3 = devtag_get_device(space->machine, "ppi8255_3"); | |
| 206 | running_device *pit = devtag_get_device(space->machine, "pit8253"); | |
| 207 | running_device *pic = devtag_get_device(space->machine, "pic8259"); | |
| 208 | running_device *rs232 = devtag_get_device(space->machine, "rs232"); | |
| 209 | running_device *lan = devtag_get_device(space->machine, "lan"); | |
| 210 | running_device *fdc = devtag_get_device(space->machine, "wd1793"); | |
| 203 | running_device *ppi1 = space->machine->device("ppi8255_1"); | |
| 204 | running_device *ppi2 = space->machine->device("ppi8255_2"); | |
| 205 | running_device *ppi3 = space->machine->device("ppi8255_3"); | |
| 206 | running_device *pit = space->machine->device("pit8253"); | |
| 207 | running_device *pic = space->machine->device("pic8259"); | |
| 208 | running_device *rs232 = space->machine->device("rs232"); | |
| 209 | running_device *lan = space->machine->device("lan"); | |
| 210 | running_device *fdc = space->machine->device("wd1793"); | |
| 211 | 211 | |
| 212 | 212 | switch(offset & 0x38) |
| 213 | 213 | { |
| r8453 | r8454 | |
| 246 | 246 | memory_install_read_bank (space, 0x0000, 0x37ff, 0, 0, "bank1"); |
| 247 | 247 | memory_install_write_bank(space, 0x0000, 0x37ff, 0, 0, "bank2"); |
| 248 | 248 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 249 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 249 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 250 | 250 | // Keyboard |
| 251 | 251 | memory_install_read8_handler (space, 0x3800, 0x39ff, 0, 0, keyboard_r); |
| 252 | 252 | memory_install_write_bank(space, 0x3800, 0x39ff, 0, 0, "bank3"); |
| 253 | memory_set_bankptr(machine, "bank3", messram_get_ptr( | |
| 253 | memory_set_bankptr(machine, "bank3", messram_get_ptr(m | |
| 254 | 254 | // System reg |
| 255 | 255 | memory_install_read8_handler (space, 0x3a00, 0x3aff, 0, 0, sysreg_r); |
| 256 | 256 | memory_install_write8_handler(space, 0x3a00, 0x3aff, 0, 0, sysreg_w); |
| r8453 | r8454 | |
| 263 | 263 | // RAM |
| 264 | 264 | memory_install_read_bank (space, 0x4000, 0xffff, 0, 0, "bank4"); |
| 265 | 265 | memory_install_write_bank(space, 0x4000, 0xffff, 0, 0, "bank5"); |
| 266 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 267 | memory_set_bankptr(machine, "bank5", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 266 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 267 | memory_set_bankptr(machine, "bank5", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 268 | 268 | } |
| 269 | 269 | break; |
| 270 | 270 | case 0x01 : { |
| r8453 | r8454 | |
| 272 | 272 | memory_install_read_bank (space, 0x0000, 0x1fff, 0, 0, "bank1"); |
| 273 | 273 | memory_install_write_bank(space, 0x0000, 0x1fff, 0, 0, "bank2"); |
| 274 | 274 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 275 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 275 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 276 | 276 | // RAM |
| 277 | 277 | memory_install_read_bank (space, 0x2000, 0xffff, 0, 0, "bank3"); |
| 278 | 278 | memory_install_write_bank(space, 0x2000, 0xffff, 0, 0, "bank4"); |
| 279 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000); | |
| 280 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000); | |
| 279 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x2000); | |
| 280 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x2000); | |
| 281 | 281 | } |
| 282 | 282 | break; |
| 283 | 283 | case 0x02 : { |
| r8453 | r8454 | |
| 285 | 285 | memory_install_read_bank (space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 286 | 286 | memory_install_write_bank(space, 0x0000, 0x3fff, 0, 0, "bank2"); |
| 287 | 287 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 288 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 288 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 289 | 289 | // RAM |
| 290 | 290 | memory_install_read_bank (space, 0x4000, 0xffff, 0, 0, "bank3"); |
| 291 | 291 | memory_install_write_bank(space, 0x4000, 0xffff, 0, 0, "bank4"); |
| 292 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 293 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 292 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 293 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 294 | 294 | } |
| 295 | 295 | break; |
| 296 | 296 | case 0x03 : { |
| 297 | 297 | // RAM |
| 298 | 298 | memory_install_read_bank (space, 0x0000, 0xffff, 0, 0, "bank1"); |
| 299 | 299 | memory_install_write_bank(space, 0x0000, 0xffff, 0, 0, "bank2"); |
| 300 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 301 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 300 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram"))); | |
| 301 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram"))); | |
| 302 | 302 | } |
| 303 | 303 | break; |
| 304 | 304 | case 0x04 : |
| r8453 | r8454 | |
| 308 | 308 | memory_install_read_bank (space, 0x0000, 0x1fff, 0, 0, "bank1"); |
| 309 | 309 | memory_install_write_bank(space, 0x0000, 0x1fff, 0, 0, "bank2"); |
| 310 | 310 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 311 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 311 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 312 | 312 | // RAM |
| 313 | 313 | memory_install_read_bank (space, 0x2000, 0xf7ff, 0, 0, "bank3"); |
| 314 | 314 | memory_install_write_bank(space, 0x2000, 0xf7ff, 0, 0, "bank4"); |
| 315 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000); | |
| 316 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000); | |
| 315 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x2000); | |
| 316 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x2000); | |
| 317 | 317 | // Keyboard |
| 318 | 318 | memory_install_read8_handler (space, 0xf800, 0xf9ff, 0, 0, keyboard_r); |
| 319 | 319 | memory_install_write_bank(space, 0xf800, 0xf9ff, 0, 0, "bank5"); |
| 320 | memory_set_bankptr(machine, "bank5", messram_get_ptr( | |
| 320 | memory_set_bankptr(machine, "bank5", messram_get_ptr(m | |
| 321 | 321 | // System reg |
| 322 | 322 | memory_install_read8_handler (space, 0xfa00, 0xfaff, 0, 0, sysreg_r); |
| 323 | 323 | memory_install_write8_handler(space, 0xfa00, 0xfaff, 0, 0, sysreg_w); |
| r8453 | r8454 | |
| 335 | 335 | memory_install_read_bank (space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 336 | 336 | memory_install_write_bank(space, 0x0000, 0x3fff, 0, 0, "bank2"); |
| 337 | 337 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 338 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 338 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 339 | 339 | // RAM |
| 340 | 340 | memory_install_read_bank (space, 0x4000, 0xf7ff, 0, 0, "bank3"); |
| 341 | 341 | memory_install_write_bank(space, 0x4000, 0xf7ff, 0, 0, "bank4"); |
| 342 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 343 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 342 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 343 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 344 | 344 | // Keyboard |
| 345 | 345 | memory_install_read8_handler (space, 0xf800, 0xf9ff, 0, 0, keyboard_r); |
| 346 | 346 | memory_install_write_bank(space, 0xf800, 0xf9ff, 0, 0, "bank5"); |
| 347 | memory_set_bankptr(machine, "bank5", messram_get_ptr( | |
| 347 | memory_set_bankptr(machine, "bank5", messram_get_ptr(m | |
| 348 | 348 | // System reg |
| 349 | 349 | memory_install_read8_handler (space, 0xfa00, 0xfaff, 0, 0, sysreg_r); |
| 350 | 350 | memory_install_write8_handler(space, 0xfa00, 0xfaff, 0, 0, sysreg_w); |
| r8453 | r8454 | |
| 361 | 361 | // RAM |
| 362 | 362 | memory_install_read_bank (space, 0x0000, 0xf7ff, 0, 0, "bank1"); |
| 363 | 363 | memory_install_write_bank(space, 0x0000, 0xf7ff, 0, 0, "bank2"); |
| 364 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 365 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 364 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram"))); | |
| 365 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram"))); | |
| 366 | 366 | // Keyboard |
| 367 | 367 | memory_install_read8_handler (space, 0xf800, 0xf9ff, 0, 0, keyboard_r); |
| 368 | 368 | memory_install_write_bank(space, 0xf800, 0xf9ff, 0, 0, "bank3"); |
| 369 | memory_set_bankptr(machine, "bank3", messram_get_ptr( | |
| 369 | memory_set_bankptr(machine, "bank3", messram_get_ptr(m | |
| 370 | 370 | // System reg |
| 371 | 371 | memory_install_read8_handler (space, 0xfa00, 0xfaff, 0, 0, sysreg_r); |
| 372 | 372 | memory_install_write8_handler(space, 0xfa00, 0xfaff, 0, 0, sysreg_w); |
| r8453 | r8454 | |
| 384 | 384 | memory_install_read_bank (space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 385 | 385 | memory_install_write_bank(space, 0x0000, 0x3fff, 0, 0, "bank2"); |
| 386 | 386 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 387 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 387 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 388 | 388 | // Keyboard |
| 389 | 389 | memory_install_read8_handler (space, 0x3800, 0x39ff, 0, 0, keyboard_r); |
| 390 | 390 | memory_install_write_bank(space, 0x3800, 0x39ff, 0, 0, "bank3"); |
| 391 | memory_set_bankptr(machine, "bank3", messram_get_ptr( | |
| 391 | memory_set_bankptr(machine, "bank3", messram_get_ptr(m | |
| 392 | 392 | // System reg |
| 393 | 393 | memory_install_read8_handler (space, 0x3a00, 0x3aff, 0, 0, sysreg_r); |
| 394 | 394 | memory_install_write8_handler(space, 0x3a00, 0x3aff, 0, 0, sysreg_w); |
| r8453 | r8454 | |
| 401 | 401 | // RAM |
| 402 | 402 | memory_install_read_bank (space, 0x4000, 0xbfff, 0, 0, "bank4"); |
| 403 | 403 | memory_install_write_bank(space, 0x4000, 0xbfff, 0, 0, "bank5"); |
| 404 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 405 | memory_set_bankptr(machine, "bank5", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 404 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 405 | memory_set_bankptr(machine, "bank5", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 406 | 406 | // Video RAM |
| 407 | 407 | memory_install_read8_handler (space, 0xc000, 0xffff, 0, 0, gzu_r); |
| 408 | 408 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w); |
| r8453 | r8454 | |
| 415 | 415 | memory_install_read_bank (space, 0x0000, 0x1fff, 0, 0, "bank1"); |
| 416 | 416 | memory_install_write_bank(space, 0x0000, 0x1fff, 0, 0, "bank2"); |
| 417 | 417 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 418 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 418 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 419 | 419 | // RAM |
| 420 | 420 | memory_install_read_bank (space, 0x2000, 0xbfff, 0, 0, "bank3"); |
| 421 | 421 | memory_install_write_bank(space, 0x2000, 0xbfff, 0, 0, "bank4"); |
| 422 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000); | |
| 423 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000); | |
| 422 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x2000); | |
| 423 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x2000); | |
| 424 | 424 | // Video RAM |
| 425 | 425 | memory_install_read8_handler (space, 0xc000, 0xffff, 0, 0, gzu_r); |
| 426 | 426 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w); |
| r8453 | r8454 | |
| 432 | 432 | memory_install_read_bank (space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 433 | 433 | memory_install_write_bank(space, 0x0000, 0x3fff, 0, 0, "bank2"); |
| 434 | 434 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 435 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 435 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 436 | 436 | // RAM |
| 437 | 437 | memory_install_read_bank (space, 0x4000, 0xbfff, 0, 0, "bank3"); |
| 438 | 438 | memory_install_write_bank(space, 0x4000, 0xbfff, 0, 0, "bank4"); |
| 439 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 440 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 439 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 440 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 441 | 441 | // Video RAM |
| 442 | 442 | memory_install_read8_handler (space, 0xc000, 0xffff, 0, 0, gzu_r); |
| 443 | 443 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w); |
| r8453 | r8454 | |
| 448 | 448 | // RAM |
| 449 | 449 | memory_install_read_bank (space, 0x0000, 0xbfff, 0, 0, "bank1"); |
| 450 | 450 | memory_install_write_bank(space, 0x0000, 0xbfff, 0, 0, "bank2"); |
| 451 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x0000); | |
| 452 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x0000); | |
| 451 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram")) + 0x0000); | |
| 452 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0x0000); | |
| 453 | 453 | // Video RAM |
| 454 | 454 | memory_install_read8_handler (space, 0xc000, 0xffff, 0, 0, gzu_r); |
| 455 | 455 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w); |
| r8453 | r8454 | |
| 462 | 462 | memory_install_read_bank (space, 0x0000, 0x1fff, 0, 0, "bank1"); |
| 463 | 463 | memory_install_write_bank(space, 0x0000, 0x1fff, 0, 0, "bank2"); |
| 464 | 464 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 465 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 465 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 466 | 466 | // RAM |
| 467 | 467 | memory_install_read_bank (space, 0x2000, 0x3fff, 0, 0, "bank3"); |
| 468 | 468 | memory_install_write_bank(space, 0x2000, 0x3fff, 0, 0, "bank4"); |
| 469 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000); | |
| 470 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000); | |
| 469 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x2000); | |
| 470 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x2000); | |
| 471 | 471 | // Video RAM |
| 472 | 472 | memory_install_read8_handler (space, 0x4000, 0x7fff, 0, 0, gzu_r); |
| 473 | 473 | memory_install_write8_handler(space, 0x4000, 0x7fff, 0, 0, gzu_w); |
| 474 | 474 | // RAM |
| 475 | 475 | memory_install_read_bank (space, 0x8000, 0xfdff, 0, 0, "bank5"); |
| 476 | 476 | memory_install_write_bank(space, 0x8000, 0xfdff, 0, 0, "bank6"); |
| 477 | memory_set_bankptr(machine, "bank5", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x8000); | |
| 478 | memory_set_bankptr(machine, "bank6", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x8000); | |
| 477 | memory_set_bankptr(machine, "bank5", messram_get_ptr(machine->device("messram")) + 0x8000); | |
| 478 | memory_set_bankptr(machine, "bank6", messram_get_ptr(machine->device("messram")) + 0x8000); | |
| 479 | 479 | // Devices |
| 480 | 480 | memory_install_read8_handler (space, 0xfe00, 0xfeff, 0, 0, devices_r); |
| 481 | 481 | memory_install_write8_handler(space, 0xfe00, 0xfeff, 0, 0, devices_w); |
| r8453 | r8454 | |
| 490 | 490 | memory_install_read_bank (space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 491 | 491 | memory_install_write_bank(space, 0x0000, 0x3fff, 0, 0, "bank2"); |
| 492 | 492 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 493 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 493 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 494 | 494 | // Video RAM |
| 495 | 495 | memory_install_read8_handler (space, 0x4000, 0x7fff, 0, 0, gzu_r); |
| 496 | 496 | memory_install_write8_handler(space, 0x4000, 0x7fff, 0, 0, gzu_w); |
| 497 | 497 | // RAM |
| 498 | 498 | memory_install_read_bank (space, 0x8000, 0xfdff, 0, 0, "bank5"); |
| 499 | 499 | memory_install_write_bank(space, 0x8000, 0xfdff, 0, 0, "bank6"); |
| 500 | memory_set_bankptr(machine, "bank5", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x8000); | |
| 501 | memory_set_bankptr(machine, "bank6", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x8000); | |
| 500 | memory_set_bankptr(machine, "bank5", messram_get_ptr(machine->device("messram")) + 0x8000); | |
| 501 | memory_set_bankptr(machine, "bank6", messram_get_ptr(machine->device("messram")) + 0x8000); | |
| 502 | 502 | // Devices |
| 503 | 503 | memory_install_read8_handler (space, 0xfe00, 0xfeff, 0, 0, devices_r); |
| 504 | 504 | memory_install_write8_handler(space, 0xfe00, 0xfeff, 0, 0, devices_w); |
| r8453 | r8454 | |
| 512 | 512 | // RAM |
| 513 | 513 | memory_install_read_bank (space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 514 | 514 | memory_install_write_bank(space, 0x0000, 0x3fff, 0, 0, "bank2"); |
| 515 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x0000); | |
| 516 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x0000); | |
| 515 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram")) + 0x0000); | |
| 516 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0x0000); | |
| 517 | 517 | // Video RAM |
| 518 | 518 | memory_install_read8_handler (space, 0x4000, 0x7fff, 0, 0, gzu_r); |
| 519 | 519 | memory_install_write8_handler(space, 0x4000, 0x7fff, 0, 0, gzu_w); |
| 520 | 520 | // RAM |
| 521 | 521 | memory_install_read_bank (space, 0x8000, 0xfdff, 0, 0, "bank3"); |
| 522 | 522 | memory_install_write_bank(space, 0x8000, 0xfdff, 0, 0, "bank4"); |
| 523 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x8000); | |
| 524 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x8000); | |
| 523 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x8000); | |
| 524 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x8000); | |
| 525 | 525 | // Devices |
| 526 | 526 | memory_install_read8_handler (space, 0xfe00, 0xfeff, 0, 0, devices_r); |
| 527 | 527 | memory_install_write8_handler(space, 0xfe00, 0xfeff, 0, 0, devices_w); |
| r8453 | r8454 | |
| 536 | 536 | memory_install_read_bank (space, 0x0000, 0x5fff, 0, 0, "bank1"); |
| 537 | 537 | memory_install_write_bank(space, 0x0000, 0x5fff, 0, 0, "bank2"); |
| 538 | 538 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 539 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 539 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 540 | 540 | // RAM |
| 541 | 541 | memory_install_read_bank (space, 0x6000, 0xf7ff, 0, 0, "bank3"); |
| 542 | 542 | memory_install_write_bank(space, 0x6000, 0xf7ff, 0, 0, "bank4"); |
| 543 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x6000); | |
| 544 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x6000); | |
| 543 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x6000); | |
| 544 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x6000); | |
| 545 | 545 | // Keyboard |
| 546 | 546 | memory_install_read8_handler (space, 0xf800, 0xf9ff, 0, 0, keyboard_r); |
| 547 | 547 | memory_install_write_bank(space, 0xf800, 0xf9ff, 0, 0, "bank5"); |
| 548 | memory_set_bankptr(machine, "bank5", messram_get_ptr( | |
| 548 | memory_set_bankptr(machine, "bank5", messram_get_ptr(m | |
| 549 | 549 | // System reg |
| 550 | 550 | memory_install_read8_handler (space, 0xfa00, 0xfaff, 0, 0, sysreg_r); |
| 551 | 551 | memory_install_write8_handler(space, 0xfa00, 0xfaff, 0, 0, sysreg_w); |
| r8453 | r8454 | |
| 563 | 563 | memory_install_read_bank (space, 0x0000, 0x1fff, 0, 0, "bank1"); |
| 564 | 564 | memory_install_write_bank(space, 0x0000, 0x1fff, 0, 0, "bank2"); |
| 565 | 565 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 566 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 566 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 567 | 567 | // RAM |
| 568 | 568 | memory_install_read_bank (space, 0x2000, 0xf7ff, 0, 0, "bank3"); |
| 569 | 569 | memory_install_write_bank(space, 0x2000, 0xf7ff, 0, 0, "bank4"); |
| 570 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000); | |
| 571 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000); | |
| 570 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x2000); | |
| 571 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x2000); | |
| 572 | 572 | // Keyboard |
| 573 | 573 | memory_install_read8_handler (space, 0xf800, 0xf9ff, 0, 0, keyboard_r); |
| 574 | 574 | memory_install_write_bank(space, 0xf800, 0xf9ff, 0, 0, "bank5"); |
| 575 | memory_set_bankptr(machine, "bank5", messram_get_ptr( | |
| 575 | memory_set_bankptr(machine, "bank5", messram_get_ptr(m | |
| 576 | 576 | // System reg |
| 577 | 577 | memory_install_read8_handler (space, 0xfa00, 0xfaff, 0, 0, sysreg_r); |
| 578 | 578 | memory_install_write8_handler(space, 0xfa00, 0xfaff, 0, 0, sysreg_w); |
| r8453 | r8454 | |
| 590 | 590 | memory_install_read_bank (space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 591 | 591 | memory_install_write_bank(space, 0x0000, 0x3fff, 0, 0, "bank2"); |
| 592 | 592 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 593 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 593 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 594 | 594 | // RAM |
| 595 | 595 | memory_install_read_bank (space, 0x4000, 0xf7ff, 0, 0, "bank3"); |
| 596 | 596 | memory_install_write_bank(space, 0x4000, 0xf7ff, 0, 0, "bank4"); |
| 597 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 598 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 597 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 598 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 599 | 599 | // Keyboard |
| 600 | 600 | memory_install_read8_handler (space, 0xf800, 0xf9ff, 0, 0, keyboard_r); |
| 601 | 601 | memory_install_write_bank(space, 0xf800, 0xf9ff, 0, 0, "bank5"); |
| 602 | memory_set_bankptr(machine, "bank5", messram_get_ptr( | |
| 602 | memory_set_bankptr(machine, "bank5", messram_get_ptr(m | |
| 603 | 603 | // System reg |
| 604 | 604 | memory_install_read8_handler (space, 0xfa00, 0xfaff, 0, 0, sysreg_r); |
| 605 | 605 | memory_install_write8_handler(space, 0xfa00, 0xfaff, 0, 0, sysreg_w); |
| r8453 | r8454 | |
| 616 | 616 | // RAM |
| 617 | 617 | memory_install_read_bank (space, 0x0000, 0xf7ff, 0, 0, "bank1"); |
| 618 | 618 | memory_install_write_bank(space, 0x0000, 0xf7ff, 0, 0, "bank2"); |
| 619 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x0000); | |
| 620 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x0000); | |
| 619 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram")) + 0x0000); | |
| 620 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0x0000); | |
| 621 | 621 | // Keyboard |
| 622 | 622 | memory_install_read8_handler (space, 0xf800, 0xf9ff, 0, 0, keyboard_r); |
| 623 | 623 | memory_install_write_bank(space, 0xf800, 0xf9ff, 0, 0, "bank3"); |
| 624 | memory_set_bankptr(machine, "bank3", messram_get_ptr( | |
| 624 | memory_set_bankptr(machine, "bank3", messram_get_ptr(m | |
| 625 | 625 | // System reg |
| 626 | 626 | memory_install_read8_handler (space, 0xfa00, 0xfaff, 0, 0, sysreg_r); |
| 627 | 627 | memory_install_write8_handler(space, 0xfa00, 0xfaff, 0, 0, sysreg_w); |
| r8453 | r8454 | |
| 639 | 639 | memory_install_read_bank (space, 0x0000, 0x5fff, 0, 0, "bank1"); |
| 640 | 640 | memory_install_write_bank(space, 0x0000, 0x5fff, 0, 0, "bank2"); |
| 641 | 641 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 642 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 642 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 643 | 643 | // RAM |
| 644 | 644 | memory_install_read_bank (space, 0x6000, 0xfdff, 0, 0, "bank3"); |
| 645 | 645 | memory_install_write_bank(space, 0x6000, 0xfdff, 0, 0, "bank4"); |
| 646 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x6000); | |
| 647 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x6000); | |
| 646 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x6000); | |
| 647 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x6000); | |
| 648 | 648 | // Devices |
| 649 | 649 | memory_install_read8_handler (space, 0xfe00, 0xfeff, 0, 0, devices_r); |
| 650 | 650 | memory_install_write8_handler(space, 0xfe00, 0xfeff, 0, 0, devices_w); |
| r8453 | r8454 | |
| 659 | 659 | memory_install_read_bank (space, 0x0000, 0x1fff, 0, 0, "bank1"); |
| 660 | 660 | memory_install_write_bank(space, 0x0000, 0x1fff, 0, 0, "bank2"); |
| 661 | 661 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 662 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 662 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 663 | 663 | // RAM |
| 664 | 664 | memory_install_read_bank (space, 0x2000, 0xfdff, 0, 0, "bank3"); |
| 665 | 665 | memory_install_write_bank(space, 0x2000, 0xfdff, 0, 0, "bank4"); |
| 666 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000); | |
| 667 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000); | |
| 666 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x2000); | |
| 667 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x2000); | |
| 668 | 668 | // Devices |
| 669 | 669 | memory_install_read8_handler (space, 0xfe00, 0xfeff, 0, 0, devices_r); |
| 670 | 670 | memory_install_write8_handler(space, 0xfe00, 0xfeff, 0, 0, devices_w); |
| r8453 | r8454 | |
| 679 | 679 | memory_install_read_bank (space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 680 | 680 | memory_install_write_bank(space, 0x0000, 0x3fff, 0, 0, "bank2"); |
| 681 | 681 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 682 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 682 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 683 | 683 | // RAM |
| 684 | 684 | memory_install_read_bank (space, 0x4000, 0xfdff, 0, 0, "bank3"); |
| 685 | 685 | memory_install_write_bank(space, 0x4000, 0xfdff, 0, 0, "bank4"); |
| 686 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 687 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 686 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 687 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 688 | 688 | // Devices |
| 689 | 689 | memory_install_read8_handler (space, 0xfe00, 0xfeff, 0, 0, devices_r); |
| 690 | 690 | memory_install_write8_handler(space, 0xfe00, 0xfeff, 0, 0, devices_w); |
| r8453 | r8454 | |
| 698 | 698 | // RAM |
| 699 | 699 | memory_install_read_bank (space, 0x0000, 0xfdff, 0, 0, "bank1"); |
| 700 | 700 | memory_install_write_bank(space, 0x0000, 0xfdff, 0, 0, "bank2"); |
| 701 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 702 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 701 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram"))); | |
| 702 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram"))); | |
| 703 | 703 | // Devices |
| 704 | 704 | memory_install_read8_handler (space, 0xfe00, 0xfeff, 0, 0, devices_r); |
| 705 | 705 | memory_install_write8_handler(space, 0xfe00, 0xfeff, 0, 0, devices_w); |
| r8453 | r8454 | |
| 714 | 714 | memory_install_read_bank (space, 0x0000, 0x5fff, 0, 0, "bank1"); |
| 715 | 715 | memory_install_write_bank(space, 0x0000, 0x5fff, 0, 0, "bank2"); |
| 716 | 716 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 717 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 717 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 718 | 718 | // RAM |
| 719 | 719 | memory_install_read_bank (space, 0x6000, 0xbeff, 0, 0, "bank3"); |
| 720 | 720 | memory_install_write_bank(space, 0x6000, 0xbeff, 0, 0, "bank4"); |
| 721 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x6000); | |
| 722 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x6000); | |
| 721 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x6000); | |
| 722 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x6000); | |
| 723 | 723 | // System reg |
| 724 | 724 | memory_install_read8_handler (space, 0xbf00, 0xbfff, 0, 0, sysreg_r); |
| 725 | 725 | memory_install_write8_handler(space, 0xbf00, 0xbfff, 0, 0, sysreg_w); |
| r8453 | r8454 | |
| 734 | 734 | memory_install_read_bank (space, 0x0000, 0x1fff, 0, 0, "bank1"); |
| 735 | 735 | memory_install_write_bank(space, 0x0000, 0x1fff, 0, 0, "bank2"); |
| 736 | 736 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 737 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 737 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 738 | 738 | // RAM |
| 739 | 739 | memory_install_read_bank (space, 0x2000, 0xbeff, 0, 0, "bank3"); |
| 740 | 740 | memory_install_write_bank(space, 0x2000, 0xbeff, 0, 0, "bank4"); |
| 741 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000); | |
| 742 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000); | |
| 741 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x2000); | |
| 742 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x2000); | |
| 743 | 743 | // System reg |
| 744 | 744 | memory_install_read8_handler (space, 0xbf00, 0xbfff, 0, 0, sysreg_r); |
| 745 | 745 | memory_install_write8_handler(space, 0xbf00, 0xbfff, 0, 0, sysreg_w); |
| r8453 | r8454 | |
| 754 | 754 | memory_install_read_bank (space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 755 | 755 | memory_install_write_bank(space, 0x0000, 0x3fff, 0, 0, "bank2"); |
| 756 | 756 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 757 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 757 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 758 | 758 | // RAM |
| 759 | 759 | memory_install_read_bank (space, 0x4000, 0xbeff, 0, 0, "bank3"); |
| 760 | 760 | memory_install_write_bank(space, 0x4000, 0xbeff, 0, 0, "bank4"); |
| 761 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 762 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 761 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 762 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 763 | 763 | // System reg |
| 764 | 764 | memory_install_read8_handler (space, 0xbf00, 0xbfff, 0, 0, sysreg_r); |
| 765 | 765 | memory_install_write8_handler(space, 0xbf00, 0xbfff, 0, 0, sysreg_w); |
| r8453 | r8454 | |
| 773 | 773 | // RAM |
| 774 | 774 | memory_install_read_bank (space, 0x0000, 0xbeff, 0, 0, "bank1"); |
| 775 | 775 | memory_install_write_bank(space, 0x0000, 0xbeff, 0, 0, "bank2"); |
| 776 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 777 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 776 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram"))); | |
| 777 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram"))); | |
| 778 | 778 | // System reg |
| 779 | 779 | memory_install_read8_handler (space, 0xbf00, 0xbfff, 0, 0, sysreg_r); |
| 780 | 780 | memory_install_write8_handler(space, 0xbf00, 0xbfff, 0, 0, sysreg_w); |
| r8453 | r8454 | |
| 789 | 789 | memory_install_read_bank (space, 0x0000, 0x5fff, 0, 0, "bank1"); |
| 790 | 790 | memory_install_write_bank(space, 0x0000, 0x5fff, 0, 0, "bank2"); |
| 791 | 791 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 792 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 792 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 793 | 793 | // RAM |
| 794 | 794 | memory_install_read_bank (space, 0x6000, 0xbfff, 0, 0, "bank3"); |
| 795 | 795 | memory_install_write_bank(space, 0x6000, 0xbfff, 0, 0, "bank4"); |
| 796 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x6000); | |
| 797 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x6000); | |
| 796 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x6000); | |
| 797 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x6000); | |
| 798 | 798 | // Video RAM |
| 799 | 799 | memory_install_read8_handler (space, 0xc000, 0xffff, 0, 0, gzu_r); |
| 800 | 800 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w); |
| r8453 | r8454 | |
| 806 | 806 | memory_install_read_bank (space, 0x0000, 0x1fff, 0, 0, "bank1"); |
| 807 | 807 | memory_install_write_bank(space, 0x0000, 0x1fff, 0, 0, "bank2"); |
| 808 | 808 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 809 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 809 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 810 | 810 | // RAM |
| 811 | 811 | memory_install_read_bank (space, 0x2000, 0xbfff, 0, 0, "bank3"); |
| 812 | 812 | memory_install_write_bank(space, 0x2000, 0xbfff, 0, 0, "bank4"); |
| 813 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000); | |
| 814 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000); | |
| 813 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x2000); | |
| 814 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x2000); | |
| 815 | 815 | // Video RAM |
| 816 | 816 | memory_install_read8_handler (space, 0xc000, 0xffff, 0, 0, gzu_r); |
| 817 | 817 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w); |
| r8453 | r8454 | |
| 823 | 823 | memory_install_read_bank (space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 824 | 824 | memory_install_write_bank(space, 0x0000, 0x3fff, 0, 0, "bank2"); |
| 825 | 825 | memory_set_bankptr(machine, "bank1", memory_region(machine,"maincpu") + 0x10000); |
| 826 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 826 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 827 | 827 | // RAM |
| 828 | 828 | memory_install_read_bank (space, 0x4000, 0xbfff, 0, 0, "bank3"); |
| 829 | 829 | memory_install_write_bank(space, 0x4000, 0xbfff, 0, 0, "bank4"); |
| 830 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 831 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 830 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 831 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 832 | 832 | // Video RAM |
| 833 | 833 | memory_install_read8_handler (space, 0xc000, 0xffff, 0, 0, gzu_r); |
| 834 | 834 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w); |
| r8453 | r8454 | |
| 839 | 839 | // RAM |
| 840 | 840 | memory_install_read_bank (space, 0x0000, 0xbfff, 0, 0, "bank1"); |
| 841 | 841 | memory_install_write_bank(space, 0x0000, 0xbfff, 0, 0, "bank2"); |
| 842 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 843 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 842 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram"))); | |
| 843 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram"))); | |
| 844 | 844 | // Video RAM |
| 845 | 845 | memory_install_read8_handler (space, 0xc000, 0xffff, 0, 0, gzu_r); |
| 846 | 846 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w); |
| r8453 | r8454 | |
| 869 | 869 | |
| 870 | 870 | static WRITE8_DEVICE_HANDLER(pk8020_portb_w) |
| 871 | 871 | { |
| 872 | running_device *fdc = dev | |
| 872 | running_device *fdc = dev | |
| 873 | 873 | wd17xx_set_side(fdc,BIT(data,4)); |
| 874 | 874 | if (BIT(data,0)) { |
| 875 | 875 | wd17xx_set_drive(fdc,0); |
| r8453 | r8454 | |
| 900 | 900 | |
| 901 | 901 | static WRITE8_DEVICE_HANDLER(pk8020_2_portc_w) |
| 902 | 902 | { |
| 903 | running_device *speaker = dev | |
| 903 | running_device *speaker = dev | |
| 904 | 904 | |
| 905 | 905 | sound_gate = BIT(data,3); |
| 906 | 906 | |
| r8453 | r8454 | |
| 929 | 929 | |
| 930 | 930 | static WRITE_LINE_DEVICE_HANDLER( pk8020_pit_out0 ) |
| 931 | 931 | { |
| 932 | running_device *speaker = dev | |
| 932 | running_device *speaker = dev | |
| 933 | 933 | |
| 934 | 934 | sound_level = state; |
| 935 | 935 | |
| r8453 | r8454 | |
| 975 | 975 | |
| 976 | 976 | static IRQ_CALLBACK( pk8020_irq_callback ) |
| 977 | 977 | { |
| 978 | return pic8259_acknowledge(dev | |
| 978 | return pic8259_acknowledge(dev | |
| 979 | 979 | } |
| 980 | 980 | |
| 981 | 981 | MACHINE_RESET( pk8020 ) |
| 982 | 982 | { |
| 983 | 983 | pk8020_set_bank(machine,0); |
| 984 | cpu_set_irq_callback( | |
| 984 | cpu_set_irq_callback(m | |
| 985 | 985 | |
| 986 | 986 | sound_gate = 0; |
| 987 | 987 | sound_level = 0; |
| r8453 | r8454 | |
| 990 | 990 | INTERRUPT_GEN( pk8020_interrupt ) |
| 991 | 991 | { |
| 992 | 992 | takt ^= 1; |
| 993 | pic8259_ir4_w(dev | |
| 993 | pic8259_ir4_w(dev | |
| 994 | 994 | } |
| r8453 | r8454 | |
|---|---|---|
| 153 | 153 | static int vdudriverset(running_machine *machine) |
| 154 | 154 | { |
| 155 | 155 | int PC; |
| 156 | PC = cpu_get_pc( | |
| 156 | PC = cpu_get_pc(m | |
| 157 | 157 | return (((PC >= 0xc000) && (PC <= 0xdfff)) || ((pagedRAM) && ((PC >= 0xa000) && (PC <= 0xafff)))); |
| 158 | 158 | } |
| 159 | 159 | |
| r8453 | r8454 | |
| 447 | 447 | static int bbcm_vdudriverset(running_machine *machine) |
| 448 | 448 | { |
| 449 | 449 | int PC; |
| 450 | PC = cpu_get_pc( | |
| 450 | PC = cpu_get_pc(m | |
| 451 | 451 | return ((PC >= 0xc000) && (PC <= 0xdfff)); |
| 452 | 452 | } |
| 453 | 453 | |
| r8453 | r8454 | |
| 610 | 610 | |
| 611 | 611 | if ((offset>=0x200) && (offset<=0x2ff)) /* SHEILA */ |
| 612 | 612 | { |
| 613 | running_device *via_0 = devtag_get_device(space->machine, "via6522_0"); | |
| 614 | running_device *via_1 = devtag_get_device(space->machine, "via6522_1"); | |
| 613 | running_device *via_0 = space->machine->device("via6522_0"); | |
| 614 | running_device *via_1 = space->machine->device("via6522_1"); | |
| 615 | 615 | |
| 616 | 616 | myo=offset-0x200; |
| 617 | 617 | if ((myo>=0x00) && (myo<=0x07)) return bbc_6845_r(space, myo-0x00); /* Video Controller */ |
| 618 | 618 | if ((myo>=0x08) && (myo<=0x0f)) |
| 619 | 619 | { |
| 620 | running_device *acia = | |
| 620 | running_device *acia = | |
| 621 | 621 | |
| 622 | 622 | if ((myo - 0x08) & 1) |
| 623 | 623 | return acia6850_stat_r(acia, 0); |
| r8453 | r8454 | |
| 625 | 625 | return acia6850_data_r(acia, 0); |
| 626 | 626 | } |
| 627 | 627 | if ((myo>=0x10) && (myo<=0x17)) return 0xfe; /* Serial System Chip */ |
| 628 | if ((myo>=0x18) && (myo<=0x1f)) return uPD7002_r( | |
| 628 | if ((myo>=0x18) && (myo<=0x1f)) return uPD7002_r( | |
| 629 | 629 | if ((myo>=0x20) && (myo<=0x23)) return 0xfe; /* VideoULA */ |
| 630 | 630 | if ((myo>=0x24) && (myo<=0x27)) return bbcm_wd1770l_read(space, myo-0x24); /* 1770 */ |
| 631 | 631 | if ((myo>=0x28) && (myo<=0x2f)) return bbcm_wd1770_read(space, myo-0x28); /* disc control latch */ |
| r8453 | r8454 | |
| 649 | 649 | |
| 650 | 650 | if ((offset>=0x200) && (offset<=0x2ff)) /* SHEILA */ |
| 651 | 651 | { |
| 652 | running_device *via_0 = devtag_get_device(space->machine, "via6522_0"); | |
| 653 | running_device *via_1 = devtag_get_device(space->machine, "via6522_1"); | |
| 652 | running_device *via_0 = space->machine->device("via6522_0"); | |
| 653 | running_device *via_1 = space->machine->device("via6522_1"); | |
| 654 | 654 | |
| 655 | 655 | myo=offset-0x200; |
| 656 | 656 | if ((myo>=0x00) && (myo<=0x07)) bbc_6845_w(space, myo-0x00,data); /* Video Controller */ |
| 657 | 657 | if ((myo>=0x08) && (myo<=0x0f)) |
| 658 | 658 | { |
| 659 | running_device *acia = | |
| 659 | running_device *acia = | |
| 660 | 660 | |
| 661 | 661 | if ((myo - 0x08) & 1) |
| 662 | 662 | acia6850_ctrl_w(acia, 0, data); |
| r8453 | r8454 | |
| 664 | 664 | acia6850_data_w(acia, 0, data); |
| 665 | 665 | } |
| 666 | 666 | if ((myo>=0x10) && (myo<=0x17)) bbc_SerialULA_w(space, myo-0x10,data); /* Serial System Chip */ |
| 667 | if ((myo>=0x18) && (myo<=0x1f)) uPD7002_w( | |
| 667 | if ((myo>=0x18) && (myo<=0x1f)) uPD7002_w( | |
| 668 | 668 | if ((myo>=0x20) && (myo<=0x23)) bbc_videoULA_w(space, myo-0x20,data); /* VideoULA */ |
| 669 | 669 | if ((myo>=0x24) && (myo<=0x27)) bbcm_wd1770l_write(space, myo-0x24,data); /* 1770 */ |
| 670 | 670 | if ((myo>=0x28) && (myo<=0x2f)) bbcm_wd1770_write(space, myo-0x28,data); /* disc control latch */ |
| r8453 | r8454 | |
| 813 | 813 | "COL0", "COL1", "COL2", "COL3", "COL4", |
| 814 | 814 | "COL5", "COL6", "COL7", "COL8", "COL9" |
| 815 | 815 | }; |
| 816 | running_device *via_0 = dev | |
| 816 | running_device *via_0 = dev | |
| 817 | 817 | |
| 818 | 818 | /* only do auto scan if keyboard is not enabled */ |
| 819 | 819 | if (b3_keyboard == 1) |
| r8453 | r8454 | |
| 851 | 851 | "COL0", "COL1", "COL2", "COL3", "COL4", |
| 852 | 852 | "COL5", "COL6", "COL7", "COL8", "COL9" |
| 853 | 853 | }; |
| 854 | running_device *via_0 = dev | |
| 854 | running_device *via_0 = dev | |
| 855 | 855 | |
| 856 | 856 | /* only do auto scan if keyboard is not enabled */ |
| 857 | 857 | if (b3_keyboard == 1) |
| r8453 | r8454 | |
| 895 | 895 | "COL0", "COL1", "COL2", "COL3", "COL4", |
| 896 | 896 | "COL5", "COL6", "COL7", "COL8", "COL9" |
| 897 | 897 | }; |
| 898 | running_device *via_0 = | |
| 898 | running_device *via_0 = | |
| 899 | 899 | |
| 900 | 900 | column = data & 0x0f; |
| 901 | 901 | row = (data>>4) & 0x07; |
| r8453 | r8454 | |
| 986 | 986 | if (b0_sound == 0) |
| 987 | 987 | { |
| 988 | 988 | //logerror("Doing an unsafe write to the sound chip %d \n",data); |
| 989 | sn76496_w(dev | |
| 989 | sn76496_w(dev | |
| 990 | 990 | } |
| 991 | 991 | if (b3_keyboard == 0) |
| 992 | 992 | { |
| r8453 | r8454 | |
| 1099 | 1099 | if (b0_sound == 1) |
| 1100 | 1100 | { |
| 1101 | 1101 | b0_sound = 0; |
| 1102 | sn76496_w( | |
| 1102 | sn76496_w( | |
| 1103 | 1103 | } |
| 1104 | 1104 | break; |
| 1105 | 1105 | case 1: |
| r8453 | r8454 | |
| 1245 | 1245 | /* joystick EOC */ |
| 1246 | 1246 | static READ8_DEVICE_HANDLER( bbcb_via_system_read_cb1 ) |
| 1247 | 1247 | { |
| 1248 | return uPD7002_EOC_r(dev | |
| 1248 | return uPD7002_EOC_r(dev | |
| 1249 | 1249 | } |
| 1250 | 1250 | |
| 1251 | 1251 | |
| r8453 | r8454 | |
| 1342 | 1342 | |
| 1343 | 1343 | static UPD7002_EOC(BBC_uPD7002_EOC) |
| 1344 | 1344 | { |
| 1345 | running_device *via_0 = dev | |
| 1345 | running_device *via_0 = dev | |
| 1346 | 1346 | via_cb1_w(via_0, data); |
| 1347 | 1347 | } |
| 1348 | 1348 | |
| r8453 | r8454 | |
| 1374 | 1374 | { |
| 1375 | 1375 | if (!mc6850_clock && new_clock) |
| 1376 | 1376 | { |
| 1377 | running_device *acia = | |
| 1377 | running_device *acia = m | |
| 1378 | 1378 | acia6850_tx_clock_in(acia); |
| 1379 | 1379 | } |
| 1380 | 1380 | mc6850_clock = new_clock; |
| r8453 | r8454 | |
| 1384 | 1384 | { |
| 1385 | 1385 | |
| 1386 | 1386 | double dev_val; |
| 1387 | dev_val=cassette_input( | |
| 1387 | dev_val=cassette_input(m | |
| 1388 | 1388 | |
| 1389 | 1389 | // look for rising edges on the cassette wave |
| 1390 | 1390 | if (((dev_val>=0.0) && (last_dev_val<0.0)) || ((dev_val<0.0) && (last_dev_val>=0.0))) |
| r8453 | r8454 | |
| 1443 | 1443 | { |
| 1444 | 1444 | if (status) |
| 1445 | 1445 | { |
| 1446 | cassette_change_state( | |
| 1446 | cassette_change_state(m | |
| 1447 | 1447 | timer_adjust_periodic(bbc_tape_timer, attotime_zero, 0, ATTOTIME_IN_HZ(44100)); |
| 1448 | 1448 | } |
| 1449 | 1449 | else |
| 1450 | 1450 | { |
| 1451 | cassette_change_state( | |
| 1451 | cassette_change_state(m | |
| 1452 | 1452 | timer_reset(bbc_tape_timer, attotime_never); |
| 1453 | 1453 | len0 = 0; |
| 1454 | 1454 | len1 = 0; |
| r8453 | r8454 | |
| 1485 | 1485 | { |
| 1486 | 1486 | /* I'll pulse it because if I used hold-line I'm not sure |
| 1487 | 1487 | it would clear - to be checked */ |
| 1488 | cpu_set_input_line(dev | |
| 1488 | cpu_set_input_line(dev | |
| 1489 | 1489 | } |
| 1490 | 1490 | } |
| 1491 | 1491 | |
| r8453 | r8454 | |
| 1504 | 1504 | static READ8_HANDLER( bbc_i8271_read ) |
| 1505 | 1505 | { |
| 1506 | 1506 | int ret; |
| 1507 | running_device *i8271 = | |
| 1507 | running_device *i8271 = | |
| 1508 | 1508 | ret=0x0ff; |
| 1509 | 1509 | logerror("i8271 read %d ",offset); |
| 1510 | 1510 | switch (offset) |
| r8453 | r8454 | |
| 1530 | 1530 | |
| 1531 | 1531 | static WRITE8_HANDLER( bbc_i8271_write ) |
| 1532 | 1532 | { |
| 1533 | running_device *i8271 = | |
| 1533 | running_device *i8271 = | |
| 1534 | 1534 | logerror("i8271 write %d %d\n",offset,data); |
| 1535 | 1535 | |
| 1536 | 1536 | switch (offset) |
| r8453 | r8454 | |
| 1653 | 1653 | |
| 1654 | 1654 | static WRITE8_HANDLER(bbc_wd177x_status_w) |
| 1655 | 1655 | { |
| 1656 | running_device *fdc = | |
| 1656 | running_device *fdc = | |
| 1657 | 1657 | drive_control = data; |
| 1658 | 1658 | |
| 1659 | 1659 | /* set drive */ |
| r8453 | r8454 | |
| 1675 | 1675 | READ8_HANDLER ( bbc_wd1770_read ) |
| 1676 | 1676 | { |
| 1677 | 1677 | int retval=0xff; |
| 1678 | running_device *fdc = | |
| 1678 | running_device *fdc = | |
| 1679 | 1679 | switch (offset) |
| 1680 | 1680 | { |
| 1681 | 1681 | case 4: |
| r8453 | r8454 | |
| 1700 | 1700 | |
| 1701 | 1701 | WRITE8_HANDLER ( bbc_wd1770_write ) |
| 1702 | 1702 | { |
| 1703 | running_device *fdc = | |
| 1703 | running_device *fdc = | |
| 1704 | 1704 | logerror("wd177x write: $%02X $%02X\n", offset,data); |
| 1705 | 1705 | switch (offset) |
| 1706 | 1706 | { |
| r8453 | r8454 | |
| 1764 | 1764 | |
| 1765 | 1765 | static WRITE8_HANDLER( bbc_opus_status_w ) |
| 1766 | 1766 | { |
| 1767 | running_device *fdc = | |
| 1767 | running_device *fdc = | |
| 1768 | 1768 | drive_control = data; |
| 1769 | 1769 | |
| 1770 | 1770 | /* set drive */ |
| r8453 | r8454 | |
| 1783 | 1783 | |
| 1784 | 1784 | READ8_HANDLER( bbc_opus_read ) |
| 1785 | 1785 | { |
| 1786 | running_device *fdc = | |
| 1786 | running_device *fdc = | |
| 1787 | 1787 | logerror("wd177x read: $%02X\n", offset); |
| 1788 | 1788 | |
| 1789 | 1789 | if (bbc_DFSType==6) |
| r8453 | r8454 | |
| 1813 | 1813 | |
| 1814 | 1814 | WRITE8_HANDLER (bbc_opus_write) |
| 1815 | 1815 | { |
| 1816 | running_device *fdc = | |
| 1816 | running_device *fdc = | |
| 1817 | 1817 | logerror("wd177x write: $%02X $%02X\n", offset,data); |
| 1818 | 1818 | |
| 1819 | 1819 | if (bbc_DFSType==6) |
| r8453 | r8454 | |
| 1861 | 1861 | READ8_HANDLER ( bbcm_wd1770_read ) |
| 1862 | 1862 | { |
| 1863 | 1863 | int retval=0xff; |
| 1864 | running_device *fdc = | |
| 1864 | running_device *fdc = | |
| 1865 | 1865 | switch (offset) |
| 1866 | 1866 | { |
| 1867 | 1867 | case 0: |
| r8453 | r8454 | |
| 1885 | 1885 | |
| 1886 | 1886 | WRITE8_HANDLER ( bbcm_wd1770_write ) |
| 1887 | 1887 | { |
| 1888 | running_device *fdc = | |
| 1888 | running_device *fdc = | |
| 1889 | 1889 | //logerror("wd177x write: $%02X $%02X\n", offset,data); |
| 1890 | 1890 | switch (offset) |
| 1891 | 1891 | { |
| r8453 | r8454 | |
| 1914 | 1914 | |
| 1915 | 1915 | WRITE8_HANDLER ( bbcm_wd1770l_write ) |
| 1916 | 1916 | { |
| 1917 | running_device *fdc = | |
| 1917 | running_device *fdc = | |
| 1918 | 1918 | drive_control = data; |
| 1919 | 1919 | |
| 1920 | 1920 | /* set drive */ |
| r8453 | r8454 | |
|---|---|---|
| 113 | 113 | addr = (header->load_address_l & 0x0ff) | ((header->load_address_h & 0x0ff)<<8); |
| 114 | 114 | |
| 115 | 115 | for (i=0; i<datasize; i++) |
| 116 | messram_get_ptr( | |
| 116 | messram_get_ptr( | |
| 117 | 117 | return IMAGE_INIT_PASS; |
| 118 | 118 | } |
| 119 | 119 | |
| r8453 | r8454 | |
| 191 | 191 | |
| 192 | 192 | WRITE8_HANDLER(kc85_disc_hw_terminal_count_w) |
| 193 | 193 | { |
| 194 | running_device *fdc = | |
| 194 | running_device *fdc = | |
| 195 | 195 | logerror("kc85 disc hw tc w: %02x\n",data); |
| 196 | 196 | upd765_tc_w(fdc, data & 0x01); |
| 197 | 197 | } |
| r8453 | r8454 | |
| 224 | 224 | |
| 225 | 225 | static TIMER_CALLBACK(kc85_disk_reset_timer_callback) |
| 226 | 226 | { |
| 227 | cpu_set_reg(devtag_get_device(machine, "disc"), STATE_GENPC, 0x0f000); | |
| 228 | cpu_set_reg(devtag_get_device(machine, "maincpu"), STATE_GENPC, 0x0f000); | |
| 227 | cpu_set_reg(machine->device("disc"), STATE_GENPC, 0x0f000); | |
| 228 | cpu_set_reg(machine->device("maincpu"), STATE_GENPC, 0x0f000); | |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | static void kc_disc_interface_init(running_machine *machine) |
| r8453 | r8454 | |
| 396 | 396 | bit = 0; |
| 397 | 397 | |
| 398 | 398 | /* get data from cassette */ |
| 399 | if (cassette_input( | |
| 399 | if (cassette_input(m | |
| 400 | 400 | bit = 1; |
| 401 | 401 | |
| 402 | 402 | /* update astb with bit */ |
| r8453 | r8454 | |
| 414 | 414 | if (((kc_cassette_motor_state^motor_state)&0x01)!=0) |
| 415 | 415 | { |
| 416 | 416 | /* set new motor state in cassette device */ |
| 417 | cassette_change_state( | |
| 417 | cassette_change_state(m | |
| 418 | 418 | motor_state ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, |
| 419 | 419 | CASSETTE_MASK_MOTOR); |
| 420 | 420 | |
| r8453 | r8454 | |
| 1128 | 1128 | /* ram8 block chosen */ |
| 1129 | 1129 | ram8_block = ((kc85_84_data)>>4) & 0x01; |
| 1130 | 1130 | |
| 1131 | mem_ptr = messram_get_ptr( | |
| 1131 | mem_ptr = messram_get_ptr(m | |
| 1132 | 1132 | |
| 1133 | 1133 | memory_set_bankptr(machine, "bank3", mem_ptr); |
| 1134 | 1134 | memory_set_bankptr(machine, "bank4", mem_ptr+0x02800); |
| r8453 | r8454 | |
| 1193 | 1193 | |
| 1194 | 1194 | /* yes; set address of bank */ |
| 1195 | 1195 | memory_install_read_bank(space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 1196 | memory_set_bankptr(machine, "bank1", messram_get_ptr( | |
| 1196 | memory_set_bankptr(machine, "bank1", messram_get_ptr(m | |
| 1197 | 1197 | |
| 1198 | 1198 | /* write protect ram? */ |
| 1199 | 1199 | if ((kc85_pio_data[0] & (1<<3))==0) |
| r8453 | r8454 | |
| 1210 | 1210 | |
| 1211 | 1211 | /* ram is enabled and write enabled; and set address of bank */ |
| 1212 | 1212 | memory_install_write_bank(space, 0x0000, 0x3fff, 0, 0, "bank7"); |
| 1213 | memory_set_bankptr(machine, "bank7", messram_get_ptr( | |
| 1213 | memory_set_bankptr(machine, "bank7", messram_get_ptr(m | |
| 1214 | 1214 | } |
| 1215 | 1215 | } |
| 1216 | 1216 | else |
| r8453 | r8454 | |
| 1233 | 1233 | { |
| 1234 | 1234 | UINT8 *mem_ptr; |
| 1235 | 1235 | |
| 1236 | mem_ptr = messram_get_ptr( | |
| 1236 | mem_ptr = messram_get_ptr(m | |
| 1237 | 1237 | |
| 1238 | 1238 | /* yes */ |
| 1239 | 1239 | memory_install_read_bank(space, 0x4000, 0x7fff, 0, 0, "bank2"); |
| r8453 | r8454 | |
| 1352 | 1352 | |
| 1353 | 1353 | WRITE8_HANDLER ( kc85_4_pio_data_w ) |
| 1354 | 1354 | { |
| 1355 | running_device *speaker = | |
| 1355 | running_device *speaker = | |
| 1356 | 1356 | kc85_pio_data[offset] = data; |
| 1357 | 1357 | z80pio_d_w(kc85_z80pio, offset, data); |
| 1358 | 1358 | |
| r8453 | r8454 | |
| 1477 | 1477 | /* yes */ |
| 1478 | 1478 | memory_install_read_bank(space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 1479 | 1479 | /* set address of bank */ |
| 1480 | memory_set_bankptr(machine, "bank1", messram_get_ptr( | |
| 1480 | memory_set_bankptr(machine, "bank1", messram_get_ptr(m | |
| 1481 | 1481 | |
| 1482 | 1482 | /* write protect ram? */ |
| 1483 | 1483 | if ((kc85_pio_data[0] & (1<<3))==0) |
| r8453 | r8454 | |
| 1495 | 1495 | /* ram is enabled and write enabled */ |
| 1496 | 1496 | memory_install_write_bank(space, 0x0000, 0x3fff, 0, 0, "bank6"); |
| 1497 | 1497 | /* set address of bank */ |
| 1498 | memory_set_bankptr(machine, "bank6", messram_get_ptr( | |
| 1498 | memory_set_bankptr(machine, "bank6", messram_get_ptr(m | |
| 1499 | 1499 | } |
| 1500 | 1500 | } |
| 1501 | 1501 | else |
| r8453 | r8454 | |
| 1518 | 1518 | { |
| 1519 | 1519 | /* IRM enabled */ |
| 1520 | 1520 | LOG(("IRM enabled\n")); |
| 1521 | ram_page = messram_get_ptr( | |
| 1521 | ram_page = messram_get_ptr(m | |
| 1522 | 1522 | |
| 1523 | 1523 | memory_set_bankptr(machine, "bank3", ram_page); |
| 1524 | 1524 | memory_set_bankptr(machine, "bank8", ram_page); |
| r8453 | r8454 | |
| 1529 | 1529 | { |
| 1530 | 1530 | /* RAM8 ACCESS */ |
| 1531 | 1531 | LOG(("RAM8 enabled\n")); |
| 1532 | ram_page = messram_get_ptr( | |
| 1532 | ram_page = messram_get_ptr(m | |
| 1533 | 1533 | |
| 1534 | 1534 | memory_set_bankptr(machine, "bank3", ram_page); |
| 1535 | 1535 | memory_install_read_bank(space, 0x8000, 0xbfff, 0, 0, "bank3"); |
| r8453 | r8454 | |
| 1581 | 1581 | |
| 1582 | 1582 | WRITE8_HANDLER ( kc85_3_pio_data_w ) |
| 1583 | 1583 | { |
| 1584 | running_device *speaker = | |
| 1584 | running_device *speaker = | |
| 1585 | 1585 | kc85_pio_data[offset] = data; |
| 1586 | 1586 | z80pio_d_w(kc85_z80pio, offset, data); |
| 1587 | 1587 | |
| r8453 | r8454 | |
| 1652 | 1652 | |
| 1653 | 1653 | static TIMER_CALLBACK(kc85_reset_timer_callback) |
| 1654 | 1654 | { |
| 1655 | cpu_set_reg( | |
| 1655 | cpu_set_reg(m | |
| 1656 | 1656 | } |
| 1657 | 1657 | |
| 1658 | 1658 | READ8_HANDLER ( kc85_pio_data_r ) |
| r8453 | r8454 | |
| 1802 | 1802 | /* timer to transmit pulses to kc base unit */ |
| 1803 | 1803 | timer_pulse(machine, ATTOTIME_IN_USEC(1024), NULL, 0, kc_keyboard_transmit_timer_callback); |
| 1804 | 1804 | |
| 1805 | timer_pulse(machine, ATTOTIME_IN_HZ(15625), (void *) | |
| 1805 | timer_pulse(machine, ATTOTIME_IN_HZ(15625), (void *)m | |
| 1806 | 1806 | timer_set(machine, attotime_zero, NULL, 0, kc85_reset_timer_callback); |
| 1807 | 1807 | } |
| 1808 | 1808 | |
| r8453 | r8454 | |
| 1831 | 1831 | kc85_pio_data[0] = 0x0f; |
| 1832 | 1832 | kc85_pio_data[1] = 0x0f1; |
| 1833 | 1833 | |
| 1834 | kc85_z80pio = | |
| 1834 | kc85_z80pio = m | |
| 1835 | 1835 | |
| 1836 | 1836 | kc85_4_update_0x04000(machine); |
| 1837 | 1837 | kc85_4_update_0x08000(machine); |
| r8453 | r8454 | |
| 1864 | 1864 | kc85_pio_data[0] = 0x0f; |
| 1865 | 1865 | kc85_pio_data[1] = 0x0f1; |
| 1866 | 1866 | |
| 1867 | memory_set_bankptr(machine, "bank2",messram_get_ptr(devtag_get_device(machine, "messram"))+0x0c000); | |
| 1868 | memory_set_bankptr(machine, "bank7",messram_get_ptr(devtag_get_device(machine, "messram"))+0x0c000); | |
| 1867 | memory_set_bankptr(machine, "bank2",messram_get_ptr(machine->device("messram"))+0x0c000); | |
| 1868 | memory_set_bankptr(machine, "bank7",messram_get_ptr(machine->device("messram"))+0x0c000); | |
| 1869 | 1869 | |
| 1870 | kc85_z80pio = | |
| 1870 | kc85_z80pio = m | |
| 1871 | 1871 | |
| 1872 | 1872 | kc85_3_update_0x08000(machine); |
| 1873 | 1873 | kc85_3_update_0x0c000(machine); |
| r8453 | r8454 | |
|---|---|---|
| 627 | 627 | devcb_resolve_write_line(&upd3301->out_vrtc_func, &intf->out_vrtc_func, device); |
| 628 | 628 | |
| 629 | 629 | /* get the screen device */ |
| 630 | upd3301->screen = downcast<screen_device *>(dev | |
| 630 | upd3301->screen = downcast<screen_device *>(dev | |
| 631 | 631 | assert(upd3301->screen != NULL); |
| 632 | 632 | |
| 633 | 633 | /* get character width */ |
| r8453 | r8454 | |
|---|---|---|
| 114 | 114 | r.max_x = r1.max_x; |
| 115 | 115 | r.min_y = r.max_y = ula_scanline_count; |
| 116 | 116 | bitmap_fill(bitmap, &r, 1); |
| 117 | // logerror("ULA %3d[%d] NMI, R:$%02X, $%04x\n", machine->primary_screen->vpos(), ula_scancode_count, (unsigned) cpu_get_reg( | |
| 117 | // logerror("ULA %3d[%d] NMI, R:$%02X, $%04x\n", machine->primary_screen->vpos(), ula_scancode_count, (unsigned) cpu_get_reg(m | |
| 118 | 118 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE); |
| 119 | 119 | if (++ula_scanline_count == height) |
| 120 | 120 | ula_scanline_count = 0; |
| r8453 | r8454 | |
| 130 | 130 | */ |
| 131 | 131 | if (ula_irq_active) |
| 132 | 132 | { |
| 133 | // logerror("ULA %3d[%d] IRQ, R:$%02X, $%04x\n", machine->primary_screen->vpos(), ula_scancode_count, (unsigned) cpu_get_reg( | |
| 133 | // logerror("ULA %3d[%d] IRQ, R:$%02X, $%04x\n", machine->primary_screen->vpos(), ula_scancode_count, (unsigned) cpu_get_reg(m | |
| 134 | 134 | |
| 135 | 135 | ula_irq_active = 0; |
| 136 | 136 | cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE); |
| r8453 | r8454 | |
| 148 | 148 | { |
| 149 | 149 | bitmap_t *bitmap = machine->generic.tmpbitmap; |
| 150 | 150 | UINT16 y, *scanline; |
| 151 | UINT16 ireg = cpu_get_reg( | |
| 151 | UINT16 ireg = cpu_get_reg(m | |
| 152 | 152 | UINT8 data, *chrgen, creg; |
| 153 | 153 | |
| 154 | 154 | if (param) |
| 155 | creg = cpu_get_reg( | |
| 155 | creg = cpu_get_reg(m | |
| 156 | 156 | else |
| 157 | creg = cpu_get_reg( | |
| 157 | creg = cpu_get_reg(m | |
| 158 | 158 | |
| 159 | 159 | chrgen = memory_region(machine, region); |
| 160 | 160 |
| r8453 | r8454 | |
|---|---|---|
| 230 | 230 | data & GCtrlHiLo ? "Hi" : "Lo", |
| 231 | 231 | data & GCtrlSWChar ? "C0" : "C1", |
| 232 | 232 | data & GCtrlWI ? "Wi" : " ", |
| 233 | cpu_get_pc( | |
| 233 | cpu_get_pc(m | |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | // called when the 6845 changes the character row |
| r8453 | r8454 | |
| 314 | 314 | |
| 315 | 315 | GCtrl=0; |
| 316 | 316 | |
| 317 | machine->generic.videoram.u8=messram_get_ptr( | |
| 317 | machine->generic.videoram.u8=messram_get_ptr(m | |
| 318 | 318 | |
| 319 | 319 | ClkMax=65000; |
| 320 | 320 | FlashCount=0; |
| r8453 | r8454 | |
|---|---|---|
| 303 | 303 | static void pdp1_draw_panel(running_machine *machine, bitmap_t *bitmap) |
| 304 | 304 | { |
| 305 | 305 | /* column 1: registers, test word, test address */ |
| 306 | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset+2*8, y_panel_pc_offset+8, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_PC), 16); | |
| 307 | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset+2*8, y_panel_ma_offset+8, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_MA), 16); | |
| 308 | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_mb_offset+8, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_MB), 18); | |
| 309 | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_ac_offset+8, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_AC), 18); | |
| 310 | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_io_offset+8, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_IO), 18); | |
| 311 | pdp1_draw_switch(machine, bitmap, x_panel_col1_offset, y_panel_ta_offset+8, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_EXTEND_SW)); | |
| 312 | pdp1_draw_multipleswitch(machine, bitmap, x_panel_col1_offset+2*8, y_panel_ta_offset+8, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_TA), 16); | |
| 313 | pdp1_draw_multipleswitch(machine, bitmap, x_panel_col1_offset, y_panel_tw_offset+8, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_TW), 18); | |
| 306 | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset+2*8, y_panel_pc_offset+8, cpu_get_reg(machine->device("maincpu"), PDP1_PC), 16); | |
| 307 | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset+2*8, y_panel_ma_offset+8, cpu_get_reg(machine->device("maincpu"), PDP1_MA), 16); | |
| 308 | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_mb_offset+8, cpu_get_reg(machine->device("maincpu"), PDP1_MB), 18); | |
| 309 | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_ac_offset+8, cpu_get_reg(machine->device("maincpu"), PDP1_AC), 18); | |
| 310 | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_io_offset+8, cpu_get_reg(machine->device("maincpu"), PDP1_IO), 18); | |
| 311 | pdp1_draw_switch(machine, bitmap, x_panel_col1_offset, y_panel_ta_offset+8, cpu_get_reg(machine->device("maincpu"), PDP1_EXTEND_SW)); | |
| 312 | pdp1_draw_multipleswitch(machine, bitmap, x_panel_col1_offset+2*8, y_panel_ta_offset+8, cpu_get_reg(machine->device("maincpu"), PDP1_TA), 16); | |
| 313 | pdp1_draw_multipleswitch(machine, bitmap, x_panel_col1_offset, y_panel_tw_offset+8, cpu_get_reg(machine->device("maincpu"), PDP1_TW), 18); | |
| 314 | 314 | |
| 315 | 315 | /* column 2: 1-bit indicators */ |
| 316 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_RUN)); | |
| 317 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cyc_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_CYC)); | |
| 318 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_defer_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_DEFER)); | |
| 316 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset, cpu_get_reg(machine->device("maincpu"), PDP1_RUN)); | |
| 317 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cyc_offset, cpu_get_reg(machine->device("maincpu"), PDP1_CYC)); | |
| 318 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_defer_offset, cpu_get_reg(machine->device("maincpu"), PDP1_DEFER)); | |
| 319 | 319 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_hs_cyc_offset, 0); /* not emulated */ |
| 320 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_brk_ctr_1_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_BRK_CTR) & 1); | |
| 321 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_brk_ctr_2_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_BRK_CTR) & 2); | |
| 322 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ov_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_OV)); | |
| 323 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_RIM)); | |
| 324 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_sbm_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_SBM)); | |
| 325 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_exd_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_EXD)); | |
| 326 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_IOH)); | |
| 327 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioc_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_IOC)); | |
| 328 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_IOS)); | |
| 320 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_brk_ctr_1_offset, cpu_get_reg(machine->device("maincpu"), PDP1_BRK_CTR) & 1); | |
| 321 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_brk_ctr_2_offset, cpu_get_reg(machine->device("maincpu"), PDP1_BRK_CTR) & 2); | |
| 322 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ov_offset, cpu_get_reg(machine->device("maincpu"), PDP1_OV)); | |
| 323 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset, cpu_get_reg(machine->device("maincpu"), PDP1_RIM)); | |
| 324 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_sbm_offset, cpu_get_reg(machine->device("maincpu"), PDP1_SBM)); | |
| 325 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_exd_offset, cpu_get_reg(machine->device("maincpu"), PDP1_EXD)); | |
| 326 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset, cpu_get_reg(machine->device("maincpu"), PDP1_IOH)); | |
| 327 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioc_offset, cpu_get_reg(machine->device("maincpu"), PDP1_IOC)); | |
| 328 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset, cpu_get_reg(machine->device("maincpu"), PDP1_IOS)); | |
| 329 | 329 | |
| 330 | 330 | /* column 3: power, single step, single inst, sense, flags, instr... */ |
| 331 | 331 | pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_power_offset, 1); /* always on */ |
| 332 | 332 | pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_power_offset, 1); /* always on */ |
| 333 | pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_sngl_step_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_SNGL_STEP)); | |
| 334 | pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_sngl_step_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_SNGL_STEP)); | |
| 335 | pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_sngl_inst_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_SNGL_INST)); | |
| 336 | pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_sngl_inst_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_SNGL_INST)); | |
| 337 | pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_ss_offset+8, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_SS), 6); | |
| 338 | pdp1_draw_multipleswitch(machine, bitmap, x_panel_col3_offset, y_panel_ss_offset+2*8, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_SS), 6); | |
| 339 | pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_pf_offset+8, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_PF), 6); | |
| 340 | pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_ir_offset+8, cpu_get_reg(devtag_get_device(machine, "maincpu"), PDP1_IR), 5); | |
| 333 | pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_sngl_step_offset, cpu_get_reg(machine->device("maincpu"), PDP1_SNGL_STEP)); | |
| 334 | pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_sngl_step_offset, cpu_get_reg(machine->device("maincpu"), PDP1_SNGL_STEP)); | |
| 335 | pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_sngl_inst_offset, cpu_get_reg(machine->device("maincpu"), PDP1_SNGL_INST)); | |
| 336 | pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_sngl_inst_offset, cpu_get_reg(machine->device("maincpu"), PDP1_SNGL_INST)); | |
| 337 | pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_ss_offset+8, cpu_get_reg(machine->device("maincpu"), PDP1_SS), 6); | |
| 338 | pdp1_draw_multipleswitch(machine, bitmap, x_panel_col3_offset, y_panel_ss_offset+2*8, cpu_get_reg(machine->device("maincpu"), PDP1_SS), 6); | |
| 339 | pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_pf_offset+8, cpu_get_reg(machine->device("maincpu"), PDP1_PF), 6); | |
| 340 | pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_ir_offset+8, cpu_get_reg(machine->device("maincpu"), PDP1_IR), 5); | |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 |
| r8453 | r8454 | |
|---|---|---|
| 35 | 35 | pc8401a_state *state = (pc8401a_state *)machine->driver_data; |
| 36 | 36 | |
| 37 | 37 | /* find devices */ |
| 38 | state->sed1330 = devtag_get_device(machine, SED1330_TAG); | |
| 39 | state->mc6845 = devtag_get_device(machine, MC6845_TAG); | |
| 40 | state->lcd = devtag_get_device(machine, SCREEN_TAG); | |
| 38 | state->sed1330 = machine->device(SED1330_TAG); | |
| 39 | state->mc6845 = machine->device(MC6845_TAG); | |
| 40 | state->lcd = machine->device(SCREEN_TAG); | |
| 41 | 41 | |
| 42 | 42 | /* allocate video memory */ |
| 43 | 43 | state->video_ram = auto_alloc_array(machine, UINT8, PC8500_LCD_VIDEORAM_SIZE); |
| r8453 | r8454 | |
|---|---|---|
| 100 | 100 | { |
| 101 | 101 | for (x = 0; x < 40; x++) |
| 102 | 102 | { |
| 103 | offset = messram_get_size(devtag_get_device(machine, "messram")) - 0x8000 + text_map[y] + x + (apple3_flags & VAR_VM2 ? 0x0400 : 0x0000); | |
| 104 | ch = messram_get_ptr(devtag_get_device(machine, "messram"))[offset]; | |
| 103 | offset = messram_get_size(machine->device("messram")) - 0x8000 + text_map[y] + x + (apple3_flags & VAR_VM2 ? 0x0400 : 0x0000); | |
| 104 | ch = messram_get_ptr(machine->device("messram"))[offset]; | |
| 105 | 105 | |
| 106 | 106 | if (apple3_flags & VAR_VM0) |
| 107 | 107 | { |
| 108 | 108 | /* color text */ |
| 109 | offset = messram_get_size(devtag_get_device(machine, "messram")) - 0x8000 + text_map[y] + x + (apple3_flags & VAR_VM2 ? 0x0000 : 0x0400); | |
| 110 | bg = (messram_get_ptr(devtag_get_device(machine, "messram"))[offset] >> 0) & 0x0F; | |
| 111 | fg = (messram_get_ptr(devtag_get_device(machine, "messram"))[offset] >> 4) & 0x0F; | |
| 109 | offset = messram_get_size(machine->device("messram")) - 0x8000 + text_map[y] + x + (apple3_flags & VAR_VM2 ? 0x0000 : 0x0400); | |
| 110 | bg = (messram_get_ptr(machine->device("messram"))[offset] >> 0) & 0x0F; | |
| 111 | fg = (messram_get_ptr(machine->device("messram"))[offset] >> 4) & 0x0F; | |
| 112 | 112 | } |
| 113 | 113 | else |
| 114 | 114 | { |
| r8453 | r8454 | |
| 155 | 155 | { |
| 156 | 156 | for (x = 0; x < 40; x++) |
| 157 | 157 | { |
| 158 | offset = messram_get_size( | |
| 158 | offset = messram_get_size(m | |
| 159 | 159 | |
| 160 | 160 | /* first character */ |
| 161 | ch = messram_get_ptr( | |
| 161 | ch = messram_get_ptr(m | |
| 162 | 162 | char_data = &char_mem[(ch & 0x7F) * 8]; |
| 163 | 163 | fg = (ch & 0x80) ? GREEN : BLACK; |
| 164 | 164 | bg = (ch & 0x80) ? BLACK : GREEN; |
| r8453 | r8454 | |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /* second character */ |
| 176 | ch = messram_get_ptr( | |
| 176 | ch = messram_get_ptr(m | |
| 177 | 177 | char_data = &char_mem[(ch & 0x7F) * 8]; |
| 178 | 178 | fg = (ch & 0x80) ? GREEN : BLACK; |
| 179 | 179 | bg = (ch & 0x80) ? BLACK : GREEN; |
| r8453 | r8454 | |
| 203 | 203 | for (y = 0; y < 192; y++) |
| 204 | 204 | { |
| 205 | 205 | if (apple3_flags & VAR_VM2) |
| 206 | pix_info = &messram_get_ptr( | |
| 206 | pix_info = &messram_get_ptr(m | |
| 207 | 207 | else |
| 208 | pix_info = &messram_get_ptr( | |
| 208 | pix_info = &messram_get_ptr(m | |
| 209 | 209 | ptr = BITMAP_ADDR16(bitmap, y, 0); |
| 210 | 210 | |
| 211 | 211 | for (i = 0; i < 40; i++) |
| r8453 | r8454 | |
| 248 | 248 | { |
| 249 | 249 | if (apple3_flags & VAR_VM2) |
| 250 | 250 | { |
| 251 | pix_info = &messram_get_ptr(devtag_get_device(machine, "messram"))[hgr_map[y]]; | |
| 252 | col_info = &messram_get_ptr(devtag_get_device(machine, "messram"))[hgr_map[y] - 0x2000]; | |
| 251 | pix_info = &messram_get_ptr(machine->device("messram"))[hgr_map[y]]; | |
| 252 | col_info = &messram_get_ptr(machine->device("messram"))[hgr_map[y] - 0x2000]; | |
| 253 | 253 | } |
| 254 | 254 | else |
| 255 | 255 | { |
| 256 | pix_info = &messram_get_ptr(devtag_get_device(machine, "messram"))[hgr_map[y] - 0x2000]; | |
| 257 | col_info = &messram_get_ptr(devtag_get_device(machine, "messram"))[hgr_map[y]]; | |
| 256 | pix_info = &messram_get_ptr(machine->device("messram"))[hgr_map[y] - 0x2000]; | |
| 257 | col_info = &messram_get_ptr(machine->device("messram"))[hgr_map[y]]; | |
| 258 | 258 | } |
| 259 | 259 | ptr = BITMAP_ADDR16(bitmap, y, 0); |
| 260 | 260 | |
| r8453 | r8454 | |
| 292 | 292 | { |
| 293 | 293 | if (apple3_flags & VAR_VM2) |
| 294 | 294 | { |
| 295 | pix_info1 = &messram_get_ptr(devtag_get_device(machine, "messram"))[hgr_map[y]]; | |
| 296 | pix_info2 = &messram_get_ptr(devtag_get_device(machine, "messram"))[hgr_map[y] + 0x2000]; | |
| 295 | pix_info1 = &messram_get_ptr(machine->device("messram"))[hgr_map[y]]; | |
| 296 | pix_info2 = &messram_get_ptr(machine->device("messram"))[hgr_map[y] + 0x2000]; | |
| 297 | 297 | } |
| 298 | 298 | else |
| 299 | 299 | { |
| 300 | pix_info1 = &messram_get_ptr(devtag_get_device(machine, "messram"))[hgr_map[y] - 0x2000]; | |
| 301 | pix_info2 = &messram_get_ptr(devtag_get_device(machine, "messram"))[hgr_map[y]]; | |
| 300 | pix_info1 = &messram_get_ptr(machine->device("messram"))[hgr_map[y] - 0x2000]; | |
| 301 | pix_info2 = &messram_get_ptr(machine->device("messram"))[hgr_map[y]]; | |
| 302 | 302 | } |
| 303 | 303 | ptr = BITMAP_ADDR16(bitmap, y, 0); |
| 304 | 304 | |
| r8453 | r8454 | |
| 331 | 331 | pen = BITMAP_ADDR16(bitmap, y, 0); |
| 332 | 332 | for (i = 0; i < 20; i++) |
| 333 | 333 | { |
| 334 | pix.b.l = messram_get_ptr(devtag_get_device(machine, "messram"))[hgr_map[y] - 0x2000 + (i * 2) + (apple3_flags & VAR_VM2 ? 1 : 0) + 0]; | |
| 335 | pix.b.h = messram_get_ptr(devtag_get_device(machine, "messram"))[hgr_map[y] - 0x0000 + (i * 2) + (apple3_flags & VAR_VM2 ? 1 : 0) + 0]; | |
| 336 | pix.b.h2 = messram_get_ptr(devtag_get_device(machine, "messram"))[hgr_map[y] - 0x2000 + (i * 2) + (apple3_flags & VAR_VM2 ? 1 : 0) + 1]; | |
| 337 | pix.b.h3 = messram_get_ptr(devtag_get_device(machine, "messram"))[hgr_map[y] - 0x0000 + (i * 2) + (apple3_flags & VAR_VM2 ? 1 : 0) + 1]; | |
| 334 | pix.b.l = messram_get_ptr(machine->device("messram"))[hgr_map[y] - 0x2000 + (i * 2) + (apple3_flags & VAR_VM2 ? 1 : 0) + 0]; | |
| 335 | pix.b.h = messram_get_ptr(machine->device("messram"))[hgr_map[y] - 0x0000 + (i * 2) + (apple3_flags & VAR_VM2 ? 1 : 0) + 0]; | |
| 336 | pix.b.h2 = messram_get_ptr(machine->device("messram"))[hgr_map[y] - 0x2000 + (i * 2) + (apple3_flags & VAR_VM2 ? 1 : 0) + 1]; | |
| 337 | pix.b.h3 = messram_get_ptr(machine->device("messram"))[hgr_map[y] - 0x0000 + (i * 2) + (apple3_flags & VAR_VM2 ? 1 : 0) + 1]; | |
| 338 | 338 | |
| 339 | 339 | pen[ 0] = pen[ 1] = pen[ 2] = pen[ 3] = ((pix.d >> 0) & 0x0F); |
| 340 | 340 | pen[ 4] = pen[ 5] = pen[ 6] = pen[ 7] = ((pix.d >> 4) & 0x07) | ((pix.d >> 1) & 0x08); |
| r8453 | r8454 | |
|---|---|---|
| 230 | 230 | |
| 231 | 231 | static TIMER_CALLBACK(setup_beep) |
| 232 | 232 | { |
| 233 | beep_set_frequency( | |
| 233 | beep_set_frequency(m | |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /* |
| r8453 | r8454 | |
| 277 | 277 | */ |
| 278 | 278 | static TIMER_CALLBACK(beep_callback) |
| 279 | 279 | { |
| 280 | beep_set_state( | |
| 280 | beep_set_state(m | |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /* |
| r8453 | r8454 | |
| 449 | 449 | |
| 450 | 450 | case 0xe: |
| 451 | 451 | /* beep enable strobe - not tested */ |
| 452 | beep_set_state( | |
| 452 | beep_set_state( | |
| 453 | 453 | |
| 454 | 454 | timer_adjust_oneshot(vdt[unit].beep_timer, ATTOTIME_IN_USEC(300), unit); |
| 455 | 455 | break; |
| r8453 | r8454 | |
|---|---|---|
| 51 | 51 | UINT16 *line; |
| 52 | 52 | int y, x, b; |
| 53 | 53 | |
| 54 | video_base = messram_get_size(devtag_get_device(screen->machine, "messram")) - (screen_buffer ? MAC_MAIN_SCREEN_BUF_OFFSET : MAC_ALT_SCREEN_BUF_OFFSET); | |
| 55 | video_ram = (const UINT16 *) (messram_get_ptr(devtag_get_device(screen->machine, "messram")) + video_base); | |
| 54 | video_base = messram_get_size(screen->machine->device("messram")) - (screen_buffer ? MAC_MAIN_SCREEN_BUF_OFFSET : MAC_ALT_SCREEN_BUF_OFFSET); | |
| 55 | video_ram = (const UINT16 *) (messram_get_ptr(screen->machine->device("messram")) + video_base); | |
| 56 | 56 | |
| 57 | 57 | for (y = 0; y < MAC_V_VIS; y++) |
| 58 | 58 | { |
| r8453 | r8454 | |
|---|---|---|
| 90 | 90 | { |
| 91 | 91 | int by; |
| 92 | 92 | /* 64 bytes per line */ |
| 93 | char *line_ptr = ((char*)messram_get_ptr( | |
| 93 | char *line_ptr = ((char*)messram_get_ptr( | |
| 94 | 94 | |
| 95 | 95 | x = 0; |
| 96 | 96 | for (by=0; by<width>>3; by++) |
| r8453 | r8454 | |
|---|---|---|
| 17 | 17 | |
| 18 | 18 | VIDEO_UPDATE( cbmb_crtc ) |
| 19 | 19 | { |
| 20 | running_device *mc6845 = | |
| 20 | running_device *mc6845 = | |
| 21 | 21 | mc6845_update(mc6845, bitmap, cliprect); |
| 22 | 22 | return 0; |
| 23 | 23 | } |
| r8453 | r8454 | |
|---|---|---|
| 14 | 14 | static void nes_vh_reset( running_machine &machine ) |
| 15 | 15 | { |
| 16 | 16 | nes_state *state = (nes_state *)machine.driver_data; |
| 17 | ppu2c0x_set_vidaccess_callback( | |
| 17 | ppu2c0x_set_vidaccess_callback(m | |
| 18 | 18 | |
| 19 | 19 | if (state->four_screen_vram) |
| 20 | 20 | set_nt_mirroring(&machine, PPU_MIRROR_4SCREEN); |
| r8453 | r8454 | |
|---|---|---|
| 121 | 121 | /* convert absolute offset into correct address to get data from */ |
| 122 | 122 | static unsigned char *z88_convert_address(running_machine *machine, unsigned long offset) |
| 123 | 123 | { |
| 124 | // return messram_get_ptr( | |
| 124 | // return messram_get_ptr(m | |
| 125 | 125 | if (offset>(32*16384)) |
| 126 | 126 | { |
| 127 | 127 | unsigned long get_offset; |
| 128 | 128 | get_offset = offset - (32*16384); |
| 129 | 129 | get_offset = get_offset & 0x01fffff; |
| 130 | return messram_get_ptr( | |
| 130 | return messram_get_ptr(m | |
| 131 | 131 | } |
| 132 | 132 | else |
| 133 | 133 | { |
| r8453 | r8454 | |
|---|---|---|
| 38 | 38 | va_start( v, s_fmt ); |
| 39 | 39 | vsprintf( buf, s_fmt, v ); |
| 40 | 40 | va_end( v ); |
| 41 | logerror( "%08x: %s", cpu_get_pc( | |
| 41 | logerror( "%08x: %s", cpu_get_pc(m | |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 |
| r8453 | r8454 | |
|---|---|---|
| 158 | 158 | ***************************************************************************/ |
| 159 | 159 | VIDEO_UPDATE( pcw16 ) |
| 160 | 160 | { |
| 161 | unsigned char *pScanLine = (unsigned char *)messram_get_ptr( | |
| 161 | unsigned char *pScanLine = (unsigned char *)messram_get_ptr( | |
| 162 | 162 | |
| 163 | 163 | int y; |
| 164 | 164 | int x; |
| r8453 | r8454 | |
| 241 | 241 | { |
| 242 | 242 | int byte; |
| 243 | 243 | |
| 244 | byte = messram_get_ptr( | |
| 244 | byte = messram_get_ptr( | |
| 245 | 245 | |
| 246 | 246 | switch (mode) |
| 247 | 247 | { |
| r8453 | r8454 | |
|---|---|---|
| 133 | 133 | /* fetch a byte from "video ram" at Addr specified */ |
| 134 | 134 | static char Nick_FetchByte(running_machine *machine,unsigned long Addr) |
| 135 | 135 | { |
| 136 | return messram_get_ptr( | |
| 136 | return messram_get_ptr(m | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | // MESS specific |
| r8453 | r8454 | |
|---|---|---|
| 134 | 134 | |
| 135 | 135 | /* find devices */ |
| 136 | 136 | |
| 137 | state->cdp1869 = | |
| 137 | state->cdp1869 = m | |
| 138 | 138 | |
| 139 | 139 | /* find memory regions */ |
| 140 | 140 |
| r8453 | r8454 | |
|---|---|---|
| 95 | 95 | |
| 96 | 96 | VIDEO_UPDATE( radio86 ) |
| 97 | 97 | { |
| 98 | running_device *devconf = | |
| 98 | running_device *devconf = | |
| 99 | 99 | i8275_update( devconf, bitmap, cliprect); |
| 100 | 100 | VIDEO_UPDATE_CALL ( generic_bitmapped ); |
| 101 | 101 | return 0; |
| r8453 | r8454 | |
|---|---|---|
| 188 | 188 | abc800_state *state = (abc800_state *)machine->driver_data; |
| 189 | 189 | |
| 190 | 190 | /* find devices */ |
| 191 | state->mc6845 = | |
| 191 | state->mc6845 = m | |
| 192 | 192 | |
| 193 | 193 | /* find memory regions */ |
| 194 | 194 | state->char_rom = memory_region(machine, "chargen"); |
| r8453 | r8454 | |
|---|---|---|
| 28 | 28 | for (y = 0; y < 256; y++) |
| 29 | 29 | { |
| 30 | 30 | if (state->b2m_video_page==0) { |
| 31 | code1 = messram_get_ptr(devtag_get_device(screen->machine, "messram"))[0x11000 + x*256 + ((y + state->b2m_video_scroll) & 0xff)]; | |
| 32 | code2 = messram_get_ptr(devtag_get_device(screen->machine, "messram"))[0x15000 + x*256 + ((y + state->b2m_video_scroll) & 0xff)]; | |
| 31 | code1 = messram_get_ptr(screen->machine->device("messram"))[0x11000 + x*256 + ((y + state->b2m_video_scroll) & 0xff)]; | |
| 32 | code2 = messram_get_ptr(screen->machine->device("messram"))[0x15000 + x*256 + ((y + state->b2m_video_scroll) & 0xff)]; | |
| 33 | 33 | } else { |
| 34 | code1 = messram_get_ptr(devtag_get_device(screen->machine, "messram"))[0x19000 + x*256 + ((y + state->b2m_video_scroll) & 0xff)]; | |
| 35 | code2 = messram_get_ptr(devtag_get_device(screen->machine, "messram"))[0x1d000 + x*256 + ((y + state->b2m_video_scroll) & 0xff)]; | |
| 34 | code1 = messram_get_ptr(screen->machine->device("messram"))[0x19000 + x*256 + ((y + state->b2m_video_scroll) & 0xff)]; | |
| 35 | code2 = messram_get_ptr(screen->machine->device("messram"))[0x1d000 + x*256 + ((y + state->b2m_video_scroll) & 0xff)]; | |
| 36 | 36 | } |
| 37 | 37 | for (b = 7; b >= 0; b--) |
| 38 | 38 | { |
| r8453 | r8454 | |
|---|---|---|
| 98 | 98 | { |
| 99 | 99 | if (vectrex_lightpen_port & 1) |
| 100 | 100 | { |
| 101 | running_device *via_0 = | |
| 101 | running_device *via_0 = m | |
| 102 | 102 | via_ca1_w(via_0, 1); |
| 103 | 103 | via_ca1_w(via_0, 0); |
| 104 | 104 | } |
| r8453 | r8454 | |
| 131 | 131 | |
| 132 | 132 | READ8_HANDLER(vectrex_via_r) |
| 133 | 133 | { |
| 134 | running_device *via = | |
| 134 | running_device *via = | |
| 135 | 135 | return via_r(via, offset); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | WRITE8_HANDLER(vectrex_via_w) |
| 139 | 139 | { |
| 140 | running_device *via = | |
| 140 | running_device *via = | |
| 141 | 141 | attotime period; |
| 142 | 142 | |
| 143 | 143 | switch (offset) |
| r8453 | r8454 | |
| 327 | 327 | |
| 328 | 328 | static void vectrex_multiplexer(running_machine *machine, int mux) |
| 329 | 329 | { |
| 330 | running_device *dac_device = | |
| 330 | running_device *dac_device = m | |
| 331 | 331 | |
| 332 | 332 | timer_set(machine, ATTOTIME_IN_NSEC(ANALOG_DELAY), &analog[mux], vectrex_via_out[PORTA], update_signal); |
| 333 | 333 | |
| r8453 | r8454 | |
| 401 | 401 | /* Sound */ |
| 402 | 402 | if (data & 0x10) |
| 403 | 403 | { |
| 404 | running_device *ay8912 = dev | |
| 404 | running_device *ay8912 = dev | |
| 405 | 405 | |
| 406 | 406 | if (data & 0x08) /* BC1 (do we select a reg or write it ?) */ |
| 407 | 407 | ay8910_address_w(ay8912, 0, vectrex_via_out[PORTA]); |
| r8453 | r8454 | |
|---|---|---|
| 84 | 84 | |
| 85 | 85 | static TIMER_CALLBACK(aim65_printer_timer) |
| 86 | 86 | { |
| 87 | running_device *via_0 = | |
| 87 | running_device *via_0 = m | |
| 88 | 88 | |
| 89 | 89 | via_cb1_w(via_0, printer_level); |
| 90 | 90 | via_ca1_w(via_0, !printer_level); |
| r8453 | r8454 | |
|---|---|---|
| 420 | 420 | arcadia_video.ypos=255-data+YPOS; |
| 421 | 421 | break; |
| 422 | 422 | case 0xfd: |
| 423 | arcadia_soundport_w( | |
| 423 | arcadia_soundport_w( | |
| 424 | 424 | arcadia_video.multicolor=data&0x80; |
| 425 | 425 | break; |
| 426 | 426 | case 0xfe: |
| 427 | arcadia_soundport_w( | |
| 427 | arcadia_soundport_w( | |
| 428 | 428 | arcadia_video.shift=(data>>5); |
| 429 | 429 | break; |
| 430 | 430 | case 0xf0: case 0xf2: case 0xf4: case 0xf6: |
| r8453 | r8454 | |
|---|---|---|
| 42 | 42 | UINT16 *scanline = BITMAP_ADDR16(bitmap, pmd85_scanline, 0); |
| 43 | 43 | |
| 44 | 44 | /* address of current line in PMD-85 video memory */ |
| 45 | UINT8* pmd85_video_ram_line = messram_get_ptr( | |
| 45 | UINT8* pmd85_video_ram_line = messram_get_ptr(m | |
| 46 | 46 | |
| 47 | 47 | for (x=0; x<288; x+=6) |
| 48 | 48 | { |
| r8453 | r8454 | |
|---|---|---|
| 304 | 304 | |
| 305 | 305 | TIMER_CALLBACK(x68k_crtc_vblank_irq) |
| 306 | 306 | { |
| 307 | running_device *x68k_mfp = | |
| 307 | running_device *x68k_mfp = m | |
| 308 | 308 | int val = param; |
| 309 | 309 | attotime irq_time; |
| 310 | 310 | int vblank_line; |
| r8453 | r8454 | |
| 485 | 485 | } |
| 486 | 486 | break; |
| 487 | 487 | } |
| 488 | // logerror("CRTC: [%08x] Wrote %04x to CRTC register %i\n",cpu_get_pc( | |
| 488 | // logerror("CRTC: [%08x] Wrote %04x to CRTC register %i\n",cpu_get_pc( | |
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | READ16_HANDLER( x68k_crtc_r ) |
| r8453 | r8454 | |
| 501 | 501 | |
| 502 | 502 | if(offset < 24) |
| 503 | 503 | { |
| 504 | // logerror("CRTC: [%08x] Read %04x from CRTC register %i\n",cpu_get_pc( | |
| 504 | // logerror("CRTC: [%08x] Read %04x from CRTC register %i\n",cpu_get_pc( | |
| 505 | 505 | switch(offset) |
| 506 | 506 | { |
| 507 | 507 | case 9: |
| r8453 | r8454 | |
| 1273 | 1273 | // popmessage("Graphic layer scroll - %i, %i - %i, %i - %i, %i - %i, %i", |
| 1274 | 1274 | // x68k_sys.crtc.reg[12],x68k_sys.crtc.reg[13],x68k_sys.crtc.reg[14],x68k_sys.crtc.reg[15],x68k_sys.crtc.reg[16],x68k_sys.crtc.reg[17],x68k_sys.crtc.reg[18],x68k_sys.crtc.reg[19]); |
| 1275 | 1275 | // popmessage("IOC IRQ status - %02x",x68k_sys.ioc.irqstatus); |
| 1276 | // popmessage("RAM: mouse data - %02x %02x %02x %02x",messram_get_ptr( | |
| 1276 | // popmessage("RAM: mouse data - %02x %02x %02x %02x",messram_get_ptr(m | |
| 1277 | 1277 | #endif |
| 1278 | 1278 | return 0; |
| 1279 | 1279 | } |
| r8453 | r8454 | |
|---|---|---|
| 30 | 30 | { |
| 31 | 31 | for (y = 127; y >=0; y--) |
| 32 | 32 | { |
| 33 | code1 = messram_get_ptr(devtag_get_device(screen->machine, "messram"))[0xd700 + Vaddr + 0x80]; | |
| 34 | code2 = messram_get_ptr(devtag_get_device(screen->machine, "messram"))[0xd700 + Vaddr + 0x00]; | |
| 33 | code1 = messram_get_ptr(screen->machine->device("messram"))[0xd700 + Vaddr + 0x80]; | |
| 34 | code2 = messram_get_ptr(screen->machine->device("messram"))[0xd700 + Vaddr + 0x00]; | |
| 35 | 35 | for (b = 0; b < 8; b++) |
| 36 | 36 | { |
| 37 | 37 | *BITMAP_ADDR16(bitmap, 2*y, x*8+b) = ((code1 << b) & 0x80) ? 1 : 0; |
| r8453 | r8454 | |
|---|---|---|
| 323 | 323 | |
| 324 | 324 | VIDEO_START( kaypro ) |
| 325 | 325 | { |
| 326 | mc6845 = | |
| 326 | mc6845 = m | |
| 327 | 327 | FNT = memory_region(machine, "gfx1"); |
| 328 | 328 | } |
| r8453 | r8454 | |
|---|---|---|
| 395 | 395 | |
| 396 | 396 | VIDEO_START( super80v ) |
| 397 | 397 | { |
| 398 | mc6845 = | |
| 398 | mc6845 = m | |
| 399 | 399 | FNT = memory_region(machine, "gfx1"); |
| 400 | 400 | } |
| 401 | 401 |
| r8453 | r8454 | |
|---|---|---|
| 734 | 734 | crtc_ega->hpixels_per_column = crtc_ega->intf->hpixels_per_column; |
| 735 | 735 | |
| 736 | 736 | /* get the screen device */ |
| 737 | crtc_ega->screen = downcast<screen_device *>(dev | |
| 737 | crtc_ega->screen = downcast<screen_device *>(dev | |
| 738 | 738 | assert(crtc_ega->screen != NULL); |
| 739 | 739 | |
| 740 | 740 | /* create the timers */ |
| r8453 | r8454 | |
|---|---|---|
| 292 | 292 | int i; |
| 293 | 293 | |
| 294 | 294 | /* column 1: registers, test accumulator, test buffer, toggle switch storage */ |
| 295 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_pc_offset+8, cpu_get_reg(devtag_get_device(machine, "maincpu"), TX0_PC), 16); | |
| 296 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_mar_offset+8, cpu_get_reg(devtag_get_device(machine, "maincpu"), TX0_MAR), 16); | |
| 297 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_mbr_offset+8, cpu_get_reg(devtag_get_device(machine, "maincpu"), TX0_MBR), 18); | |
| 298 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_ac_offset+8, cpu_get_reg(devtag_get_device(machine, "maincpu"), TX0_AC), 18); | |
| 299 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_lr_offset+8, cpu_get_reg(devtag_get_device(machine, "maincpu"), TX0_LR), 18); | |
| 300 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+4*8, y_panel_xr_offset+8, cpu_get_reg(devtag_get_device(machine, "maincpu"), TX0_XR), 14); | |
| 301 | tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tbr_offset+8, cpu_get_reg(devtag_get_device(machine, "maincpu"), TX0_TBR), 18); | |
| 302 | tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tac_offset+8, cpu_get_reg(devtag_get_device(machine, "maincpu"), TX0_TAC), 18); | |
| 303 | cm_sel = cpu_get_reg(devtag_get_device(machine, "maincpu"), TX0_CM_SEL); | |
| 304 | lr_sel = cpu_get_reg(devtag_get_device(machine, "maincpu"), TX0_LR_SEL); | |
| 295 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_pc_offset+8, cpu_get_reg(machine->device("maincpu"), TX0_PC), 16); | |
| 296 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_mar_offset+8, cpu_get_reg(machine->device("maincpu"), TX0_MAR), 16); | |
| 297 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_mbr_offset+8, cpu_get_reg(machine->device("maincpu"), TX0_MBR), 18); | |
| 298 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_ac_offset+8, cpu_get_reg(machine->device("maincpu"), TX0_AC), 18); | |
| 299 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_lr_offset+8, cpu_get_reg(machine->device("maincpu"), TX0_LR), 18); | |
| 300 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+4*8, y_panel_xr_offset+8, cpu_get_reg(machine->device("maincpu"), TX0_XR), 14); | |
| 301 | tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tbr_offset+8, cpu_get_reg(machine->device("maincpu"), TX0_TBR), 18); | |
| 302 | tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tac_offset+8, cpu_get_reg(machine->device("maincpu"), TX0_TAC), 18); | |
| 303 | cm_sel = cpu_get_reg(machine->device("maincpu"), TX0_CM_SEL); | |
| 304 | lr_sel = cpu_get_reg(machine->device("maincpu"), TX0_LR_SEL); | |
| 305 | 305 | for (i=0; i<16; i++) |
| 306 | 306 | { |
| 307 | 307 | tx0_draw_switch(machine, bitmap, x_panel_col1a_offset+16, y_panel_tss_offset+8+i*8, (cm_sel >> i) & 1); |
| 308 | tx0_draw_multipleswitch(machine, bitmap, x_panel_col1a_offset+24, y_panel_tss_offset+8+i*8, cpu_get_reg( | |
| 308 | tx0_draw_multipleswitch(machine, bitmap, x_panel_col1a_offset+24, y_panel_tss_offset+8+i*8, cpu_get_reg(m | |
| 309 | 309 | tx0_draw_switch(machine, bitmap, x_panel_col1a_offset+168, y_panel_tss_offset+8+i*8, (lr_sel >> i) & 1); |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | /* column 2: stop c0, stop c1, cm sel, 1-bit indicators, instr, flags */ |
| 313 | tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c0_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), TX0_STOP_CYC0)); | |
| 314 | tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c1_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), TX0_STOP_CYC1)); | |
| 315 | tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_gbl_cm_sel_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), TX0_GBL_CM_SEL)); | |
| 316 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), TX0_RUN)); | |
| 317 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle1_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), TX0_CYCLE) & 1); | |
| 318 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle2_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), TX0_CYCLE) & 2); | |
| 319 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), TX0_RIM)); | |
| 320 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), TX0_IOH)); | |
| 321 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset, cpu_get_reg(devtag_get_device(machine, "maincpu"), TX0_IOS)); | |
| 322 | tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_ir_offset+8, cpu_get_reg(devtag_get_device(machine, "maincpu"), TX0_IR), 5); | |
| 323 | tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_pf_offset+8, cpu_get_reg(devtag_get_device(machine, "maincpu"), TX0_PF), 6); | |
| 313 | tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c0_offset, cpu_get_reg(machine->device("maincpu"), TX0_STOP_CYC0)); | |
| 314 | tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c1_offset, cpu_get_reg(machine->device("maincpu"), TX0_STOP_CYC1)); | |
| 315 | tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_gbl_cm_sel_offset, cpu_get_reg(machine->device("maincpu"), TX0_GBL_CM_SEL)); | |
| 316 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset, cpu_get_reg(machine->device("maincpu"), TX0_RUN)); | |
| 317 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle1_offset, cpu_get_reg(machine->device("maincpu"), TX0_CYCLE) & 1); | |
| 318 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle2_offset, cpu_get_reg(machine->device("maincpu"), TX0_CYCLE) & 2); | |
| 319 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset, cpu_get_reg(machine->device("maincpu"), TX0_RIM)); | |
| 320 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset, cpu_get_reg(machine->device("maincpu"), TX0_IOH)); | |
| 321 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset, cpu_get_reg(machine->device("maincpu"), TX0_IOS)); | |
| 322 | tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_ir_offset+8, cpu_get_reg(machine->device("maincpu"), TX0_IR), 5); | |
| 323 | tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_pf_offset+8, cpu_get_reg(machine->device("maincpu"), TX0_PF), 6); | |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 |
| r8453 | r8454 | |
|---|---|---|
| 83 | 83 | scrx=TS2068_LEFT_BORDER; |
| 84 | 84 | scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); |
| 85 | 85 | |
| 86 | scr=messram_get_ptr( | |
| 86 | scr=messram_get_ptr(m | |
| 87 | 87 | attr=scr + 0x2000; |
| 88 | 88 | |
| 89 | 89 | for (x=0;x<32;x++) |
| r8453 | r8454 | |
| 127 | 127 | scrx=TS2068_LEFT_BORDER; |
| 128 | 128 | scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); |
| 129 | 129 | |
| 130 | scr1=messram_get_ptr( | |
| 130 | scr1=messram_get_ptr(m | |
| 131 | 131 | scr2=scr1 + 0x2000; |
| 132 | 132 | |
| 133 | 133 | for (x=0;x<32;x++) |
| r8453 | r8454 | |
| 163 | 163 | scrx=TS2068_LEFT_BORDER; |
| 164 | 164 | scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); |
| 165 | 165 | |
| 166 | scr = messram_get_ptr(devtag_get_device(machine, "messram")) + y*32 + screen*0x2000; | |
| 167 | attr = messram_get_ptr(devtag_get_device(machine, "messram")) + ((scry>>3)*32) + screen*0x2000 + 0x1800; | |
| 166 | scr = messram_get_ptr(machine->device("messram")) + y*32 + screen*0x2000; | |
| 167 | attr = messram_get_ptr(machine->device("messram")) + ((scry>>3)*32) + screen*0x2000 + 0x1800; | |
| 168 | 168 | |
| 169 | 169 | for (x=0;x<32;x++) |
| 170 | 170 | { |
| r8453 | r8454 | |
|---|---|---|
| 98 | 98 | |
| 99 | 99 | x = PCW_BORDER_WIDTH; |
| 100 | 100 | |
| 101 | roller_ram_ptr = messram_get_ptr( | |
| 101 | roller_ram_ptr = messram_get_ptr( | |
| 102 | 102 | |
| 103 | 103 | /* get line address */ |
| 104 | 104 | /* b16-14 control which bank the line is to be found in, b13-3 the address in the bank (in 16-byte units), and b2-0 the offset. Thus a roller RAM address bbbxxxxxxxxxxxyyy indicates bank bbb, address 00xxxxxxxxxxx0yyy. */ |
| 105 | 105 | line_data = ((unsigned char *)roller_ram_ptr)[0] | (((unsigned char *)roller_ram_ptr)[1]<<8); |
| 106 | 106 | |
| 107 | 107 | /* calculate address of pixel data */ |
| 108 | line_ptr = messram_get_ptr( | |
| 108 | line_ptr = messram_get_ptr( | |
| 109 | 109 | |
| 110 | 110 | for (by=0; by<90; by++) |
| 111 | 111 | { |
| r8453 | r8454 | |
|---|---|---|
| 1968 | 1968 | int width, height; |
| 1969 | 1969 | int i; |
| 1970 | 1970 | |
| 1971 | vic3->cpu = dev | |
| 1971 | vic3->cpu = dev | |
| 1972 | 1972 | |
| 1973 | 1973 | vic3->main_screen = device->machine->device<screen_device>(intf->screen); |
| 1974 | 1974 | width = vic3->main_screen->width(); |
| r8453 | r8454 | |
|---|---|---|
| 33 | 33 | { |
| 34 | 34 | // port A form 8255 also used as scroll |
| 35 | 35 | draw_y = ((255-y-vector06_keyboard_mask) & 0xff) +32; |
| 36 | code1 = messram_get_ptr(devtag_get_device(screen->machine, "messram"))[0x8000 + x*256 + y]; | |
| 37 | code2 = messram_get_ptr(devtag_get_device(screen->machine, "messram"))[0xa000 + x*256 + y]; | |
| 38 | code3 = messram_get_ptr(devtag_get_device(screen->machine, "messram"))[0xc000 + x*256 + y]; | |
| 39 | code4 = messram_get_ptr(devtag_get_device(screen->machine, "messram"))[0xe000 + x*256 + y]; | |
| 36 | code1 = messram_get_ptr(screen->machine->device("messram"))[0x8000 + x*256 + y]; | |
| 37 | code2 = messram_get_ptr(screen->machine->device("messram"))[0xa000 + x*256 + y]; | |
| 38 | code3 = messram_get_ptr(screen->machine->device("messram"))[0xc000 + x*256 + y]; | |
| 39 | code4 = messram_get_ptr(screen->machine->device("messram"))[0xe000 + x*256 + y]; | |
| 40 | 40 | for (b = 0; b < 8; b++) |
| 41 | 41 | { |
| 42 | 42 | col = ((code1 >> b) & 0x01) * 8 + ((code2 >> b) & 0x01) * 4 + ((code3 >> b) & 0x01)* 2+ ((code4 >> b) & 0x01); |
| r8453 | r8454 | |
|---|---|---|
| 26 | 26 | /* THIS IS PRETTY MUCH TOTALLY WRONG AND DOESN'T REFLECT THE MC68328'S INTERNAL FUNCTIONALITY AT ALL! */ |
| 27 | 27 | VIDEO_UPDATE( mc68328 ) |
| 28 | 28 | { |
| 29 | running_device *mc68328_device = | |
| 29 | running_device *mc68328_device = | |
| 30 | 30 | mc68328_t* mc68328 = mc68328_get_safe_token( mc68328_device ); |
| 31 | 31 | |
| 32 | const UINT16 *video_ram = (const UINT16 *)(messram_get_ptr( | |
| 32 | const UINT16 *video_ram = (const UINT16 *)(messram_get_ptr( | |
| 33 | 33 | UINT16 word; |
| 34 | 34 | UINT16 *line; |
| 35 | 35 | int y, x, b; |
| r8453 | r8454 | |
|---|---|---|
| 132 | 132 | v1050_state *state = (v1050_state *)machine->driver_data; |
| 133 | 133 | |
| 134 | 134 | /* find devices */ |
| 135 | state->mc6845 = | |
| 135 | state->mc6845 = m | |
| 136 | 136 | |
| 137 | 137 | /* allocate memory */ |
| 138 | 138 | state->attr_ram = auto_alloc_array(machine, UINT8, V1050_VIDEORAM_SIZE); |
| r8453 | r8454 | |
|---|---|---|
| 302 | 302 | zx8301->vsync = 1; |
| 303 | 303 | |
| 304 | 304 | /* get the cpu */ |
| 305 | zx8301->cpu = dev | |
| 305 | zx8301->cpu = dev | |
| 306 | 306 | |
| 307 | 307 | /* get the screen device */ |
| 308 | 308 | zx8301->screen = device->machine->device<screen_device>(intf->screen_tag); |
| r8453 | r8454 | |
|---|---|---|
| 130 | 130 | |
| 131 | 131 | static VIDEO_UPDATE( mc6845_mda ) |
| 132 | 132 | { |
| 133 | running_device *devconf = | |
| 133 | running_device *devconf = | |
| 134 | 134 | mc6845_update( devconf, bitmap, cliprect ); |
| 135 | 135 | return 0; |
| 136 | 136 | } |
| r8453 | r8454 | |
| 365 | 365 | *************************************************************************/ |
| 366 | 366 | WRITE8_HANDLER ( pc_MDA_w ) |
| 367 | 367 | { |
| 368 | running_device *devconf = | |
| 368 | running_device *devconf = | |
| 369 | 369 | switch( offset ) |
| 370 | 370 | { |
| 371 | 371 | case 0: case 2: case 4: case 6: |
| r8453 | r8454 | |
| 382 | 382 | |
| 383 | 383 | READ8_HANDLER ( pc_MDA_r ) |
| 384 | 384 | { |
| 385 | running_device *devconf = | |
| 385 | running_device *devconf = | |
| 386 | 386 | int data = 0xff; |
| 387 | 387 | switch( offset ) |
| 388 | 388 | { |
| r8453 | r8454 | |
| 524 | 524 | |
| 525 | 525 | static VIDEO_UPDATE( mc6845_hercules ) |
| 526 | 526 | { |
| 527 | running_device *devconf = | |
| 527 | running_device *devconf = | |
| 528 | 528 | mc6845_update( devconf, bitmap, cliprect ); |
| 529 | 529 | return 0; |
| 530 | 530 | } |
| r8453 | r8454 | |
| 532 | 532 | |
| 533 | 533 | static void hercules_mode_control_w(running_machine *machine, int data) |
| 534 | 534 | { |
| 535 | running_device *devconf = | |
| 535 | running_device *devconf = m | |
| 536 | 536 | |
| 537 | 537 | MDA_LOG(1,"hercules_mode_control_w",("$%02x: colums %d, gfx %d, enable %d, blink %d\n", |
| 538 | 538 | data, (data&1)?80:40, (data>>1)&1, (data>>3)&1, (data>>5)&1)); |
| r8453 | r8454 | |
| 568 | 568 | |
| 569 | 569 | static WRITE8_HANDLER ( pc_hercules_w ) |
| 570 | 570 | { |
| 571 | running_device *devconf = | |
| 571 | running_device *devconf = | |
| 572 | 572 | |
| 573 | 573 | switch( offset ) |
| 574 | 574 | { |
| r8453 | r8454 | |
| 608 | 608 | |
| 609 | 609 | static READ8_HANDLER ( pc_hercules_r ) |
| 610 | 610 | { |
| 611 | running_device *devconf = | |
| 611 | running_device *devconf = | |
| 612 | 612 | int data = 0xff; |
| 613 | 613 | |
| 614 | 614 | switch( offset ) |
| r8453 | r8454 | |
|---|---|---|
| 29 | 29 | { |
| 30 | 30 | for (y = 0; y < 256; y++) |
| 31 | 31 | { |
| 32 | code1 = messram_get_ptr(devtag_get_device(screen->machine, "messram"))[part1addr + y + x*256]; | |
| 33 | code2 = messram_get_ptr(devtag_get_device(screen->machine, "messram"))[part2addr + y + x*256]; | |
| 34 | code3 = messram_get_ptr(devtag_get_device(screen->machine, "messram"))[part1addr + y + x*256 + 0x4000]; | |
| 35 | code4 = messram_get_ptr(devtag_get_device(screen->machine, "messram"))[part2addr + y + x*256 + 0x4000]; | |
| 32 | code1 = messram_get_ptr(screen->machine->device("messram"))[part1addr + y + x*256]; | |
| 33 | code2 = messram_get_ptr(screen->machine->device("messram"))[part2addr + y + x*256]; | |
| 34 | code3 = messram_get_ptr(screen->machine->device("messram"))[part1addr + y + x*256 + 0x4000]; | |
| 35 | code4 = messram_get_ptr(screen->machine->device("messram"))[part2addr + y + x*256 + 0x4000]; | |
| 36 | 36 | if ((video_mode==14) || (video_mode==15)) { |
| 37 | 37 | code2 = orionpro_pseudo_color; |
| 38 | 38 | } |
| r8453 | r8454 | |
|---|---|---|
| 175 | 175 | |
| 176 | 176 | static VIDEO_UPDATE( mc6845_t1000 ) |
| 177 | 177 | { |
| 178 | running_device *devconf = | |
| 178 | running_device *devconf = | |
| 179 | 179 | mc6845_update( devconf, bitmap, cliprect); |
| 180 | 180 | return 0; |
| 181 | 181 | } |
| r8453 | r8454 | |
| 485 | 485 | |
| 486 | 486 | static void pc_pcjr_mode_switch( running_machine *machine ) |
| 487 | 487 | { |
| 488 | running_device *mc6845 = | |
| 488 | running_device *mc6845 = m | |
| 489 | 489 | |
| 490 | 490 | switch( pcjr.reg.data[0] & 0x1A ) |
| 491 | 491 | { |
| r8453 | r8454 | |
| 761 | 761 | dram = ((data & 0x07) << 14); |
| 762 | 762 | vram = ((data & 0x38) << (14-3)); |
| 763 | 763 | } |
| 764 | memory_set_bankptr( machine, "bank14", messram_get_ptr(devtag_get_device(machine, "messram")) + vram ); | |
| 765 | pcjr.displayram = messram_get_ptr(devtag_get_device(machine, "messram")) + dram; | |
| 764 | memory_set_bankptr( machine, "bank14", messram_get_ptr(machine->device("messram")) + vram ); | |
| 765 | pcjr.displayram = messram_get_ptr(machine->device("messram")) + dram; | |
| 766 | 766 | pc_pcjr_mode_switch(machine); |
| 767 | 767 | } |
| 768 | 768 | } |
| r8453 | r8454 | |
| 787 | 787 | switch( offset ) |
| 788 | 788 | { |
| 789 | 789 | case 0: case 2: case 4: case 6: |
| 790 | devconf = | |
| 790 | devconf = | |
| 791 | 791 | mc6845_address_w( devconf, offset, data ); |
| 792 | 792 | break; |
| 793 | 793 | case 1: case 3: case 5: case 7: |
| 794 | devconf = | |
| 794 | devconf = | |
| 795 | 795 | mc6845_register_w( devconf, offset, data ); |
| 796 | 796 | break; |
| 797 | 797 | case 8: |
| r8453 | r8454 | |
| 827 | 827 | switch( offset ) |
| 828 | 828 | { |
| 829 | 829 | case 0: case 4: |
| 830 | devconf = | |
| 830 | devconf = | |
| 831 | 831 | mc6845_address_w( devconf, offset, data ); |
| 832 | 832 | break; |
| 833 | 833 | case 1: case 5: |
| 834 | devconf = | |
| 834 | devconf = | |
| 835 | 835 | mc6845_register_w( devconf, offset, data ); |
| 836 | 836 | break; |
| 837 | 837 | case 10: |
| r8453 | r8454 | |
| 872 | 872 | break; |
| 873 | 873 | |
| 874 | 874 | case 1: case 3: case 5: case 7: |
| 875 | devconf = | |
| 875 | devconf = | |
| 876 | 876 | data = mc6845_register_r( devconf, offset ); |
| 877 | 877 | break; |
| 878 | 878 | |
| r8453 | r8454 | |
| 932 | 932 | { |
| 933 | 933 | pcjr.pc_framecnt++; |
| 934 | 934 | } |
| 935 | pic8259_ir5_w(dev | |
| 935 | pic8259_ir5_w(dev | |
| 936 | 936 | } |
| r8453 | r8454 | |
|---|---|---|
| 119 | 119 | /* get the screen device */ |
| 120 | 120 | if (config->rbo_tag) |
| 121 | 121 | { |
| 122 | dm9368->rbo_device = dev | |
| 122 | dm9368->rbo_device = dev | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /* register for state saving */ |
| r8453 | r8454 | |
|---|---|---|
| 498 | 498 | maria_palette[0][3] = data; |
| 499 | 499 | break; |
| 500 | 500 | case 0x04: |
| 501 | cpu_spinuntil_trigger( | |
| 501 | cpu_spinuntil_trigger( | |
| 502 | 502 | maria_wsync=1; |
| 503 | 503 | break; |
| 504 | 504 |
| r8453 | r8454 | |
|---|---|---|
| 566 | 566 | memcpy_dirty(&dirty, scanline_record->palette, video->palette_ram, 16); |
| 567 | 567 | |
| 568 | 568 | /* get ready to copy the video memory; get position and offsets */ |
| 569 | video_data = &messram_get_ptr( | |
| 569 | video_data = &messram_get_ptr(m | |
| 570 | 570 | video_offset = (coco3_gimereg[15] & 0x7F) * 2; |
| 571 | 571 | video_data_size = sizeof(scanline_record->data); |
| 572 | 572 | |
| r8453 | r8454 | |
| 791 | 791 | |
| 792 | 792 | static const UINT8 *get_video_ram_coco3(running_machine *machine,int scanline) |
| 793 | 793 | { |
| 794 | running_device *sam = | |
| 794 | running_device *sam = m | |
| 795 | 795 | return sam6883_videoram(sam,scanline); |
| 796 | 796 | } |
| 797 | 797 |
| r8453 | r8454 | |
|---|---|---|
| 479 | 479 | UINT8 data = 0xFF; |
| 480 | 480 | |
| 481 | 481 | if ( aga.mode == AGA_MONO ) { |
| 482 | running_device *devconf = | |
| 482 | running_device *devconf = | |
| 483 | 483 | switch( offset ) |
| 484 | 484 | { |
| 485 | 485 | case 0: case 2: case 4: case 6: |
| r8453 | r8454 | |
| 501 | 501 | static WRITE8_HANDLER ( pc_aga_mda_w ) |
| 502 | 502 | { |
| 503 | 503 | if ( aga.mode == AGA_MONO ) { |
| 504 | running_device *devconf = | |
| 504 | running_device *devconf = | |
| 505 | 505 | switch( offset ) |
| 506 | 506 | { |
| 507 | 507 | case 0: case 2: case 4: case 6: |
| r8453 | r8454 | |
| 534 | 534 | UINT8 data = 0xFF; |
| 535 | 535 | |
| 536 | 536 | if ( aga.mode == AGA_COLOR ) { |
| 537 | running_device *devconf = | |
| 537 | running_device *devconf = | |
| 538 | 538 | switch( offset ) { |
| 539 | 539 | case 0: case 2: case 4: case 6: |
| 540 | 540 | /* return last written mc6845 address value here? */ |
| r8453 | r8454 | |
| 580 | 580 | static WRITE8_HANDLER ( pc_aga_cga_w ) |
| 581 | 581 | { |
| 582 | 582 | if ( aga.mode == AGA_COLOR ) { |
| 583 | running_device *devconf = | |
| 583 | running_device *devconf = | |
| 584 | 584 | |
| 585 | 585 | switch(offset) { |
| 586 | 586 | case 0: case 2: case 4: case 6: |
| r8453 | r8454 | |
| 661 | 661 | |
| 662 | 662 | void pc_aga_set_mode(running_machine *machine, AGA_MODE mode) |
| 663 | 663 | { |
| 664 | running_device *devconf = | |
| 664 | running_device *devconf = m | |
| 665 | 665 | |
| 666 | 666 | aga.mode = mode; |
| 667 | 667 | |
| r8453 | r8454 | |
| 744 | 744 | |
| 745 | 745 | static VIDEO_UPDATE( mc6845_aga ) |
| 746 | 746 | { |
| 747 | running_device *devconf = | |
| 747 | running_device *devconf = | |
| 748 | 748 | mc6845_update( devconf, bitmap, cliprect); |
| 749 | 749 | |
| 750 | 750 | return 0; |
| r8453 | r8454 | |
|---|---|---|
| 510 | 510 | static VIDEO_UPDATE( mc6845_cga ) |
| 511 | 511 | { |
| 512 | 512 | UINT8 *gfx = memory_region(screen->machine, "gfx1"); |
| 513 | running_device *devconf = | |
| 513 | running_device *devconf = | |
| 514 | 514 | mc6845_update( devconf, bitmap, cliprect); |
| 515 | 515 | |
| 516 | 516 | /* Check for changes in font dipsetting */ |
| r8453 | r8454 | |
| 536 | 536 | static VIDEO_UPDATE( cga_poisk2 ) |
| 537 | 537 | { |
| 538 | 538 | UINT8 *gfx = memory_region(screen->machine, "gfx1"); |
| 539 | running_device *devconf = | |
| 539 | running_device *devconf = | |
| 540 | 540 | mc6845_update( devconf, bitmap, cliprect); |
| 541 | 541 | |
| 542 | 542 | /* Check for changes in font dipsetting */ |
| r8453 | r8454 | |
| 1077 | 1077 | */ |
| 1078 | 1078 | static void pc_cga_mode_control_w(running_machine *machine, int data) |
| 1079 | 1079 | { |
| 1080 | running_device *devconf = | |
| 1080 | running_device *devconf = m | |
| 1081 | 1081 | |
| 1082 | 1082 | CGA_LOG(1,"CGA_mode_control_w",("$%02x: columns %d, gfx %d, hires %d, blink %d\n", |
| 1083 | 1083 | data, (data&1)?80:40, (data>>1)&1, (data>>4)&1, (data>>5)&1)); |
| r8453 | r8454 | |
| 1237 | 1237 | |
| 1238 | 1238 | static READ8_HANDLER( pc_cga8_r ) |
| 1239 | 1239 | { |
| 1240 | running_device *devconf = | |
| 1240 | running_device *devconf = | |
| 1241 | 1241 | int data = 0xff; |
| 1242 | 1242 | switch( offset ) |
| 1243 | 1243 | { |
| r8453 | r8454 | |
| 1265 | 1265 | |
| 1266 | 1266 | switch(offset) { |
| 1267 | 1267 | case 0: case 2: case 4: case 6: |
| 1268 | devconf = | |
| 1268 | devconf = | |
| 1269 | 1269 | mc6845_address_w( devconf, offset, data ); |
| 1270 | 1270 | break; |
| 1271 | 1271 | case 1: case 3: case 5: case 7: |
| 1272 | devconf = | |
| 1272 | devconf = | |
| 1273 | 1273 | mc6845_register_w( devconf, offset, data ); |
| 1274 | 1274 | break; |
| 1275 | 1275 | case 8: |
| r8453 | r8454 | |
| 1579 | 1579 | |
| 1580 | 1580 | static WRITE8_HANDLER ( pc1512_w ) |
| 1581 | 1581 | { |
| 1582 | running_device *devconf = | |
| 1582 | running_device *devconf = | |
| 1583 | 1583 | |
| 1584 | 1584 | switch (offset) |
| 1585 | 1585 | { |
| r8453 | r8454 | |
| 1743 | 1743 | static VIDEO_UPDATE( mc6845_pc1512 ) |
| 1744 | 1744 | { |
| 1745 | 1745 | UINT8 *gfx = memory_region(screen->machine, "gfx1"); |
| 1746 | running_device *devconf = | |
| 1746 | running_device *devconf = | |
| 1747 | 1747 | mc6845_update( devconf, bitmap, cliprect); |
| 1748 | 1748 | |
| 1749 | 1749 | /* Check for changes in font dipsetting */ |
| r8453 | r8454 | |
|---|---|---|
| 670 | 670 | |
| 671 | 671 | pc_ega_install_banks(machine); |
| 672 | 672 | |
| 673 | ega.crtc_ega = | |
| 673 | ega.crtc_ega = m | |
| 674 | 674 | ega.update_row = NULL; |
| 675 | 675 | ega.misc_output = 0; |
| 676 | 676 | ega.attribute.index_write = 1; |
| r8453 | r8454 | |
|---|---|---|
| 103 | 103 | { |
| 104 | 104 | for (y = 0; y < 256; y++) |
| 105 | 105 | { |
| 106 | code = messram_get_ptr( | |
| 106 | code = messram_get_ptr( | |
| 107 | 107 | color = specimx_colorram[y + x*256]; |
| 108 | 108 | for (b = 7; b >= 0; b--) |
| 109 | 109 | { |
| r8453 | r8454 | |
| 148 | 148 | UINT8 *erik_video_ram_p1; |
| 149 | 149 | UINT8 *erik_video_ram_p2; |
| 150 | 150 | |
| 151 | erik_video_ram_p1 = messram_get_ptr(devtag_get_device(screen->machine, "messram")) + 0x9000; | |
| 152 | erik_video_ram_p2 = messram_get_ptr(devtag_get_device(screen->machine, "messram")) + 0xd000; | |
| 151 | erik_video_ram_p1 = messram_get_ptr(screen->machine->device("messram")) + 0x9000; | |
| 152 | erik_video_ram_p2 = messram_get_ptr(screen->machine->device("messram")) + 0xd000; | |
| 153 | 153 | |
| 154 | 154 | for (x = 0; x < 48; x++) |
| 155 | 155 | { |
| r8453 | r8454 | |
|---|---|---|
| 22 | 22 | ssystem3_lcd.data[ssystem3_lcd.count/8]&=~(1<<(ssystem3_lcd.count&7)); |
| 23 | 23 | if (data) ssystem3_lcd.data[ssystem3_lcd.count/8]|=1<<(ssystem3_lcd.count&7); |
| 24 | 24 | if (ssystem3_lcd.count+1==40) { |
| 25 | logerror("%.4x lcd %02x%02x%02x%02x%02x\n",(int)cpu_get_pc( | |
| 25 | logerror("%.4x lcd %02x%02x%02x%02x%02x\n",(int)cpu_get_pc(m | |
| 26 | 26 | ssystem3_lcd.data[0], ssystem3_lcd.data[1], ssystem3_lcd.data[2], ssystem3_lcd.data[3], ssystem3_lcd.data[4]); |
| 27 | 27 | } |
| 28 | 28 | ssystem3_lcd.count=(ssystem3_lcd.count+1)%40; |
| r8453 | r8454 | |
|---|---|---|
| 14 | 14 | kc85_state *state = (kc85_state *)machine->driver_data; |
| 15 | 15 | |
| 16 | 16 | /* find devices */ |
| 17 | state->hd44102[0] = devtag_get_device(machine, "m1"); | |
| 18 | state->hd44102[1] = devtag_get_device(machine, "m2"); | |
| 19 | state->hd44102[2] = devtag_get_device(machine, "m3"); | |
| 20 | state->hd44102[3] = devtag_get_device(machine, "m4"); | |
| 21 | state->hd44102[4] = devtag_get_device(machine, "m5"); | |
| 22 | state->hd44102[5] = devtag_get_device(machine, "m6"); | |
| 23 | state->hd44102[6] = devtag_get_device(machine, "m7"); | |
| 24 | state->hd44102[7] = devtag_get_device(machine, "m8"); | |
| 25 | state->hd44102[8] = devtag_get_device(machine, "m9"); | |
| 26 | state->hd44102[9] = devtag_get_device(machine, "m10"); | |
| 17 | state->hd44102[0] = machine->device("m1"); | |
| 18 | state->hd44102[1] = machine->device("m2"); | |
| 19 | state->hd44102[2] = machine->device("m3"); | |
| 20 | state->hd44102[3] = machine->device("m4"); | |
| 21 | state->hd44102[4] = machine->device("m5"); | |
| 22 | state->hd44102[5] = machine->device("m6"); | |
| 23 | state->hd44102[6] = machine->device("m7"); | |
| 24 | state->hd44102[7] = machine->device("m8"); | |
| 25 | state->hd44102[8] = machine->device("m9"); | |
| 26 | state->hd44102[9] = machine->device("m10"); | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | static VIDEO_UPDATE( kc85 ) |
| r8453 | r8454 | |
| 44 | 44 | tandy200_state *state = (tandy200_state *)machine->driver_data; |
| 45 | 45 | |
| 46 | 46 | /* find devices */ |
| 47 | state->hd61830 = | |
| 47 | state->hd61830 = m | |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | static VIDEO_UPDATE( tandy200 ) |
| r8453 | r8454 | |
|---|---|---|
| 2528 | 2528 | int width, height; |
| 2529 | 2529 | int i; |
| 2530 | 2530 | |
| 2531 | vic2->cpu = dev | |
| 2531 | vic2->cpu = dev | |
| 2532 | 2532 | |
| 2533 | 2533 | vic2->screen = device->machine->device<screen_device>(intf->screen); |
| 2534 | 2534 | width = vic2->screen->width(); |
| r8453 | r8454 | |
|---|---|---|
| 119 | 119 | |
| 120 | 120 | static VIDEO_UPDATE( comx35 ) |
| 121 | 121 | { |
| 122 | screen_device *screen_40 = downcast<screen_device *>( | |
| 122 | screen_device *screen_40 = downcast<screen_device *>( | |
| 123 | 123 | |
| 124 | 124 | if (screen == screen_40) |
| 125 | 125 | { |
| 126 | running_device *cdp1869 = | |
| 126 | running_device *cdp1869 = | |
| 127 | 127 | |
| 128 | 128 | cdp1869_update(cdp1869, bitmap, cliprect); |
| 129 | 129 | } |
| 130 | 130 | else |
| 131 | 131 | { |
| 132 | running_device *mc6845 = | |
| 132 | running_device *mc6845 = | |
| 133 | 133 | |
| 134 | 134 | mc6845_update(mc6845, bitmap, cliprect); |
| 135 | 135 | } |
| r8453 | r8454 | |
|---|---|---|
| 217 | 217 | |
| 218 | 218 | /* find devices */ |
| 219 | 219 | |
| 220 | state->mc6845 = | |
| 220 | state->mc6845 = m | |
| 221 | 221 | |
| 222 | 222 | /* find memory regions */ |
| 223 | 223 |
| r8453 | r8454 | |
|---|---|---|
| 25 | 25 | { |
| 26 | 26 | for (x = 0; x < 32; x++) |
| 27 | 27 | { |
| 28 | code_r = messram_get_ptr(devtag_get_device(screen->machine, "messram"))[0x6000 + ((y+pp01_video_scroll)&0xff)*32 + x]; | |
| 29 | code_g = messram_get_ptr(devtag_get_device(screen->machine, "messram"))[0xa000 + ((y+pp01_video_scroll)&0xff)*32 + x]; | |
| 30 | code_b = messram_get_ptr(devtag_get_device(screen->machine, "messram"))[0xe000 + ((y+pp01_video_scroll)&0xff)*32 + x]; | |
| 28 | code_r = messram_get_ptr(screen->machine->device("messram"))[0x6000 + ((y+pp01_video_scroll)&0xff)*32 + x]; | |
| 29 | code_g = messram_get_ptr(screen->machine->device("messram"))[0xa000 + ((y+pp01_video_scroll)&0xff)*32 + x]; | |
| 30 | code_b = messram_get_ptr(screen->machine->device("messram"))[0xe000 + ((y+pp01_video_scroll)&0xff)*32 + x]; | |
| 31 | 31 | for (b = 0; b < 8; b++) |
| 32 | 32 | { |
| 33 | 33 | col = (((code_r >> b) & 0x01) ? 4 : 0) + (((code_g >> b) & 0x01) ? 2 : 0) + (((code_b >> b) & 0x01) ? 1 : 0); |
| r8453 | r8454 | |
|---|---|---|
| 442 | 442 | |
| 443 | 443 | /* find devices */ |
| 444 | 444 | |
| 445 | state->mc6845 = | |
| 445 | state->mc6845 = m | |
| 446 | 446 | |
| 447 | 447 | /* find memory regions */ |
| 448 | 448 |
| r8453 | r8454 | |
|---|---|---|
| 451 | 451 | |
| 452 | 452 | VIDEO_START( apple2 ) |
| 453 | 453 | { |
| 454 | apple2_video_start(machine, messram_get_ptr( | |
| 454 | apple2_video_start(machine, messram_get_ptr(m | |
| 455 | 455 | |
| 456 | 456 | /* hack to fix the colors on apple2/apple2p */ |
| 457 | 457 | fgcolor = 0; |
| r8453 | r8454 | |
| 461 | 461 | |
| 462 | 462 | VIDEO_START( apple2p ) |
| 463 | 463 | { |
| 464 | apple2_video_start(machine, messram_get_ptr( | |
| 464 | apple2_video_start(machine, messram_get_ptr(m | |
| 465 | 465 | |
| 466 | 466 | /* hack to fix the colors on apple2/apple2p */ |
| 467 | 467 | fgcolor = 0; |
| r8453 | r8454 | |
| 471 | 471 | |
| 472 | 472 | VIDEO_START( apple2e ) |
| 473 | 473 | { |
| 474 | apple2_video_start(machine, messram_get_ptr( | |
| 474 | apple2_video_start(machine, messram_get_ptr(m | |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 |
| r8453 | r8454 | |
|---|---|---|
| 106 | 106 | |
| 107 | 107 | /* find devices */ |
| 108 | 108 | |
| 109 | state->cdp1869 = | |
| 109 | state->cdp1869 = m | |
| 110 | 110 | |
| 111 | 111 | /* register for state saving */ |
| 112 | 112 | state_save_register_global(machine, state->cdp1802_mode); |
| r8453 | r8454 | |
|---|---|---|
| 182 | 182 | case 0xcc: /* left joystick */ |
| 183 | 183 | if (input_port_read(space->machine, "CONFIG")&1) |
| 184 | 184 | { /* paddle */ |
| 185 | if (!cpu_get_reg( | |
| 185 | if (!cpu_get_reg( | |
| 186 | 186 | { |
| 187 | 187 | data = input_port_read(space->machine, "JOYS") & 0x03; |
| 188 | 188 | switch (data) |
| r8453 | r8454 | |
| 221 | 221 | } |
| 222 | 222 | else |
| 223 | 223 | { /* buttons */ |
| 224 | if (!cpu_get_reg( | |
| 224 | if (!cpu_get_reg( | |
| 225 | 225 | { |
| 226 | 226 | data = input_port_read(space->machine, "JOYS") & 0x03; |
| 227 | 227 | switch (data) |
| r8453 | r8454 | |
| 259 | 259 | case 0xcd: /* right joystick */ |
| 260 | 260 | if (input_port_read(space->machine, "CONFIG")&1) |
| 261 | 261 | { |
| 262 | if (!cpu_get_reg( | |
| 262 | if (!cpu_get_reg( | |
| 263 | 263 | { |
| 264 | 264 | data = input_port_read(space->machine, "JOYS") & 0x30; |
| 265 | 265 | switch (data) |
| r8453 | r8454 | |
| 298 | 298 | } |
| 299 | 299 | else |
| 300 | 300 | { |
| 301 | if (!cpu_get_reg( | |
| 301 | if (!cpu_get_reg( | |
| 302 | 302 | { |
| 303 | 303 | data = input_port_read(space->machine, "JOYS") & 0x30; |
| 304 | 304 | switch (data) |
| r8453 | r8454 | |
| 375 | 375 | |
| 376 | 376 | case 0xc7: // Soundregister |
| 377 | 377 | vc4000_video.reg.data[offset] = data; |
| 378 | vc4000_soundport_w( | |
| 378 | vc4000_soundport_w( | |
| 379 | 379 | break; |
| 380 | 380 | |
| 381 | 381 | case 0xc8: // Digits 1 and 2 |
| r8453 | r8454 | |
|---|---|---|
| 23 | 23 | { |
| 24 | 24 | for (x = 0; x < 64; x++) |
| 25 | 25 | { |
| 26 | UINT8 chr = messram_get_ptr(devtag_get_device(screen->machine, "messram"))[x +(y*64) + 0x40000]; | |
| 27 | UINT8 attr= messram_get_ptr(devtag_get_device(screen->machine, "messram"))[x +(y*64) + 0x40400]; | |
| 26 | UINT8 chr = messram_get_ptr(screen->machine->device("messram"))[x +(y*64) + 0x40000]; | |
| 27 | UINT8 attr= messram_get_ptr(screen->machine->device("messram"))[x +(y*64) + 0x40400]; | |
| 28 | 28 | for (j = 0; j < 16; j++) { |
| 29 | 29 | UINT32 addr = 0x10000 + x + ((y*16+j)*64) + (pk8020_video_page * 0xC000); |
| 30 | UINT8 code1 = messram_get_ptr(devtag_get_device(screen->machine, "messram"))[addr]; | |
| 31 | UINT8 code2 = messram_get_ptr(devtag_get_device(screen->machine, "messram"))[addr + 0x4000]; | |
| 32 | UINT8 code3 = messram_get_ptr(devtag_get_device(screen->machine, "messram"))[addr + 0x8000]; | |
| 30 | UINT8 code1 = messram_get_ptr(screen->machine->device("messram"))[addr]; | |
| 31 | UINT8 code2 = messram_get_ptr(screen->machine->device("messram"))[addr + 0x4000]; | |
| 32 | UINT8 code3 = messram_get_ptr(screen->machine->device("messram"))[addr + 0x8000]; | |
| 33 | 33 | UINT8 code4 = gfx[((chr<<4) + j) + (pk8020_font*0x1000)]; |
| 34 | 34 | if(attr) code4 ^= 0xff; |
| 35 | 35 | for (b = 0; b < 8; b++) |
| r8453 | r8454 | |
|---|---|---|
| 29 | 29 | if ((gal_cnt >= 48 * 2) && (gal_cnt < 48 * 210)) // display on screen just first 208 lines |
| 30 | 30 | { |
| 31 | 31 | UINT8 mode = (galaxy_latch_value >> 1) & 1; // bit 2 latch represents mode |
| 32 | UINT16 addr = (cpu_get_reg( | |
| 32 | UINT16 addr = (cpu_get_reg(m | |
| 33 | 33 | if (mode == 0) |
| 34 | 34 | { |
| 35 | 35 | // Text mode |
| 36 | if (first == 0 && (cpu_get_reg( | |
| 36 | if (first == 0 && (cpu_get_reg(m | |
| 37 | 37 | { |
| 38 | 38 | // Due to a fact that on real processor latch value is set at |
| 39 | 39 | // the end of last cycle we need to skip dusplay of double |
| r8453 | r8454 | |
| 62 | 62 | } |
| 63 | 63 | else |
| 64 | 64 | { // Graphics mode |
| 65 | if (first < 4 && (cpu_get_reg( | |
| 65 | if (first < 4 && (cpu_get_reg(m | |
| 66 | 66 | { |
| 67 | 67 | // Due to a fact that on real processor latch value is set at |
| 68 | 68 | // the end of last cycle we need to skip dusplay of 4 times |
| r8453 | r8454 | |
|---|---|---|
| 23 | 23 | va_start( v, s_fmt ); |
| 24 | 24 | vsprintf( buf, s_fmt, v ); |
| 25 | 25 | va_end( v ); |
| 26 | logerror( "%08x: %s", cpu_get_pc( | |
| 26 | logerror( "%08x: %s", cpu_get_pc(m | |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 |
| r8453 | r8454 | |
|---|---|---|
| 715 | 715 | { |
| 716 | 716 | #if 0 |
| 717 | 717 | /* colour ram takes up 0x02800 bytes */ |
| 718 | unsigned char *pixel_ram = messram_get_ptr( | |
| 718 | unsigned char *pixel_ram = messram_get_ptr(m | |
| 719 | 719 | unsigned char *colour_ram = pixel_ram + 0x02800; |
| 720 | 720 | |
| 721 | 721 | int x,y; |
| r8453 | r8454 | |
| 756 | 756 | |
| 757 | 757 | struct grab_info grab_data; |
| 758 | 758 | |
| 759 | grab_data.pixel_ram = messram_get_ptr(devtag_get_device(screen->machine, "messram"))+0x08000; | |
| 760 | grab_data.colour_ram = messram_get_ptr(devtag_get_device(screen->machine, "messram"))+0x08000 + 0x02800; | |
| 759 | grab_data.pixel_ram = messram_get_ptr(screen->machine->device("messram"))+0x08000; | |
| 760 | grab_data.colour_ram = messram_get_ptr(screen->machine->device("messram"))+0x08000 + 0x02800; | |
| 761 | 761 | |
| 762 | 762 | kc85_common_process_frame(screen->machine, bitmap, kc85_3_pixel_grab_callback,&grab_data); |
| 763 | 763 |
| r8453 | r8454 | |
|---|---|---|
| 206 | 206 | logerror("microtan_snapshot_copy: PC:%02X%02X P:%02X A:%02X X:%02X Y:%02X SP:1%02X", |
| 207 | 207 | snapshot_buff[base+1], snapshot_buff[base+0], snapshot_buff[base+2], snapshot_buff[base+3], |
| 208 | 208 | snapshot_buff[base+4], snapshot_buff[base+5], snapshot_buff[base+6]); |
| 209 | cpu_set_reg(devtag_get_device(machine, "maincpu"), M6502_PC, snapshot_buff[base+0] + 256 * snapshot_buff[base+1]); | |
| 210 | cpu_set_reg(devtag_get_device(machine, "maincpu"), M6502_P, snapshot_buff[base+2]); | |
| 211 | cpu_set_reg(devtag_get_device(machine, "maincpu"), M6502_A, snapshot_buff[base+3]); | |
| 212 | cpu_set_reg(devtag_get_device(machine, "maincpu"), M6502_X, snapshot_buff[base+4]); | |
| 213 | cpu_set_reg(devtag_get_device(machine, "maincpu"), M6502_Y, snapshot_buff[base+5]); | |
| 214 | cpu_set_reg(devtag_get_device(machine, "maincpu"), M6502_S, snapshot_buff[base+6]); | |
| 209 | cpu_set_reg(machine->device("maincpu"), M6502_PC, snapshot_buff[base+0] + 256 * snapshot_buff[base+1]); | |
| 210 | cpu_set_reg(machine->device("maincpu"), M6502_P, snapshot_buff[base+2]); | |
| 211 | cpu_set_reg(machine->device("maincpu"), M6502_A, snapshot_buff[base+3]); | |
| 212 | cpu_set_reg(machine->device("maincpu"), M6502_X, snapshot_buff[base+4]); | |
| 213 | cpu_set_reg(machine->device("maincpu"), M6502_Y, snapshot_buff[base+5]); | |
| 214 | cpu_set_reg(machine->device("maincpu"), M6502_S, snapshot_buff[base+6]); | |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | static void microtan_snapshot_copy(running_machine *machine, UINT8 *snapshot_buff, int snapshot_size) |
| 218 | 218 | { |
| 219 | 219 | UINT8 *RAM = memory_region(machine, "maincpu"); |
| 220 | 220 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 221 | running_device *via_0 = devtag_get_device(machine, "via6522_0"); | |
| 222 | running_device *via_1 = devtag_get_device(machine, "via6522_1"); | |
| 223 | running_device *ay8910 = devtag_get_device(machine, "ay8910.1"); | |
| 221 | running_device *via_0 = machine->device("via6522_0"); | |
| 222 | running_device *via_1 = machine->device("via6522_1"); | |
| 223 | running_device *ay8910 = machine->device("ay8910.1"); | |
| 224 | 224 | |
| 225 | 225 | /* check for .DMP file format */ |
| 226 | 226 | if (snapshot_size == 8263) |
| r8453 | r8454 | |
|---|---|---|
| 277 | 277 | UINT8 intr; |
| 278 | 278 | UINT16 start, size, data, status; |
| 279 | 279 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 280 | running_device *cpu = | |
| 280 | running_device *cpu = m | |
| 281 | 281 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 282 | 282 | |
| 283 | 283 | if (snapsize == SP_NEW_SIZE_16K || snapsize == SP_NEW_SIZE_48K) |
| r8453 | r8454 | |
| 479 | 479 | UINT8 intr; |
| 480 | 480 | UINT16 data, addr; |
| 481 | 481 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 482 | running_device *cpu = | |
| 482 | running_device *cpu = m | |
| 483 | 483 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 484 | 484 | |
| 485 | 485 | if ((snapsize != SNA48_SIZE) && (state->port_7ffd_data == -1)) |
| r8453 | r8454 | |
| 702 | 702 | UINT8 intr; |
| 703 | 703 | UINT16 data; |
| 704 | 704 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 705 | running_device *cpu = | |
| 705 | running_device *cpu = m | |
| 706 | 706 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 707 | 707 | |
| 708 | 708 | data = (snapdata[ACH_OFFSET + 0] << 8) | snapdata[ACH_OFFSET + 4]; |
| r8453 | r8454 | |
| 837 | 837 | UINT8 intr; |
| 838 | 838 | UINT16 addr, data; |
| 839 | 839 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 840 | running_device *cpu = | |
| 840 | running_device *cpu = m | |
| 841 | 841 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 842 | 842 | |
| 843 | 843 | data = snapdata[PRG_OFFSET + 0]; |
| r8453 | r8454 | |
| 1009 | 1009 | UINT8 intr; |
| 1010 | 1010 | UINT16 addr = 0, data; |
| 1011 | 1011 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 1012 | running_device *cpu = | |
| 1012 | running_device *cpu = m | |
| 1013 | 1013 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 1014 | 1014 | |
| 1015 | 1015 | data = (snapdata[PLUSD_OFFSET + 15] << 8) | snapdata[PLUSD_OFFSET + 14]; |
| r8453 | r8454 | |
| 1179 | 1179 | UINT8 intr; |
| 1180 | 1180 | UINT16 data; |
| 1181 | 1181 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 1182 | running_device *cpu = | |
| 1182 | running_device *cpu = m | |
| 1183 | 1183 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 1184 | 1184 | |
| 1185 | 1185 | data = (snapdata[SEM_OFFSET + 1] << 8) | snapdata[SEM_OFFSET + 0]; |
| r8453 | r8454 | |
| 1300 | 1300 | UINT8 intr; |
| 1301 | 1301 | UINT16 data; |
| 1302 | 1302 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 1303 | running_device *cpu = | |
| 1303 | running_device *cpu = m | |
| 1304 | 1304 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 1305 | 1305 | |
| 1306 | 1306 | data = (snapdata[SIT_OFFSET + 7] << 8) | snapdata[SIT_OFFSET + 6]; |
| r8453 | r8454 | |
| 1432 | 1432 | UINT8 intr; |
| 1433 | 1433 | UINT16 data, mode; |
| 1434 | 1434 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 1435 | running_device *cpu = | |
| 1435 | running_device *cpu = m | |
| 1436 | 1436 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 1437 | 1437 | |
| 1438 | 1438 | logerror("Skipping last 132 bytes of the 16K ROM dump at offset:0000\n"); |
| r8453 | r8454 | |
| 1566 | 1566 | UINT8 intr; |
| 1567 | 1567 | UINT16 data; |
| 1568 | 1568 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 1569 | running_device *cpu = | |
| 1569 | running_device *cpu = m | |
| 1570 | 1570 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 1571 | 1571 | |
| 1572 | 1572 | data = (snapdata[SNP_OFFSET + 1] << 8) | snapdata[SNP_OFFSET + 0]; |
| r8453 | r8454 | |
| 1795 | 1795 | UINT8 intr; |
| 1796 | 1796 | UINT16 data, addr; |
| 1797 | 1797 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 1798 | running_device *cpu = | |
| 1798 | running_device *cpu = m | |
| 1799 | 1799 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 1800 | 1800 | |
| 1801 | 1801 | data = (snapdata[SNX_OFFSET + 4] << 8) | snapdata[SNX_OFFSET + 5]; |
| r8453 | r8454 | |
| 1951 | 1951 | UINT8 intr; |
| 1952 | 1952 | UINT16 addr, data; |
| 1953 | 1953 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 1954 | running_device *cpu = | |
| 1954 | running_device *cpu = m | |
| 1955 | 1955 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 1956 | 1956 | |
| 1957 | 1957 | if (state->port_7ffd_data == -1) |
| r8453 | r8454 | |
| 2217 | 2217 | /* AF */ |
| 2218 | 2218 | hi = snapdata[0] & 0x0ff; |
| 2219 | 2219 | lo = snapdata[1] & 0x0ff; |
| 2220 | cpu_set_reg( | |
| 2220 | cpu_set_reg(m | |
| 2221 | 2221 | /* BC */ |
| 2222 | 2222 | lo = snapdata[2] & 0x0ff; |
| 2223 | 2223 | hi = snapdata[3] & 0x0ff; |
| 2224 | cpu_set_reg( | |
| 2224 | cpu_set_reg(m | |
| 2225 | 2225 | /* HL */ |
| 2226 | 2226 | lo = snapdata[4] & 0x0ff; |
| 2227 | 2227 | hi = snapdata[5] & 0x0ff; |
| 2228 | cpu_set_reg( | |
| 2228 | cpu_set_reg(m | |
| 2229 | 2229 | |
| 2230 | 2230 | /* SP */ |
| 2231 | 2231 | lo = snapdata[8] & 0x0ff; |
| 2232 | 2232 | hi = snapdata[9] & 0x0ff; |
| 2233 | cpu_set_reg( | |
| 2233 | cpu_set_reg(m | |
| 2234 | 2234 | |
| 2235 | 2235 | /* I */ |
| 2236 | cpu_set_reg( | |
| 2236 | cpu_set_reg(m | |
| 2237 | 2237 | |
| 2238 | 2238 | /* R */ |
| 2239 | 2239 | data = (snapdata[11] & 0x07f) | ((snapdata[12] & 0x01) << 7); |
| 2240 | cpu_set_reg( | |
| 2240 | cpu_set_reg(m | |
| 2241 | 2241 | |
| 2242 | 2242 | /* Set border color */ |
| 2243 | 2243 | state->port_fe_data = (state->port_fe_data & 0xf8) | ((snapdata[12] & 0x0e) >> 1); |
| r8453 | r8454 | |
| 2247 | 2247 | |
| 2248 | 2248 | lo = snapdata[13] & 0x0ff; |
| 2249 | 2249 | hi = snapdata[14] & 0x0ff; |
| 2250 | cpu_set_reg( | |
| 2250 | cpu_set_reg(m | |
| 2251 | 2251 | |
| 2252 | 2252 | lo = snapdata[15] & 0x0ff; |
| 2253 | 2253 | hi = snapdata[16] & 0x0ff; |
| 2254 | cpu_set_reg( | |
| 2254 | cpu_set_reg(m | |
| 2255 | 2255 | |
| 2256 | 2256 | lo = snapdata[17] & 0x0ff; |
| 2257 | 2257 | hi = snapdata[18] & 0x0ff; |
| 2258 | cpu_set_reg( | |
| 2258 | cpu_set_reg(m | |
| 2259 | 2259 | |
| 2260 | 2260 | lo = snapdata[19] & 0x0ff; |
| 2261 | 2261 | hi = snapdata[20] & 0x0ff; |
| 2262 | cpu_set_reg( | |
| 2262 | cpu_set_reg(m | |
| 2263 | 2263 | |
| 2264 | 2264 | hi = snapdata[21] & 0x0ff; |
| 2265 | 2265 | lo = snapdata[22] & 0x0ff; |
| 2266 | cpu_set_reg( | |
| 2266 | cpu_set_reg(m | |
| 2267 | 2267 | |
| 2268 | 2268 | lo = snapdata[23] & 0x0ff; |
| 2269 | 2269 | hi = snapdata[24] & 0x0ff; |
| 2270 | cpu_set_reg( | |
| 2270 | cpu_set_reg(m | |
| 2271 | 2271 | |
| 2272 | 2272 | lo = snapdata[25] & 0x0ff; |
| 2273 | 2273 | hi = snapdata[26] & 0x0ff; |
| 2274 | cpu_set_reg( | |
| 2274 | cpu_set_reg(m | |
| 2275 | 2275 | |
| 2276 | 2276 | /* Interrupt Flip/Flop */ |
| 2277 | 2277 | if (snapdata[27] == 0) |
| 2278 | 2278 | { |
| 2279 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_IFF1, (UINT64)0); | |
| 2280 | /* cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_IRQ_STATE, 0); */ | |
| 2279 | cpu_set_reg(machine->device("maincpu"), Z80_IFF1, (UINT64)0); | |
| 2280 | /* cpu_set_reg(machine->device("maincpu"), Z80_IRQ_STATE, 0); */ | |
| 2281 | 2281 | } |
| 2282 | 2282 | else |
| 2283 | 2283 | { |
| 2284 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_IFF1, 1); | |
| 2285 | /* cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_IRQ_STATE, 1); */ | |
| 2284 | cpu_set_reg(machine->device("maincpu"), Z80_IFF1, 1); | |
| 2285 | /* cpu_set_reg(machine->device("maincpu"), Z80_IRQ_STATE, 1); */ | |
| 2286 | 2286 | } |
| 2287 | 2287 | |
| 2288 | 2288 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_IRQ0, CLEAR_LINE); |
| r8453 | r8454 | |
| 2298 | 2298 | { |
| 2299 | 2299 | data = 0; |
| 2300 | 2300 | } |
| 2301 | cpu_set_reg( | |
| 2301 | cpu_set_reg(m | |
| 2302 | 2302 | |
| 2303 | 2303 | /* Interrupt Mode */ |
| 2304 | cpu_set_reg( | |
| 2304 | cpu_set_reg(m | |
| 2305 | 2305 | |
| 2306 | 2306 | if (z80_type == SPECTRUM_Z80_SNAPSHOT_48K_OLD) |
| 2307 | 2307 | { |
| 2308 | 2308 | lo = snapdata[6] & 0x0ff; |
| 2309 | 2309 | hi = snapdata[7] & 0x0ff; |
| 2310 | cpu_set_reg( | |
| 2310 | cpu_set_reg(m | |
| 2311 | 2311 | |
| 2312 | 2312 | spectrum_page_basicrom(machine); |
| 2313 | 2313 | |
| r8453 | r8454 | |
| 2332 | 2332 | |
| 2333 | 2333 | lo = snapdata[32] & 0x0ff; |
| 2334 | 2334 | hi = snapdata[33] & 0x0ff; |
| 2335 | cpu_set_reg( | |
| 2335 | cpu_set_reg(m | |
| 2336 | 2336 | |
| 2337 | 2337 | if ((z80_type == SPECTRUM_Z80_SNAPSHOT_128K) || ((z80_type == SPECTRUM_Z80_SNAPSHOT_TS2068) && !strcmp(machine->gamedrv->name,"ts2068"))) |
| 2338 | 2338 | { |
| 2339 | running_device *ay8912 = | |
| 2339 | running_device *ay8912 = m | |
| 2340 | 2340 | |
| 2341 | 2341 | /* Only set up sound registers for 128K machine or TS2068! */ |
| 2342 | 2342 | for (i = 0; i < 16; i++) |
| r8453 | r8454 | |
|---|---|---|
| 53 | 53 | UINT8 header[16] = {0}; |
| 54 | 54 | int size = image.length(); |
| 55 | 55 | |
| 56 | if (size > messram_get_size( | |
| 56 | if (size > messram_get_size( | |
| 57 | 57 | { |
| 58 | 58 | return IMAGE_INIT_FAIL; |
| 59 | 59 | } |
| r8453 | r8454 | |
|---|---|---|
| 266 | 266 | |
| 267 | 267 | memory_set_bank(space->machine, "bank1", VIP_BANK_RAM); |
| 268 | 268 | |
| 269 | switch (messram_get_size( | |
| 269 | switch (messram_get_size( | |
| 270 | 270 | { |
| 271 | 271 | case 1 * 1024: |
| 272 | 272 | memory_install_readwrite_bank(program, 0x0000, 0x03ff, 0, 0x7c00, "bank1"); |
| r8453 | r8454 | |
| 639 | 639 | memory_set_bank(machine, "bank2", 0); |
| 640 | 640 | |
| 641 | 641 | /* randomize RAM contents */ |
| 642 | for (addr = 0; addr < messram_get_size( | |
| 642 | for (addr = 0; addr < messram_get_size(m | |
| 643 | 643 | { |
| 644 | 644 | ram[addr] = mame_rand(machine) & 0xff; |
| 645 | 645 | } |
| r8453 | r8454 | |
| 651 | 651 | set_led_status(machine, VIP_LED_POWER, 1); |
| 652 | 652 | |
| 653 | 653 | /* look up devices */ |
| 654 | state->cdp1861 = devtag_get_device(machine, CDP1861_TAG); | |
| 655 | state->cdp1862 = devtag_get_device(machine, CDP1862_TAG); | |
| 656 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 657 | state->beeper = devtag_get_device(machine, DISCRETE_TAG); | |
| 658 | state->vp595 = devtag_get_device(machine, VP595_TAG); | |
| 659 | state->vp550 = devtag_get_device(machine, VP550_TAG); | |
| 660 | state->vp551 = devtag_get_device(machine, VP551_TAG); | |
| 654 | state->cdp1861 = machine->device(CDP1861_TAG); | |
| 655 | state->cdp1862 = machine->device(CDP1862_TAG); | |
| 656 | state->cassette = machine->device(CASSETTE_TAG); | |
| 657 | state->beeper = machine->device(DISCRETE_TAG); | |
| 658 | state->vp595 = machine->device(VP595_TAG); | |
| 659 | state->vp550 = machine->device(VP550_TAG); | |
| 660 | state->vp551 = machine->device(VP551_TAG); | |
| 661 | 661 | |
| 662 | 662 | /* reset sound */ |
| 663 | 663 | discrete_sound_w(state->beeper, NODE_01, 0); |
| r8453 | r8454 | |
| 839 | 839 | chip8_size = memory_region_length(image.device().machine, "chip8x"); |
| 840 | 840 | } |
| 841 | 841 | |
| 842 | if ((size + chip8_size) > messram_get_size( | |
| 842 | if ((size + chip8_size) > messram_get_size( | |
| 843 | 843 | { |
| 844 | 844 | return IMAGE_INIT_FAIL; |
| 845 | 845 | } |
| r8453 | r8454 | |
|---|---|---|
| 65 | 65 | if (MEMORY_PROTECT(space->machine)) |
| 66 | 66 | { |
| 67 | 67 | /* latch data from memory */ |
| 68 | data = messram_get_ptr( | |
| 68 | data = messram_get_ptr( | |
| 69 | 69 | } |
| 70 | 70 | else |
| 71 | 71 | { |
| 72 | 72 | /* write latched data to memory */ |
| 73 | messram_get_ptr( | |
| 73 | messram_get_ptr( | |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /* write data to 7 segment displays */ |
| r8453 | r8454 | |
| 278 | 278 | const address_space *program = cputag_get_address_space(machine, CDP1802_TAG, ADDRESS_SPACE_PROGRAM); |
| 279 | 279 | |
| 280 | 280 | /* find devices */ |
| 281 | state->cdp1861 = devtag_get_device(machine, CDP1861_TAG); | |
| 282 | state->mm74c923 = devtag_get_device(machine, MM74C923_TAG); | |
| 283 | state->dm9368_l = devtag_get_device(machine, DM9368_L_TAG); | |
| 284 | state->dm9368_h = devtag_get_device(machine, DM9368_H_TAG); | |
| 285 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 281 | state->cdp1861 = machine->device(CDP1861_TAG); | |
| 282 | state->mm74c923 = machine->device(MM74C923_TAG); | |
| 283 | state->dm9368_l = machine->device(DM9368_L_TAG); | |
| 284 | state->dm9368_h = machine->device(DM9368_H_TAG); | |
| 285 | state->cassette = machine->device(CASSETTE_TAG); | |
| 286 | 286 | |
| 287 | 287 | /* initialize LED displays */ |
| 288 | 288 | dm9368_rbi_w(state->dm9368_l, 1); |
| r8453 | r8454 | |
| 291 | 291 | /* setup memory banking */ |
| 292 | 292 | memory_install_read_bank(program, 0x0000, 0x00ff, 0, 0, "bank1"); |
| 293 | 293 | memory_install_write8_handler(program, 0x0000, 0x00ff, 0, 0, memory_w); |
| 294 | memory_configure_bank(machine, "bank1", 0, 1, messram_get_ptr( | |
| 294 | memory_configure_bank(machine, "bank1", 0, 1, messram_get_ptr(m | |
| 295 | 295 | memory_set_bank(machine, "bank1", 0); |
| 296 | 296 | |
| 297 | 297 | /* register for state saving */ |
| r8453 | r8454 | |
| 356 | 356 | { |
| 357 | 357 | int size = image.length(); |
| 358 | 358 | |
| 359 | if (size > messram_get_size( | |
| 359 | if (size > messram_get_size( | |
| 360 | 360 | { |
| 361 | 361 | return IMAGE_INIT_FAIL; |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | image.fread( messram_get_ptr( | |
| 364 | image.fread( messram_get_ptr( | |
| 365 | 365 | |
| 366 | 366 | return IMAGE_INIT_PASS; |
| 367 | 367 | } |
| r8453 | r8454 | |
|---|---|---|
| 205 | 205 | |
| 206 | 206 | static void duart_tx(running_device *device, int channel, UINT8 data) |
| 207 | 207 | { |
| 208 | running_device *devconf = dev | |
| 208 | running_device *devconf = dev | |
| 209 | 209 | terminal_write(devconf,0,data); |
| 210 | 210 | #ifdef SERIAL_TO_STDERR |
| 211 | 211 | fprintf(stderr, "%02X ",data); |
| r8453 | r8454 | |
| 297 | 297 | /* Machine reset and friends: stuff that needs setting up which IS directly affected by reset */ |
| 298 | 298 | static void dectalk_reset(running_device *device) |
| 299 | 299 | { |
| 300 | const running_device *devconf = dev | |
| 300 | const running_device *devconf = dev | |
| 301 | 301 | hack_self_test = 0; // hack |
| 302 | 302 | // stuff that is DIRECTLY affected by the RESET line |
| 303 | 303 | dectalk.statusLED = 0; // clear status led latch |
| r8453 | r8454 | |
| 306 | 306 | dectalk.m68k_tlcflags_latch = 0; // initial status is tone detect int(d6) off, answer phone(d8) off, ring detect int(d14) off |
| 307 | 307 | DEVICE_RESET(devconf); // reset the DUART |
| 308 | 308 | devconf = devconf; // hack to make gcc shut up about unused variables. the variable IS USED! |
| 309 | //dev | |
| 309 | //dev | |
| 310 | 310 | // stuff that is INDIRECTLY affected by the RESET line |
| 311 | 311 | dectalk_clear_all_fifos(device->machine); // speech reset clears the fifos, though we have to do it explicitly here since we're not actually in the m68k_spcflags_w function. |
| 312 | 312 | dectalk_semaphore_w(device->machine, 0); // on the original dectalk pcb revision, this is a semaphore for the INPUT fifo, later dec hacked on a check for the 3 output fifo chips to see if they're in sync, and set both of these latches if true. |
| r8453 | r8454 | |
| 322 | 322 | static MACHINE_RESET( dectalk ) |
| 323 | 323 | { |
| 324 | 324 | /* hook the RESET line, which resets a slew of other components */ |
| 325 | m68k_set_reset_callback( | |
| 325 | m68k_set_reset_callback(m | |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | /* Begin 68k i/o handlers */ |
| r8453 | r8454 | |
| 675 | 675 | static TIMER_CALLBACK( outfifo_read_cb ) |
| 676 | 676 | { |
| 677 | 677 | UINT16 data; |
| 678 | running_device *speaker = | |
| 678 | running_device *speaker = m | |
| 679 | 679 | data = dectalk_outfifo_r(machine); |
| 680 | 680 | #ifdef VERBOSE |
| 681 | 681 | if (data!= 0x8000) logerror("sample output: %04X\n", data); |
| r8453 | r8454 | |
| 694 | 694 | |
| 695 | 695 | static WRITE8_DEVICE_HANDLER( dectalk_kbd_put ) |
| 696 | 696 | { |
| 697 | duart68681_rx_data(dev | |
| 697 | duart68681_rx_data(dev | |
| 698 | 698 | } |
| 699 | 699 | |
| 700 | 700 | static GENERIC_TERMINAL_INTERFACE( dectalk_terminal_intf ) |
| r8453 | r8454 | |
|---|---|---|
| 132 | 132 | |
| 133 | 133 | static MACHINE_RESET( jaguar ) |
| 134 | 134 | { |
| 135 | cpu_set_irq_callback( | |
| 135 | cpu_set_irq_callback(m | |
| 136 | 136 | |
| 137 | 137 | protection_check = 0; |
| 138 | 138 | |
| 139 | 139 | /* Set up pointers for Jaguar logo */ |
| 140 | 140 | memcpy(jaguar_shared_ram, rom_base, 0x400); // do not increase, or Doom breaks |
| 141 | cpu_set_reg( | |
| 141 | cpu_set_reg(m | |
| 142 | 142 | |
| 143 | 143 | #if 0 |
| 144 | 144 | /* set up main CPU RAM/ROM banks */ |
| r8453 | r8454 | |
| 160 | 160 | jaguar_dsp_resume(machine); |
| 161 | 161 | |
| 162 | 162 | /* halt the CPUs */ |
| 163 | jaguargpu_ctrl_w(devtag_get_device(machine, "gpu"), G_CTRL, 0, 0xffffffff); | |
| 164 | jaguardsp_ctrl_w(devtag_get_device(machine, "audiocpu"), D_CTRL, 0, 0xffffffff); | |
| 163 | jaguargpu_ctrl_w(machine->device("gpu"), G_CTRL, 0, 0xffffffff); | |
| 164 | jaguardsp_ctrl_w(machine->device("audiocpu"), D_CTRL, 0, 0xffffffff); | |
| 165 | 165 | |
| 166 | 166 | joystick_data = 0xffffffff; |
| 167 | 167 | eeprom_bit_count = 0; |
| r8453 | r8454 | |
| 186 | 186 | /* |
| 187 | 187 | static mame_file *jaguar_nvram_fopen( running_machine *machine, UINT32 openflags) |
| 188 | 188 | { |
| 189 | device_image_interface *image = dynamic_cast<device_image_interface *>( | |
| 189 | device_image_interface *image = dynamic_cast<device_image_interface *>(m | |
| 190 | 190 | astring *fname; |
| 191 | 191 | file_error filerr; |
| 192 | 192 | mame_file *file; |
| r8453 | r8454 | |
| 257 | 257 | */ |
| 258 | 258 | static WRITE32_HANDLER( jaguar_eeprom_w ) |
| 259 | 259 | { |
| 260 | running_device *eeprom = | |
| 260 | running_device *eeprom = | |
| 261 | 261 | eeprom_bit_count++; |
| 262 | 262 | if (eeprom_bit_count != 9) /* kill extra bit at end of address */ |
| 263 | 263 | { |
| r8453 | r8454 | |
| 268 | 268 | |
| 269 | 269 | static READ32_HANDLER( jaguar_eeprom_clk ) |
| 270 | 270 | { |
| 271 | running_device *eeprom = | |
| 271 | running_device *eeprom = | |
| 272 | 272 | eeprom_set_clock_line(eeprom,PULSE_LINE); /* get next bit when reading */ |
| 273 | 273 | return 0; |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | static READ32_HANDLER( jaguar_eeprom_cs ) |
| 277 | 277 | { |
| 278 | running_device *eeprom = | |
| 278 | running_device *eeprom = | |
| 279 | 279 | eeprom_set_cs_line(eeprom,ASSERT_LINE); /* must do at end of an operation */ |
| 280 | 280 | eeprom_set_cs_line(eeprom,CLEAR_LINE); /* enable chip for next operation */ |
| 281 | 281 | eeprom_write_bit(eeprom,1); /* write a start bit */ |
| r8453 | r8454 | |
| 293 | 293 | |
| 294 | 294 | static READ32_HANDLER( gpuctrl_r ) |
| 295 | 295 | { |
| 296 | UINT32 result = jaguargpu_ctrl_r( | |
| 296 | UINT32 result = jaguargpu_ctrl_r( | |
| 297 | 297 | if (protection_check != 1) return result; |
| 298 | 298 | |
| 299 | 299 | protection_check++; |
| r8453 | r8454 | |
| 305 | 305 | static WRITE32_HANDLER( gpuctrl_w ) |
| 306 | 306 | { |
| 307 | 307 | if ((!protection_check) && (offset == 5) && (data == 1)) protection_check++; |
| 308 | jaguargpu_ctrl_w( | |
| 308 | jaguargpu_ctrl_w( | |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | |
| r8453 | r8454 | |
| 318 | 318 | |
| 319 | 319 | static READ32_HANDLER( dspctrl_r ) |
| 320 | 320 | { |
| 321 | return jaguardsp_ctrl_r( | |
| 321 | return jaguardsp_ctrl_r( | |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | |
| 325 | 325 | static WRITE32_HANDLER( dspctrl_w ) |
| 326 | 326 | { |
| 327 | jaguardsp_ctrl_w( | |
| 327 | jaguardsp_ctrl_w( | |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | |
| r8453 | r8454 | |
| 371 | 371 | } |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | joystick_result |= eeprom_read_bit( | |
| 374 | joystick_result |= eeprom_read_bit( | |
| 375 | 375 | joybuts_result |= (input_port_read(space->machine, "CONFIG") & 0x10); |
| 376 | 376 | |
| 377 | 377 | return (joystick_result << 16) | joybuts_result; |
| r8453 | r8454 | |
| 775 | 775 | |
| 776 | 776 | |
| 777 | 777 | /* Some programs are too lazy to set a stack pointer */ |
| 778 | cpu_set_reg( | |
| 778 | cpu_set_reg( | |
| 779 | 779 | jaguar_shared_ram[0]=0x1000; |
| 780 | 780 | |
| 781 | 781 | /* Transfer control to image */ |
| 782 | cpu_set_reg( | |
| 782 | cpu_set_reg( | |
| 783 | 783 | jaguar_shared_ram[1]=quickload_begin; |
| 784 | 784 | return IMAGE_INIT_PASS; |
| 785 | 785 | } |
| r8453 | r8454 | |
| 819 | 819 | // cart_base[0x102] = 1; |
| 820 | 820 | |
| 821 | 821 | /* Transfer control to the bios */ |
| 822 | cpu_set_reg( | |
| 822 | cpu_set_reg( | |
| 823 | 823 | return IMAGE_INIT_PASS; |
| 824 | 824 | } |
| 825 | 825 |
| r8453 | r8454 | |
|---|---|---|
| 143 | 143 | break; |
| 144 | 144 | |
| 145 | 145 | case 3: /* RAM cartridge */ |
| 146 | if (messram_get_size( | |
| 146 | if (messram_get_size(m | |
| 147 | 147 | { |
| 148 | 148 | memory_install_readwrite_bank(program, 0x8000, 0xbfff, 0, 0, "bank3"); |
| 149 | 149 | memory_set_bank(machine, "bank3", 3); // TODO or 4 |
| r8453 | r8454 | |
| 516 | 516 | pc8401a_state *state = (pc8401a_state *)machine->driver_data; |
| 517 | 517 | |
| 518 | 518 | /* find devices */ |
| 519 | state->upd1990a = | |
| 519 | state->upd1990a = m | |
| 520 | 520 | |
| 521 | 521 | /* initialize RTC */ |
| 522 | 522 | upd1990a_cs_w(state->upd1990a, 1); |
| r8453 | r8454 | |
| 526 | 526 | |
| 527 | 527 | /* set up A0/A1 memory banking */ |
| 528 | 528 | memory_configure_bank(machine, "bank1", 0, 4, memory_region(machine, Z80_TAG), 0x8000); |
| 529 | memory_configure_bank(machine, "bank1", 4, 2, messram_get_ptr( | |
| 529 | memory_configure_bank(machine, "bank1", 4, 2, messram_get_ptr(m | |
| 530 | 530 | memory_set_bank(machine, "bank1", 0); |
| 531 | 531 | |
| 532 | 532 | /* set up A2 memory banking */ |
| 533 | memory_configure_bank(machine, "bank3", 0, 5, messram_get_ptr( | |
| 533 | memory_configure_bank(machine, "bank3", 0, 5, messram_get_ptr(m | |
| 534 | 534 | memory_set_bank(machine, "bank3", 0); |
| 535 | 535 | |
| 536 | 536 | /* set up A3 memory banking */ |
| 537 | memory_configure_bank(machine, "bank4", 0, 1, messram_get_ptr( | |
| 537 | memory_configure_bank(machine, "bank4", 0, 1, messram_get_ptr(m | |
| 538 | 538 | memory_configure_bank(machine, "bank4", 1, 1, state->crt_ram, 0); |
| 539 | 539 | memory_set_bank(machine, "bank4", 0); |
| 540 | 540 | |
| 541 | 541 | /* set up A4 memory banking */ |
| 542 | memory_configure_bank(machine, "bank5", 0, 1, messram_get_ptr( | |
| 542 | memory_configure_bank(machine, "bank5", 0, 1, messram_get_ptr(m | |
| 543 | 543 | memory_set_bank(machine, "bank5", 0); |
| 544 | 544 | |
| 545 | 545 | /* bank switch */ |
| r8453 | r8454 | |
|---|---|---|
| 336 | 336 | { |
| 337 | 337 | nakajies_state *state = (nakajies_state *)machine->driver_data; |
| 338 | 338 | |
| 339 | state->cpu = | |
| 339 | state->cpu = m | |
| 340 | 340 | state->irq_enabled = 0; |
| 341 | 341 | state->irq_active = 0; |
| 342 | 342 | } |
| r8453 | r8454 | |
|---|---|---|
| 170 | 170 | { |
| 171 | 171 | tec1_kbd_timer = timer_alloc(machine, tec1_kbd_callback, NULL ); |
| 172 | 172 | timer_adjust_periodic( tec1_kbd_timer, attotime_zero, 0, ATTOTIME_IN_HZ(500) ); |
| 173 | tec1_speaker = | |
| 173 | tec1_speaker = m | |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 |
| r8453 | r8454 | |
|---|---|---|
| 215 | 215 | |
| 216 | 216 | static VIDEO_UPDATE( c65 ) |
| 217 | 217 | { |
| 218 | running_device *vic3 = | |
| 218 | running_device *vic3 = | |
| 219 | 219 | |
| 220 | 220 | vic3_video_update(vic3, bitmap, cliprect); |
| 221 | 221 | return 0; |
| r8453 | r8454 | |
| 271 | 271 | |
| 272 | 272 | static INTERRUPT_GEN( vic3_raster_irq ) |
| 273 | 273 | { |
| 274 | running_device *vic3 = dev | |
| 274 | running_device *vic3 = dev | |
| 275 | 275 | |
| 276 | 276 | vic3_raster_interrupt_gen(vic3); |
| 277 | 277 | } |
| r8453 | r8454 | |
|---|---|---|
| 41 | 41 | memory_set_bank(machine, "bank2", state->mc6845_bank); |
| 42 | 42 | |
| 43 | 43 | /* extended RAM */ |
| 44 | if (messram_get_size( | |
| 44 | if (messram_get_size(m | |
| 45 | 45 | { |
| 46 | 46 | memory_install_readwrite_bank(program, 0x4000, 0x7fff, 0, 0, "bank3"); |
| 47 | 47 | } |
| r8453 | r8454 | |
| 53 | 53 | /* MC6847 video RAM */ |
| 54 | 54 | if (state->mc6847_bank) |
| 55 | 55 | { |
| 56 | if (messram_get_size( | |
| 56 | if (messram_get_size(m | |
| 57 | 57 | { |
| 58 | 58 | memory_install_readwrite_bank(program, 0x8000, 0x97ff, 0, 0, "bank4"); |
| 59 | 59 | } |
| r8453 | r8454 | |
| 70 | 70 | memory_set_bank(machine, "bank4", state->mc6847_bank); |
| 71 | 71 | |
| 72 | 72 | /* extended RAM */ |
| 73 | if (messram_get_size( | |
| 73 | if (messram_get_size(m | |
| 74 | 74 | { |
| 75 | 75 | memory_install_readwrite_bank(program, 0x9800, 0xbfff, 0, 0, "bank5"); |
| 76 | 76 | } |
| r8453 | r8454 | |
| 323 | 323 | const address_space *program = cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM); |
| 324 | 324 | |
| 325 | 325 | /* find devices */ |
| 326 | state->mc6845 = devtag_get_device(machine, MC6845_TAG); | |
| 327 | state->mc6847 = devtag_get_device(machine, MC6847_TAG); | |
| 328 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); | |
| 329 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 326 | state->mc6845 = machine->device(MC6845_TAG); | |
| 327 | state->mc6847 = machine->device(MC6847_TAG); | |
| 328 | state->centronics = machine->device(CENTRONICS_TAG); | |
| 329 | state->cassette = machine->device(CASSETTE_TAG); | |
| 330 | 330 | |
| 331 | 331 | /* setup memory banking */ |
| 332 | 332 | memory_install_readwrite_bank(program, 0x0000, 0x1fff, 0, 0, "bank1"); |
| r8453 | r8454 | |
|---|---|---|
| 600 | 600 | |
| 601 | 601 | static MACHINE_RESET( adam ) |
| 602 | 602 | { |
| 603 | device_image_interface *image = dynamic_cast<device_image_interface *>( | |
| 603 | device_image_interface *image = dynamic_cast<device_image_interface *>(m | |
| 604 | 604 | |
| 605 | 605 | if (image->exists()) |
| 606 | 606 | { |
| r8453 | r8454 | |
|---|---|---|
| 339 | 339 | |
| 340 | 340 | static VIDEO_UPDATE( p500 ) |
| 341 | 341 | { |
| 342 | running_device *vic2 = | |
| 342 | running_device *vic2 = | |
| 343 | 343 | |
| 344 | 344 | vic2_video_update(vic2, bitmap, cliprect); |
| 345 | 345 | return 0; |
| r8453 | r8454 | |
|---|---|---|
| 255 | 255 | if((!(sys_latch & 8)) && data & 0x8) //PLAY tape cmd |
| 256 | 256 | { |
| 257 | 257 | cas_switch = 1; |
| 258 | cassette_change_state(devtag_get_device(space->machine, "cass" ),CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); | |
| 259 | cassette_change_state(devtag_get_device(space->machine, "cass" ),CASSETTE_PLAY,CASSETTE_MASK_UISTATE); | |
| 258 | cassette_change_state(space->machine->device("cass" ),CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); | |
| 259 | cassette_change_state(space->machine->device("cass" ),CASSETTE_PLAY,CASSETTE_MASK_UISTATE); | |
| 260 | 260 | } |
| 261 | 261 | if((sys_latch & 8) && ((data & 0x8) == 0)) //STOP tape cmd |
| 262 | 262 | { |
| 263 | 263 | cas_switch = 0; |
| 264 | cassette_change_state(devtag_get_device(space->machine, "cass" ),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); | |
| 265 | cassette_change_state(devtag_get_device(space->machine, "cass" ),CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); | |
| 264 | cassette_change_state(space->machine->device("cass" ),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); | |
| 265 | cassette_change_state(space->machine->device("cass" ),CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); | |
| 266 | 266 | //irq_vector = 0x00; |
| 267 | 267 | //cputag_set_input_line(space->machine,"maincpu", 0, ASSERT_LINE); |
| 268 | 268 | } |
| r8453 | r8454 | |
| 746 | 746 | { |
| 747 | 747 | static UINT8 cas_data_i = 0x80,cas_data_poll; |
| 748 | 748 | //cur_keycode = gfx_data[cas_offset++]; |
| 749 | if(cassette_input( | |
| 749 | if(cassette_input(m | |
| 750 | 750 | cas_data_poll|= cas_data_i; |
| 751 | 751 | else |
| 752 | 752 | cas_data_poll&=~cas_data_i; |
| r8453 | r8454 | |
| 818 | 818 | port_c_8255=0; |
| 819 | 819 | //pc6001_video_ram = pc6001_ram; |
| 820 | 820 | |
| 821 | cpu_set_irq_callback( | |
| 821 | cpu_set_irq_callback(m | |
| 822 | 822 | cas_switch = 0; |
| 823 | 823 | cas_offset = 0; |
| 824 | 824 | } |
| r8453 | r8454 | |
| 828 | 828 | port_c_8255=0; |
| 829 | 829 | //pc6001_video_ram = pc6001_ram; |
| 830 | 830 | |
| 831 | cpu_set_irq_callback( | |
| 831 | cpu_set_irq_callback(m | |
| 832 | 832 | cas_switch = 0; |
| 833 | 833 | cas_offset = 0; |
| 834 | 834 |
| r8453 | r8454 | |
|---|---|---|
| 32 | 32 | memory_set_bankptr(space->machine, "bank1", memory_region(space->machine, "maincpu")); |
| 33 | 33 | memory_set_bankptr(space->machine, "bank3", memory_region(space->machine, "maincpu")); |
| 34 | 34 | } else { |
| 35 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr(devtag_get_device(space->machine, "messram"))); | |
| 36 | memory_set_bankptr(space->machine, "bank3", messram_get_ptr(devtag_get_device(space->machine, "messram")) + 0x8000); | |
| 35 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr(space->machine->device("messram"))); | |
| 36 | memory_set_bankptr(space->machine, "bank3", messram_get_ptr(space->machine->device("messram")) + 0x8000); | |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
| r8453 | r8454 | |
| 44 | 44 | memory_set_bankptr(space->machine, "bank1", memory_region(space->machine, "maincpu")); |
| 45 | 45 | memory_set_bankptr(space->machine, "bank3", memory_region(space->machine, "maincpu")); |
| 46 | 46 | } else { |
| 47 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr(devtag_get_device(space->machine, "messram"))); | |
| 48 | memory_set_bankptr(space->machine, "bank3", messram_get_ptr(devtag_get_device(space->machine, "messram")) + 0x8000); | |
| 47 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr(space->machine->device("messram"))); | |
| 48 | memory_set_bankptr(space->machine, "bank3", messram_get_ptr(space->machine->device("messram")) + 0x8000); | |
| 49 | 49 | } |
| 50 | 50 | return 0; |
| 51 | 51 | } |
| r8453 | r8454 | |
| 203 | 203 | memory_install_write_bank(space, 0x8000, 0xffff, 0, 0, "bank4"); |
| 204 | 204 | |
| 205 | 205 | memory_set_bankptr(machine, "bank1", memory_region(machine, "maincpu")); |
| 206 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 206 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 207 | 207 | memory_set_bankptr(machine, "bank3", memory_region(machine, "maincpu")); |
| 208 | memory_set_bankptr(machine, "bank4", messram_get_ptr( | |
| 208 | memory_set_bankptr(machine, "bank4", messram_get_ptr(m | |
| 209 | 209 | |
| 210 | 210 | IPLK = 1; |
| 211 | 211 | } |
| r8453 | r8454 | |
| 239 | 239 | |
| 240 | 240 | static VIDEO_UPDATE( spc1000 ) |
| 241 | 241 | { |
| 242 | running_device *mc6847 = | |
| 242 | running_device *mc6847 = | |
| 243 | 243 | return mc6847_update(mc6847, bitmap, cliprect); |
| 244 | 244 | } |
| 245 | 245 |
| r8453 | r8454 | |
|---|---|---|
| 113 | 113 | va_start( v, s_fmt ); |
| 114 | 114 | vsprintf( buf, s_fmt, v ); |
| 115 | 115 | va_end( v ); |
| 116 | logerror( "%04x: %s", cpu_get_pc( | |
| 116 | logerror( "%04x: %s", cpu_get_pc(m | |
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | #else |
| r8453 | r8454 | |
| 607 | 607 | break; |
| 608 | 608 | |
| 609 | 609 | case 0x2f: // Data Segment |
| 610 | val = cpu_get_reg( | |
| 610 | val = cpu_get_reg( | |
| 611 | 611 | verboselog(space->machine, 3, "vii_io_r: Data Segment = %04x (%04x)\n", val, mem_mask); |
| 612 | 612 | break; |
| 613 | 613 | |
| r8453 | r8454 | |
| 686 | 686 | break; |
| 687 | 687 | |
| 688 | 688 | case 0x2f: // Data Segment |
| 689 | temp = cpu_get_reg(devtag_get_device(space->machine, "maincpu"), UNSP_SR); | |
| 690 | cpu_set_reg(devtag_get_device(space->machine, "maincpu"), UNSP_SR, (temp & 0x03ff) | ((data & 0x3f) << 10)); | |
| 689 | temp = cpu_get_reg(space->machine->device("maincpu"), UNSP_SR); | |
| 690 | cpu_set_reg(space->machine->device("maincpu"), UNSP_SR, (temp & 0x03ff) | ((data & 0x3f) << 10)); | |
| 691 | 691 | verboselog(space->machine, 3, "vii_io_w: Data Segment = %04x (%04x)\n", data, mem_mask); |
| 692 | 692 | break; |
| 693 | 693 |
| r8453 | r8454 | |
|---|---|---|
| 707 | 707 | switch(cmd) |
| 708 | 708 | { |
| 709 | 709 | case 0x01: // Stop |
| 710 | cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); | |
| 711 | cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); | |
| 710 | cassette_change_state(machine->device("cass" ),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); | |
| 711 | cassette_change_state(machine->device("cass" ),CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); | |
| 712 | 712 | cmt_test = 1; |
| 713 | 713 | popmessage("CMT: Stop"); |
| 714 | 714 | break; |
| 715 | 715 | case 0x02: // Play |
| 716 | cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); | |
| 717 | cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_PLAY,CASSETTE_MASK_UISTATE); | |
| 716 | cassette_change_state(machine->device("cass" ),CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); | |
| 717 | cassette_change_state(machine->device("cass" ),CASSETTE_PLAY,CASSETTE_MASK_UISTATE); | |
| 718 | 718 | popmessage("CMT: Play"); |
| 719 | 719 | break; |
| 720 | 720 | case 0x03: // Fast Forward |
| 721 | cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); | |
| 722 | cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); | |
| 721 | cassette_change_state(machine->device("cass" ),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); | |
| 722 | cassette_change_state(machine->device("cass" ),CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); | |
| 723 | 723 | popmessage("CMT: Fast Forward"); |
| 724 | 724 | break; |
| 725 | 725 | case 0x04: // Rewind |
| 726 | cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); | |
| 727 | cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); | |
| 726 | cassette_change_state(machine->device("cass" ),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); | |
| 727 | cassette_change_state(machine->device("cass" ),CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); | |
| 728 | 728 | popmessage("CMT: Rewind"); |
| 729 | 729 | break; |
| 730 | 730 | case 0x05: // APSS Fast Forward |
| 731 | cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); | |
| 732 | cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); | |
| 731 | cassette_change_state(machine->device("cass" ),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); | |
| 732 | cassette_change_state(machine->device("cass" ),CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); | |
| 733 | 733 | popmessage("CMT: APSS Fast Forward"); |
| 734 | 734 | break; |
| 735 | 735 | case 0x06: // APSS Rewind |
| 736 | cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); | |
| 737 | cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); | |
| 736 | cassette_change_state(machine->device("cass" ),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); | |
| 737 | cassette_change_state(machine->device("cass" ),CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); | |
| 738 | 738 | popmessage("CMT: APSS Rewind"); |
| 739 | 739 | break; |
| 740 | 740 | case 0x0a: // Record |
| 741 | cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); | |
| 742 | cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_RECORD,CASSETTE_MASK_UISTATE); | |
| 741 | cassette_change_state(machine->device("cass" ),CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); | |
| 742 | cassette_change_state(machine->device("cass" ),CASSETTE_RECORD,CASSETTE_MASK_UISTATE); | |
| 743 | 743 | popmessage("CMT: Record"); |
| 744 | 744 | break; |
| 745 | 745 | default: |
| r8453 | r8454 | |
| 750 | 750 | |
| 751 | 751 | static TIMER_CALLBACK( cmt_wind_timer ) |
| 752 | 752 | { |
| 753 | running_device* cmt = | |
| 753 | running_device* cmt = m | |
| 754 | 754 | switch(cmt_current_cmd) |
| 755 | 755 | { |
| 756 | 756 | case 0x03: |
| r8453 | r8454 | |
| 824 | 824 | // bit 1 = tape inserted |
| 825 | 825 | // bit 2 = record status (1=OK, 0=write protect?) |
| 826 | 826 | sub_val[0] = 0x05; |
| 827 | if(cassette_get_image( | |
| 827 | if(cassette_get_image( | |
| 828 | 828 | sub_val[0] |= 0x02; |
| 829 | 829 | sub_cmd_length = 1; |
| 830 | 830 | logerror("CMT: Command 0xEB received, returning 0x%02x.\n",sub_val[0]); |
| r8453 | r8454 | |
| 913 | 913 | |
| 914 | 914 | static READ8_HANDLER( x1_fdc_r ) |
| 915 | 915 | { |
| 916 | running_device* dev = | |
| 916 | running_device* dev = | |
| 917 | 917 | //UINT8 ret = 0; |
| 918 | 918 | |
| 919 | 919 | switch(offset+0xff8) |
| r8453 | r8454 | |
| 939 | 939 | |
| 940 | 940 | static WRITE8_HANDLER( x1_fdc_w ) |
| 941 | 941 | { |
| 942 | running_device* dev = | |
| 942 | running_device* dev = | |
| 943 | 943 | |
| 944 | 944 | switch(offset+0xff8) |
| 945 | 945 | { |
| r8453 | r8454 | |
| 1186 | 1186 | if(offset == 0) |
| 1187 | 1187 | { |
| 1188 | 1188 | addr_latch = data; |
| 1189 | mc6845_address_w( | |
| 1189 | mc6845_address_w( | |
| 1190 | 1190 | } |
| 1191 | 1191 | else |
| 1192 | 1192 | { |
| r8453 | r8454 | |
| 1198 | 1198 | else if(addr_latch == 0x0d) |
| 1199 | 1199 | crtc_start_addr = (crtc_start_addr & 0x3f00) | (data & 0xff); |
| 1200 | 1200 | |
| 1201 | mc6845_register_w( | |
| 1201 | mc6845_register_w( | |
| 1202 | 1202 | } |
| 1203 | 1203 | } |
| 1204 | 1204 | |
| r8453 | r8454 | |
| 1307 | 1307 | { |
| 1308 | 1308 | io_bank_mode = 0; //any read disables the extended mode. |
| 1309 | 1309 | |
| 1310 | //if(offset >= 0x0704 && offset <= 0x0707) { return z80ctc_r( | |
| 1310 | //if(offset >= 0x0704 && offset <= 0x0707) { return z80ctc_r( | |
| 1311 | 1311 | if(offset == 0x0e03) { return x1_rom_r(space, 0); } |
| 1312 | 1312 | else if(offset >= 0x0ff8 && offset <= 0x0fff) { return x1_fdc_r(space, offset-0xff8); } |
| 1313 | 1313 | else if(offset >= 0x1400 && offset <= 0x17ff) { return x1_pcg_r(space, offset-0x1400); } |
| 1314 | 1314 | else if(offset >= 0x1900 && offset <= 0x19ff) { return sub_io_r(space, 0); } |
| 1315 | else if(offset >= 0x1a00 && offset <= 0x1aff) { return i8255a_r(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3); } | |
| 1316 | else if(offset >= 0x1b00 && offset <= 0x1bff) { return ay8910_r(devtag_get_device(space->machine, "ay"), 0); } | |
| 1317 | // else if(offset >= 0x1f80 && offset <= 0x1f8f) { return z80dma_r(devtag_get_device(space->machine, "dma"), 0); } | |
| 1318 | // else if(offset >= 0x1f90 && offset <= 0x1f91) { return z80sio_c_r(devtag_get_device(space->machine, "sio"), (offset-0x1f90) & 1); } | |
| 1319 | // else if(offset >= 0x1f92 && offset <= 0x1f93) { return z80sio_d_r(devtag_get_device(space->machine, "sio"), (offset-0x1f92) & 1); } | |
| 1320 | else if(offset >= 0x1fa0 && offset <= 0x1fa3) { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa0); } | |
| 1321 | else if(offset >= 0x1fa8 && offset <= 0x1fab) { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa8); } | |
| 1315 | else if(offset >= 0x1a00 && offset <= 0x1aff) { return i8255a_r(space->machine->device("ppi8255_0"), (offset-0x1a00) & 3); } | |
| 1316 | else if(offset >= 0x1b00 && offset <= 0x1bff) { return ay8910_r(space->machine->device("ay"), 0); } | |
| 1317 | // else if(offset >= 0x1f80 && offset <= 0x1f8f) { return z80dma_r(space->machine->device("dma"), 0); } | |
| 1318 | // else if(offset >= 0x1f90 && offset <= 0x1f91) { return z80sio_c_r(space->machine->device("sio"), (offset-0x1f90) & 1); } | |
| 1319 | // else if(offset >= 0x1f92 && offset <= 0x1f93) { return z80sio_d_r(space->machine->device("sio"), (offset-0x1f92) & 1); } | |
| 1320 | else if(offset >= 0x1fa0 && offset <= 0x1fa3) { return z80ctc_r(space->machine->device("ctc"), offset-0x1fa0); } | |
| 1321 | else if(offset >= 0x1fa8 && offset <= 0x1fab) { return z80ctc_r(space->machine->device("ctc"), offset-0x1fa8); } | |
| 1322 | 1322 | // else if(offset >= 0x1fd0 && offset <= 0x1fdf) { return x1_scrn_r(space,offset-0x1fd0); } |
| 1323 | 1323 | // else if(offset == 0x1fe0) { return x1_blackclip_r(space,0); } |
| 1324 | 1324 | else if(offset >= 0x2000 && offset <= 0x2fff) { return x1_colorram[offset-0x2000]; } |
| r8453 | r8454 | |
| 1334 | 1334 | static WRITE8_HANDLER( x1_io_w ) |
| 1335 | 1335 | { |
| 1336 | 1336 | if(io_bank_mode == 1) { x1_ex_gfxram_w(space, offset, data); } |
| 1337 | // else if(offset >= 0x0704 && offset <= 0x0707) { z80ctc_w( | |
| 1337 | // else if(offset >= 0x0704 && offset <= 0x0707) { z80ctc_w( | |
| 1338 | 1338 | // else if(offset >= 0x0c00 && offset <= 0x0cff) { x1_rs232c_w(space->machine, 0, data); } |
| 1339 | 1339 | else if(offset >= 0x0e00 && offset <= 0x0e02) { x1_rom_w(space, offset-0xe00,data); } |
| 1340 | 1340 | // else if(offset >= 0x0e80 && offset <= 0x0e82) { x1_kanji_w(space->machine, offset-0xe80,data); } |
| r8453 | r8454 | |
| 1346 | 1346 | else if(offset >= 0x1400 && offset <= 0x17ff) { x1_pcg_w(space, offset-0x1400,data); } |
| 1347 | 1347 | else if(offset == 0x1800 || offset == 0x1801) { x1_6845_w(space, offset-0x1800, data); } |
| 1348 | 1348 | else if(offset >= 0x1900 && offset <= 0x19ff) { sub_io_w(space, 0,data); } |
| 1349 | else if(offset >= 0x1a00 && offset <= 0x1aff) { i8255a_w(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3,data); } | |
| 1350 | else if(offset >= 0x1b00 && offset <= 0x1bff) { ay8910_data_w(devtag_get_device(space->machine, "ay"), 0,data); } | |
| 1351 | else if(offset >= 0x1c00 && offset <= 0x1cff) { ay8910_address_w(devtag_get_device(space->machine, "ay"), 0,data); } | |
| 1349 | else if(offset >= 0x1a00 && offset <= 0x1aff) { i8255a_w(space->machine->device("ppi8255_0"), (offset-0x1a00) & 3,data); } | |
| 1350 | else if(offset >= 0x1b00 && offset <= 0x1bff) { ay8910_data_w(space->machine->device("ay"), 0,data); } | |
| 1351 | else if(offset >= 0x1c00 && offset <= 0x1cff) { ay8910_address_w(space->machine->device("ay"), 0,data); } | |
| 1352 | 1352 | else if(offset >= 0x1d00 && offset <= 0x1dff) { rom_bank_1_w(space,0,data); } |
| 1353 | 1353 | else if(offset >= 0x1e00 && offset <= 0x1eff) { rom_bank_0_w(space,0,data); } |
| 1354 | // else if(offset >= 0x1f80 && offset <= 0x1f8f) { z80dma_w(devtag_get_device(space->machine, "dma"), 0,data); } | |
| 1355 | // else if(offset >= 0x1f90 && offset <= 0x1f91) { z80sio_c_w(devtag_get_device(space->machine, "sio"), (offset-0x1f90) & 1,data); } | |
| 1356 | // else if(offset >= 0x1f92 && offset <= 0x1f93) { z80sio_d_w(devtag_get_device(space->machine, "sio"), (offset-0x1f92) & 1,data); } | |
| 1357 | else if(offset >= 0x1fa0 && offset <= 0x1fa3) { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa0,data); } | |
| 1358 | else if(offset >= 0x1fa8 && offset <= 0x1fab) { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa8,data); } | |
| 1354 | // else if(offset >= 0x1f80 && offset <= 0x1f8f) { z80dma_w(space->machine->device("dma"), 0,data); } | |
| 1355 | // else if(offset >= 0x1f90 && offset <= 0x1f91) { z80sio_c_w(space->machine->device("sio"), (offset-0x1f90) & 1,data); } | |
| 1356 | // else if(offset >= 0x1f92 && offset <= 0x1f93) { z80sio_d_w(space->machine->device("sio"), (offset-0x1f92) & 1,data); } | |
| 1357 | else if(offset >= 0x1fa0 && offset <= 0x1fa3) { z80ctc_w(space->machine->device("ctc"), offset-0x1fa0,data); } | |
| 1358 | else if(offset >= 0x1fa8 && offset <= 0x1fab) { z80ctc_w(space->machine->device("ctc"), offset-0x1fa8,data); } | |
| 1359 | 1359 | // else if(offset == 0x1fb0) { x1turbo_pal_w(space,0,data); } |
| 1360 | 1360 | // else if(offset >= 0x1fb9 && offset <= 0x1fbf) { x1turbo_txpal_w(space,offset-0x1fb9,data); } |
| 1361 | 1361 | // else if(offset == 0x1fc0) { x1turbo_txdisp_w(space,0,data); } |
| r8453 | r8454 | |
| 1375 | 1375 | { |
| 1376 | 1376 | io_bank_mode = 0; //any read disables the extended mode. |
| 1377 | 1377 | |
| 1378 | if(offset == 0x0700) { return (ym2151_r(devtag_get_device(space->machine, "ym"), offset-0x0700) & 0x7f) | (input_port_read(space->machine, "SOUND_SW") & 0x80); } | |
| 1379 | else if(offset == 0x0701) { return ym2151_r(devtag_get_device(space->machine, "ym"), offset-0x0700); } | |
| 1380 | else if(offset >= 0x0704 && offset <= 0x0707) { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x0704); } | |
| 1378 | if(offset == 0x0700) { return (ym2151_r(space->machine->device("ym"), offset-0x0700) & 0x7f) | (input_port_read(space->machine, "SOUND_SW") & 0x80); } | |
| 1379 | else if(offset == 0x0701) { return ym2151_r(space->machine->device("ym"), offset-0x0700); } | |
| 1380 | else if(offset >= 0x0704 && offset <= 0x0707) { return z80ctc_r(space->machine->device("ctc"), offset-0x0704); } | |
| 1381 | 1381 | else if(offset == 0x0e03) { return x1_rom_r(space, 0); } |
| 1382 | 1382 | else if(offset >= 0x0e80 && offset <= 0x0e83) { return x1_kanji_r(space, offset-0xe80); } |
| 1383 | 1383 | else if(offset >= 0x0ff8 && offset <= 0x0fff) { return x1_fdc_r(space, offset-0xff8); } |
| 1384 | 1384 | else if(offset >= 0x1400 && offset <= 0x17ff) { return x1_pcg_r(space, offset-0x1400); } |
| 1385 | 1385 | else if(offset >= 0x1900 && offset <= 0x19ff) { return sub_io_r(space, 0); } |
| 1386 | else if(offset >= 0x1a00 && offset <= 0x1aff) { return i8255a_r(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3); } | |
| 1387 | else if(offset >= 0x1b00 && offset <= 0x1bff) { return ay8910_r(devtag_get_device(space->machine, "ay"), 0); } | |
| 1388 | else if(offset >= 0x1f80 && offset <= 0x1f8f) { return z80dma_r(devtag_get_device(space->machine, "dma"), 0); } | |
| 1389 | else if(offset >= 0x1f90 && offset <= 0x1f91) { return z80sio_c_r(devtag_get_device(space->machine, "sio"), (offset-0x1f90) & 1); } | |
| 1390 | else if(offset >= 0x1f92 && offset <= 0x1f93) { return z80sio_d_r(devtag_get_device(space->machine, "sio"), (offset-0x1f92) & 1); } | |
| 1391 | else if(offset >= 0x1fa0 && offset <= 0x1fa3) { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa0); } | |
| 1392 | else if(offset >= 0x1fa8 && offset <= 0x1fab) { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa8); } | |
| 1386 | else if(offset >= 0x1a00 && offset <= 0x1aff) { return i8255a_r(space->machine->device("ppi8255_0"), (offset-0x1a00) & 3); } | |
| 1387 | else if(offset >= 0x1b00 && offset <= 0x1bff) { return ay8910_r(space->machine->device("ay"), 0); } | |
| 1388 | else if(offset >= 0x1f80 && offset <= 0x1f8f) { return z80dma_r(space->machine->device("dma"), 0); } | |
| 1389 | else if(offset >= 0x1f90 && offset <= 0x1f91) { return z80sio_c_r(space->machine->device("sio"), (offset-0x1f90) & 1); } | |
| 1390 | else if(offset >= 0x1f92 && offset <= 0x1f93) { return z80sio_d_r(space->machine->device("sio"), (offset-0x1f92) & 1); } | |
| 1391 | else if(offset >= 0x1fa0 && offset <= 0x1fa3) { return z80ctc_r(space->machine->device("ctc"), offset-0x1fa0); } | |
| 1392 | else if(offset >= 0x1fa8 && offset <= 0x1fab) { return z80ctc_r(space->machine->device("ctc"), offset-0x1fa8); } | |
| 1393 | 1393 | else if(offset == 0x1fb0) { return x1turbo_pal_r(space,0); } |
| 1394 | 1394 | else if(offset >= 0x1fb8 && offset <= 0x1fbf) { return x1turbo_txpal_r(space,offset-0x1fb8); } |
| 1395 | 1395 | else if(offset == 0x1fc0) { return x1turbo_txdisp_r(space,0); } |
| r8453 | r8454 | |
| 1411 | 1411 | static WRITE8_HANDLER( x1turbo_io_w ) |
| 1412 | 1412 | { |
| 1413 | 1413 | if(io_bank_mode == 1) { x1_ex_gfxram_w(space, offset, data); } |
| 1414 | else if(offset == 0x0700 || offset == 0x0701) { ym2151_w(devtag_get_device(space->machine, "ym"), offset-0x0700,data); } | |
| 1415 | else if(offset >= 0x0704 && offset <= 0x0707) { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x0704,data); } | |
| 1414 | else if(offset == 0x0700 || offset == 0x0701) { ym2151_w(space->machine->device("ym"), offset-0x0700,data); } | |
| 1415 | else if(offset >= 0x0704 && offset <= 0x0707) { z80ctc_w(space->machine->device("ctc"), offset-0x0704,data); } | |
| 1416 | 1416 | // else if(offset >= 0x0c00 && offset <= 0x0cff) { x1_rs232c_w(space->machine, 0, data); } |
| 1417 | 1417 | else if(offset >= 0x0e00 && offset <= 0x0e02) { x1_rom_w(space, offset-0xe00,data); } |
| 1418 | 1418 | else if(offset >= 0x0e80 && offset <= 0x0e83) { x1_kanji_w(space, offset-0xe80,data); } |
| r8453 | r8454 | |
| 1424 | 1424 | else if(offset >= 0x1400 && offset <= 0x17ff) { x1_pcg_w(space, offset-0x1400,data); } |
| 1425 | 1425 | else if(offset == 0x1800 || offset == 0x1801) { x1_6845_w(space, offset-0x1800, data); } |
| 1426 | 1426 | else if(offset >= 0x1900 && offset <= 0x19ff) { sub_io_w(space, 0,data); } |
| 1427 | else if(offset >= 0x1a00 && offset <= 0x1aff) { i8255a_w(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3,data); } | |
| 1428 | else if(offset >= 0x1b00 && offset <= 0x1bff) { ay8910_data_w(devtag_get_device(space->machine, "ay"), 0,data); } | |
| 1429 | else if(offset >= 0x1c00 && offset <= 0x1cff) { ay8910_address_w(devtag_get_device(space->machine, "ay"), 0,data); } | |
| 1427 | else if(offset >= 0x1a00 && offset <= 0x1aff) { i8255a_w(space->machine->device("ppi8255_0"), (offset-0x1a00) & 3,data); } | |
| 1428 | else if(offset >= 0x1b00 && offset <= 0x1bff) { ay8910_data_w(space->machine->device("ay"), 0,data); } | |
| 1429 | else if(offset >= 0x1c00 && offset <= 0x1cff) { ay8910_address_w(space->machine->device("ay"), 0,data); } | |
| 1430 | 1430 | else if(offset >= 0x1d00 && offset <= 0x1dff) { rom_bank_1_w(space,0,data); } |
| 1431 | 1431 | else if(offset >= 0x1e00 && offset <= 0x1eff) { rom_bank_0_w(space,0,data); } |
| 1432 | else if(offset >= 0x1f80 && offset <= 0x1f8f) { z80dma_w(devtag_get_device(space->machine, "dma"), 0,data); } | |
| 1433 | else if(offset >= 0x1f90 && offset <= 0x1f91) { z80sio_c_w(devtag_get_device(space->machine, "sio"), (offset-0x1f90) & 1,data); } | |
| 1434 | else if(offset >= 0x1f92 && offset <= 0x1f93) { z80sio_d_w(devtag_get_device(space->machine, "sio"), (offset-0x1f92) & 1,data); } | |
| 1435 | else if(offset >= 0x1fa0 && offset <= 0x1fa3) { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa0,data); } | |
| 1436 | else if(offset >= 0x1fa8 && offset <= 0x1fab) { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa8,data); } | |
| 1432 | else if(offset >= 0x1f80 && offset <= 0x1f8f) { z80dma_w(space->machine->device("dma"), 0,data); } | |
| 1433 | else if(offset >= 0x1f90 && offset <= 0x1f91) { z80sio_c_w(space->machine->device("sio"), (offset-0x1f90) & 1,data); } | |
| 1434 | else if(offset >= 0x1f92 && offset <= 0x1f93) { z80sio_d_w(space->machine->device("sio"), (offset-0x1f92) & 1,data); } | |
| 1435 | else if(offset >= 0x1fa0 && offset <= 0x1fa3) { z80ctc_w(space->machine->device("ctc"), offset-0x1fa0,data); } | |
| 1436 | else if(offset >= 0x1fa8 && offset <= 0x1fab) { z80ctc_w(space->machine->device("ctc"), offset-0x1fa8,data); } | |
| 1437 | 1437 | else if(offset == 0x1fb0) { x1turbo_pal_w(space,0,data); } |
| 1438 | 1438 | else if(offset >= 0x1fb8 && offset <= 0x1fbf) { x1turbo_txpal_w(space,offset-0x1fb8,data); } |
| 1439 | 1439 | else if(offset == 0x1fc0) { x1turbo_txdisp_w(space,0,data); } |
| r8453 | r8454 | |
| 1496 | 1496 | vdisp = (device->machine->primary_screen->vpos() < 200) ? 0x80 : 0x00; |
| 1497 | 1497 | dat = (input_port_read(device->machine, "SYSTEM") & 0x10) | sub_obf | vsync | vdisp; |
| 1498 | 1498 | |
| 1499 | if(cassette_input(dev | |
| 1499 | if(cassette_input(dev | |
| 1500 | 1500 | dat |= 0x02; |
| 1501 | 1501 | |
| 1502 | // if(cassette_get_state(dev | |
| 1502 | // if(cassette_get_state(dev | |
| 1503 | 1503 | // dat &= ~0x02; // is zero if not playing |
| 1504 | 1504 | |
| 1505 | 1505 | // CMT test bit is set low when the CMT Stop command is issued, and becomes |
| r8453 | r8454 | |
| 1546 | 1546 | io_switch = data & 0x20; |
| 1547 | 1547 | io_sys = data & 0xff; |
| 1548 | 1548 | |
| 1549 | cassette_output(dev | |
| 1549 | cassette_output(dev | |
| 1550 | 1550 | } |
| 1551 | 1551 | |
| 1552 | 1552 | static I8255A_INTERFACE( ppi8255_intf ) |
| r8453 | r8454 | |
| 2102 | 2102 | io_bank_mode = 0; |
| 2103 | 2103 | pcg_index[0] = pcg_index[1] = pcg_index[2] = 0; |
| 2104 | 2104 | |
| 2105 | //cpu_set_irq_callback( | |
| 2105 | //cpu_set_irq_callback(m | |
| 2106 | 2106 | |
| 2107 | 2107 | cmt_current_cmd = 0; |
| 2108 | 2108 | cmt_test = 0; |
| 2109 | cassette_change_state( | |
| 2109 | cassette_change_state(m | |
| 2110 | 2110 | |
| 2111 | 2111 | x1_key_irq_flag = ctc_irq_flag = 0; |
| 2112 | 2112 |
| r8453 | r8454 | |
|---|---|---|
| 164 | 164 | |
| 165 | 165 | static void mk1_interrupt( running_device *device, UINT16 addr, int level ) |
| 166 | 166 | { |
| 167 | cpu_set_input_line_vector(dev | |
| 167 | cpu_set_input_line_vector(dev | |
| 168 | 168 | cputag_set_input_line(device->machine,"maincpu", 0, level ? F8_INT_INTR : F8_INT_NONE ); |
| 169 | 169 | } |
| 170 | 170 |
| r8453 | r8454 | |
|---|---|---|
| 795 | 795 | |
| 796 | 796 | static NVRAM_HANDLER( pc1260 ) |
| 797 | 797 | { |
| 798 | running_device *main_cpu = | |
| 798 | running_device *main_cpu = m | |
| 799 | 799 | UINT8 *ram = memory_region(machine, "maincpu") + 0x4000; |
| 800 | 800 | UINT8 *cpu = sc61860_internal_ram(main_cpu); |
| 801 | 801 |
| r8453 | r8454 | |
|---|---|---|
| 43 | 43 | { |
| 44 | 44 | xor100_state *state = (xor100_state *)machine->driver_data; |
| 45 | 45 | const address_space *program = cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM); |
| 46 | running_device *messram = | |
| 46 | running_device *messram = m | |
| 47 | 47 | int banks = messram_get_size(messram) / 0x10000; |
| 48 | 48 | |
| 49 | 49 | switch (state->mode) |
| r8453 | r8454 | |
| 159 | 159 | |
| 160 | 160 | static WRITE8_DEVICE_HANDLER( i8251_b_data_w ) |
| 161 | 161 | { |
| 162 | running_device *terminal = dev | |
| 162 | running_device *terminal = dev | |
| 163 | 163 | |
| 164 | 164 | msm8251_data_w(device, 0, data); |
| 165 | 165 | terminal_write(terminal, 0, data); |
| r8453 | r8454 | |
| 532 | 532 | static MACHINE_START( xor100 ) |
| 533 | 533 | { |
| 534 | 534 | xor100_state *state = (xor100_state *)machine->driver_data; |
| 535 | running_device *messram = | |
| 535 | running_device *messram = m | |
| 536 | 536 | int banks = messram_get_size(messram) / 0x10000; |
| 537 | 537 | |
| 538 | 538 | /* find devices */ |
| 539 | state->i8251_a = devtag_get_device(machine, I8251_A_TAG); | |
| 540 | state->i8251_b = devtag_get_device(machine, I8251_B_TAG); | |
| 541 | state->wd1795 = devtag_get_device(machine, WD1795_TAG); | |
| 542 | state->z80ctc = devtag_get_device(machine, Z80CTC_TAG); | |
| 543 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 539 | state->i8251_a = machine->device(I8251_A_TAG); | |
| 540 | state->i8251_b = machine->device(I8251_B_TAG); | |
| 541 | state->wd1795 = machine->device(WD1795_TAG); | |
| 542 | state->z80ctc = machine->device(Z80CTC_TAG); | |
| 543 | state->cassette = machine->device(CASSETTE_TAG); | |
| 544 | 544 | |
| 545 | 545 | /* setup memory banking */ |
| 546 | 546 | memory_configure_bank(machine, "bank1", 1, banks, messram_get_ptr(messram), 0x10000); |
| r8453 | r8454 | |
|---|---|---|
| 28 | 28 | static INPUT_CHANGED( pen_check ) |
| 29 | 29 | { |
| 30 | 30 | UINT8 button = input_port_read(field->port->machine, "PENB"); |
| 31 | running_device *mc68328_device = | |
| 31 | running_device *mc68328_device = | |
| 32 | 32 | if(button) |
| 33 | 33 | { |
| 34 | 34 | mc68328_set_penirq_line(mc68328_device, 1); |
| r8453 | r8454 | |
| 42 | 42 | static INPUT_CHANGED( button_check ) |
| 43 | 43 | { |
| 44 | 44 | UINT8 button_state = input_port_read(field->port->machine, "PORTD"); |
| 45 | running_device *mc68328_device = | |
| 45 | running_device *mc68328_device = | |
| 46 | 46 | |
| 47 | 47 | mc68328_set_port_d_lines(mc68328_device, button_state, (int)(FPTR)param); |
| 48 | 48 | } |
| r8453 | r8454 | |
| 92 | 92 | static MACHINE_START( palm ) |
| 93 | 93 | { |
| 94 | 94 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 95 | memory_install_read_bank (space, 0x000000, messram_get_size(devtag_get_device(machine, "messram")) - 1, messram_get_size(devtag_get_device(machine, "messram")) - 1, 0, "bank1"); | |
| 96 | memory_install_write_bank(space, 0x000000, messram_get_size(devtag_get_device(machine, "messram")) - 1, messram_get_size(devtag_get_device(machine, "messram")) - 1, 0, "bank1"); | |
| 97 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 95 | memory_install_read_bank (space, 0x000000, messram_get_size(machine->device("messram")) - 1, messram_get_size(machine->device("messram")) - 1, 0, "bank1"); | |
| 96 | memory_install_write_bank(space, 0x000000, messram_get_size(machine->device("messram")) - 1, messram_get_size(machine->device("messram")) - 1, 0, "bank1"); | |
| 97 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram"))); | |
| 98 | 98 | |
| 99 | 99 | state_save_register_global(machine, port_f_latch); |
| 100 | 100 | state_save_register_global(machine, spim_data); |
| r8453 | r8454 | |
| 107 | 107 | { |
| 108 | 108 | // Copy boot ROM |
| 109 | 109 | UINT8* bios = memory_region(machine, "bios"); |
| 110 | memset(messram_get_ptr(devtag_get_device(machine, "messram")), 0, messram_get_size(devtag_get_device(machine, "messram"))); | |
| 111 | memcpy(messram_get_ptr(devtag_get_device(machine, "messram")), bios, 0x20000); | |
| 110 | memset(messram_get_ptr(machine->device("messram")), 0, messram_get_size(machine->device("messram"))); | |
| 111 | memcpy(messram_get_ptr(machine->device("messram")), bios, 0x20000); | |
| 112 | 112 | |
| 113 | | |
| 113 | m | |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
| r8453 | r8454 | |
| 130 | 130 | |
| 131 | 131 | static WRITE8_DEVICE_HANDLER( palm_dac_transition ) |
| 132 | 132 | { |
| 133 | dac_data_w( dev | |
| 133 | dac_data_w( dev | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 |
| r8453 | r8454 | |
|---|---|---|
| 30 | 30 | va_start( v, s_fmt ); |
| 31 | 31 | vsprintf( buf, s_fmt, v ); |
| 32 | 32 | va_end( v ); |
| 33 | logerror("%08x: %s", cpu_get_pc( | |
| 33 | logerror("%08x: %s", cpu_get_pc(m | |
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | #else |
| r8453 | r8454 | |
|---|---|---|
| 207 | 207 | if ( data & 0x20 ) |
| 208 | 208 | { |
| 209 | 209 | /* cassette write/speaker update */ |
| 210 | cassette_output( dev | |
| 210 | cassette_output( dev | |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /* Set IRQ when bit 7 is cleared */ |
| r8453 | r8454 | |
| 233 | 233 | |
| 234 | 234 | static TIMER_CALLBACK( kim1_cassette_input ) |
| 235 | 235 | { |
| 236 | double tap_val = cassette_input( | |
| 236 | double tap_val = cassette_input( m | |
| 237 | 237 | |
| 238 | 238 | if ( tap_val <= 0 ) |
| 239 | 239 | { |
| r8453 | r8454 | |
|---|---|---|
| 138 | 138 | |
| 139 | 139 | static WRITE16_HANDLER( glasgow_lcd_flag_w ) |
| 140 | 140 | { |
| 141 | running_device *speaker = | |
| 141 | running_device *speaker = | |
| 142 | 142 | UINT16 lcd_flag = data & 0x8100; |
| 143 | 143 | |
| 144 | 144 | beep_set_state(speaker, (lcd_flag & 0x100) ? 1 : 0); |
| r8453 | r8454 | |
| 362 | 362 | |
| 363 | 363 | static WRITE16_HANDLER( write_irq_flag ) |
| 364 | 364 | { |
| 365 | running_device *speaker = | |
| 365 | running_device *speaker = | |
| 366 | 366 | |
| 367 | 367 | beep_set_state(speaker, data & 0x100); |
| 368 | 368 | logerror("Write 0x800004 = %x \n", data); |
| r8453 | r8454 | |
| 475 | 475 | |
| 476 | 476 | static WRITE32_HANDLER ( write_beeper32 ) |
| 477 | 477 | { |
| 478 | running_device *speaker = | |
| 478 | running_device *speaker = | |
| 479 | 479 | beep_set_state(speaker, data & 0x01000000); |
| 480 | 480 | logerror("Write 0x8000004 = %x \n", data); |
| 481 | 481 | irq_flag = 1; |
| r8453 | r8454 | |
| 502 | 502 | |
| 503 | 503 | static MACHINE_START( glasgow ) |
| 504 | 504 | { |
| 505 | running_device *speaker = | |
| 505 | running_device *speaker = m | |
| 506 | 506 | |
| 507 | 507 | key_selector = 0; |
| 508 | 508 | irq_flag = 0; |
| r8453 | r8454 | |
| 514 | 514 | |
| 515 | 515 | static MACHINE_START( dallas32 ) |
| 516 | 516 | { |
| 517 | running_device *speaker = | |
| 517 | running_device *speaker = m | |
| 518 | 518 | |
| 519 | 519 | lcd_shift_counter = 3; |
| 520 | 520 | timer_pulse(machine, ATTOTIME_IN_HZ(50), NULL, 0, update_nmi32); |
| r8453 | r8454 | |
|---|---|---|
| 273 | 273 | const address_space *program = cputag_get_address_space(machine, CDP1802_TAG, ADDRESS_SPACE_PROGRAM); |
| 274 | 274 | |
| 275 | 275 | /* find devices */ |
| 276 | state->cassette = | |
| 276 | state->cassette = m | |
| 277 | 277 | |
| 278 | 278 | /* configure RAM */ |
| 279 | switch (messram_get_size( | |
| 279 | switch (messram_get_size(m | |
| 280 | 280 | { |
| 281 | 281 | case 8*1024: |
| 282 | 282 | memory_unmap_readwrite(program, 0x8000, 0xbfff, 0, 0); |
| r8453 | r8454 | |
|---|---|---|
| 379 | 379 | vic20_state *state = (vic20_state *)device->machine->driver_data; |
| 380 | 380 | |
| 381 | 381 | /* cassette write */ |
| 382 | cassette_output(dev | |
| 382 | cassette_output(dev | |
| 383 | 383 | |
| 384 | 384 | /* keyboard column */ |
| 385 | 385 | state->key_col = data; |
| r8453 | r8454 | |
| 520 | 520 | const address_space *program = cputag_get_address_space(machine, M6502_TAG, ADDRESS_SPACE_PROGRAM); |
| 521 | 521 | |
| 522 | 522 | /* find devices */ |
| 523 | state->via0 = devtag_get_device(machine, M6522_0_TAG); | |
| 524 | state->via1 = devtag_get_device(machine, M6522_1_TAG); | |
| 525 | state->iec = devtag_get_device(machine, IEC_TAG); | |
| 526 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 523 | state->via0 = machine->device(M6522_0_TAG); | |
| 524 | state->via1 = machine->device(M6522_1_TAG); | |
| 525 | state->iec = machine->device(IEC_TAG); | |
| 526 | state->cassette = machine->device(CASSETTE_TAG); | |
| 527 | 527 | state->cassette_timer = machine->device<timer_device>(TIMER_C1530_TAG); |
| 528 | state->mos6560 = | |
| 528 | state->mos6560 = m | |
| 529 | 529 | |
| 530 | 530 | /* set VIA clocks */ |
| 531 | 531 | state->via0->set_unscaled_clock(cputag_get_clock(machine, M6502_TAG)); |
| 532 | 532 | state->via1->set_unscaled_clock(cputag_get_clock(machine, M6502_TAG)); |
| 533 | 533 | |
| 534 | 534 | /* memory expansions */ |
| 535 | switch (messram_get_size( | |
| 535 | switch (messram_get_size(m | |
| 536 | 536 | { |
| 537 | 537 | case 32*1024: |
| 538 | 538 | memory_install_ram(program, 0x6000, 0x7fff, 0, 0, NULL); |
| r8453 | r8454 | |
|---|---|---|
| 286 | 286 | { |
| 287 | 287 | (void)ic; |
| 288 | 288 | |
| 289 | tms9901_set_single_int(dev | |
| 289 | tms9901_set_single_int(dev | |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | static READ8_DEVICE_HANDLER( sys9901_r0 ) |
| r8453 | r8454 | |
| 299 | 299 | reply |= input_port_read(device->machine, keynames[digitsel]) << 1; |
| 300 | 300 | |
| 301 | 301 | /* tape input */ |
| 302 | if (cassette_input(dev | |
| 302 | if (cassette_input(dev | |
| 303 | 303 | reply |= 0x40; |
| 304 | 304 | |
| 305 | 305 | return reply; |
| r8453 | r8454 | |
| 344 | 344 | |
| 345 | 345 | static WRITE8_DEVICE_HANDLER( sys9901_spkrdrive_w ) |
| 346 | 346 | { |
| 347 | running_device *speaker = dev | |
| 347 | running_device *speaker = dev | |
| 348 | 348 | speaker_level_w(speaker, data); |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | static WRITE8_DEVICE_HANDLER( sys9901_tapewdata_w ) |
| 352 | 352 | { |
| 353 | cassette_output(dev | |
| 353 | cassette_output(dev | |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | /* |
| r8453 | r8454 | |
| 364 | 364 | if (/*rs232_rts &&*/ /*(mame_ftell(rs232_fp) < mame_fsize(rs232_fp))*/1) |
| 365 | 365 | { |
| 366 | 366 | if (image->fread(&buf, 1) == 1) |
| 367 | tms9902_push_data( | |
| 367 | tms9902_push_data(m | |
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | |
| r8453 | r8454 | |
| 373 | 373 | */ |
| 374 | 374 | static DEVICE_IMAGE_LOAD( tm990_189_rs232 ) |
| 375 | 375 | { |
| 376 | tms9902_set_dsr( | |
| 376 | tms9902_set_dsr( | |
| 377 | 377 | rs232_input_timer = timer_alloc(image.device().machine, rs232_input_callback, (void*)image); |
| 378 | 378 | timer_adjust_periodic(rs232_input_timer, attotime_zero, 0, ATTOTIME_IN_MSEC(10)); |
| 379 | 379 | |
| r8453 | r8454 | |
| 385 | 385 | */ |
| 386 | 386 | static DEVICE_IMAGE_UNLOAD( tm990_189_rs232 ) |
| 387 | 387 | { |
| 388 | tms9902_set_dsr( | |
| 388 | tms9902_set_dsr( | |
| 389 | 389 | |
| 390 | 390 | timer_reset(rs232_input_timer, attotime_never); /* FIXME - timers should only be allocated once */ |
| 391 | 391 | } |
| r8453 | r8454 | |
| 448 | 448 | case 5: /* CKON: set DECKCONTROL */ |
| 449 | 449 | LED_state |= 0x20; |
| 450 | 450 | { |
| 451 | running_device *img = | |
| 451 | running_device *img = | |
| 452 | 452 | cassette_change_state(img, CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); |
| 453 | 453 | } |
| 454 | 454 | break; |
| r8453 | r8454 | |
| 456 | 456 | case 6: /* CKOF: clear DECKCONTROL */ |
| 457 | 457 | LED_state &= ~0x20; |
| 458 | 458 | { |
| 459 | running_device *img = | |
| 459 | running_device *img = | |
| 460 | 460 | cassette_change_state(img, CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); |
| 461 | 461 | } |
| 462 | 462 | break; |
| r8453 | r8454 | |
|---|---|---|
| 339 | 339 | /* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ |
| 340 | 340 | /* 0x20000 - 0x247ff: 18 KB floppy / network ROM controllers */ |
| 341 | 341 | |
| 342 | /* messram_get_ptr( | |
| 342 | /* messram_get_ptr(m | |
| 343 | 343 | 0x0000 - 0x3fff: 16 KB video RAM (actually 8 K x 8 bits + 8 K x 6 bits) |
| 344 | 344 | 0x4000 - 0x5fff: 8 KB base RAM |
| 345 | 345 | 0x6000 - 0x9fff: 16 KB extended RAM |
| r8453 | r8454 | |
| 763 | 763 | /* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ |
| 764 | 764 | /* 0x20000 - 0x247ff: 18 KB floppy / network ROM controllers */ |
| 765 | 765 | |
| 766 | /* messram_get_ptr( | |
| 766 | /* messram_get_ptr(m | |
| 767 | 767 | 0x00000 - 0x03fff: 16 KB video RAM |
| 768 | 768 | 0x04000 - 0x07fff: 16 KB unbanked base RAM |
| 769 | 769 | 0x08000 - 0x1ffff: 6 * 16 KB banked extended RAM |
| r8453 | r8454 | |
| 952 | 952 | /* 0x10000 - 0x1ffff: 16 KB integrated BASIC / 64 KB external cartridge */ |
| 953 | 953 | /* 0x20000 - 0x247ff: 18 KB floppy / network ROM controllers */ |
| 954 | 954 | |
| 955 | /* messram_get_ptr( | |
| 955 | /* messram_get_ptr(m | |
| 956 | 956 | 0x00000 - 0x03fff: 16 KB video RAM |
| 957 | 957 | 0x04000 - 0x0bfff: 32 KB unbanked base RAM |
| 958 | 958 | 0x0c000 - 0x1bfff: 4 * 16 KB bank extended RAM |
| r8453 | r8454 | |
| 1159 | 1159 | /* 0x20000 - 0x3ffff: 128 KB internal software ROM */ |
| 1160 | 1160 | /* 0x40000 - 0x447ff: 18 KB external floppy / network ROM controllers */ |
| 1161 | 1161 | |
| 1162 | /* messram_get_ptr( | |
| 1162 | /* messram_get_ptr(m | |
| 1163 | 1163 | 0x00000 - 0x03fff: 16 KB video RAM |
| 1164 | 1164 | 0x04000 - 0x07fff: 16 KB unbanked base RAM |
| 1165 | 1165 | 0x08000 - 0x2ffff: 10 * 16 KB banked extended RAM |
| r8453 | r8454 | |
| 1486 | 1486 | /* 0x30000 - 0x33fff: 16 KB BIOS ROM */ |
| 1487 | 1487 | /* 0x34000 - 0x387ff: 18 KB external floppy / network ROM controllers */ |
| 1488 | 1488 | |
| 1489 | /* messram_get_ptr( | |
| 1489 | /* messram_get_ptr(m | |
| 1490 | 1490 | |
| 1491 | 1491 | ADDRESS_MAP_END |
| 1492 | 1492 | |
| r8453 | r8454 | |
| 1686 | 1686 | /* 0x30000 - 0x33fff: 16 KB BIOS ROM */ |
| 1687 | 1687 | /* 0x34000 - 0x387ff: 18 KB external floppy / network ROM controllers */ |
| 1688 | 1688 | |
| 1689 | /* messram_get_ptr( | |
| 1689 | /* messram_get_ptr(m | |
| 1690 | 1690 | |
| 1691 | 1691 | ADDRESS_MAP_END |
| 1692 | 1692 | |
| r8453 | r8454 | |
| 1848 | 1848 | /* 0x20000 - 0x2ffff: 64 KB BIOS ROM */ |
| 1849 | 1849 | /* 0x30000 - 0x347ff: 16 KB floppy / network ROM controllers */ |
| 1850 | 1850 | |
| 1851 | /* messram_get_ptr( | |
| 1851 | /* messram_get_ptr(m | |
| 1852 | 1852 | |
| 1853 | 1853 | ADDRESS_MAP_END |
| 1854 | 1854 | |
| r8453 | r8454 | |
| 2164 | 2164 | /* 0x20000 - 0x2ffff: 64 KB BIOS ROM */ |
| 2165 | 2165 | /* 0x30000 - 0x347ff: 16 KB floppy / network ROM controllers */ |
| 2166 | 2166 | |
| 2167 | /* messram_get_ptr( | |
| 2167 | /* messram_get_ptr(m | |
| 2168 | 2168 | |
| 2169 | 2169 | ADDRESS_MAP_END |
| 2170 | 2170 |
| r8453 | r8454 | |
|---|---|---|
| 186 | 186 | static void scorpion_update_memory(running_machine *machine) |
| 187 | 187 | { |
| 188 | 188 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 189 | UINT8 *messram = messram_get_ptr( | |
| 189 | UINT8 *messram = messram_get_ptr(m | |
| 190 | 190 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 191 | 191 | |
| 192 | 192 | state->screen_location = messram + ((state->port_7ffd_data & 8) ? (7<<14) : (5<<14)); |
| r8453 | r8454 | |
| 219 | 219 | static DIRECT_UPDATE_HANDLER( scorpion_direct ) |
| 220 | 220 | { |
| 221 | 221 | spectrum_state *state = (spectrum_state *)space->machine->driver_data; |
| 222 | running_device *beta = devtag_get_device(space->machine, BETA_DISK_TAG); | |
| 223 | UINT16 pc = cpu_get_reg(devtag_get_device(space->machine, "maincpu"), STATE_GENPCBASE); | |
| 222 | running_device *beta = space->machine->device(BETA_DISK_TAG); | |
| 223 | UINT16 pc = cpu_get_reg(space->machine->device("maincpu"), STATE_GENPCBASE); | |
| 224 | 224 | |
| 225 | 225 | if (betadisk_is_active(beta)) |
| 226 | 226 | { |
| r8453 | r8454 | |
| 304 | 304 | static MACHINE_RESET( scorpion ) |
| 305 | 305 | { |
| 306 | 306 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 307 | UINT8 *messram = messram_get_ptr(devtag_get_device(machine, "messram")); | |
| 308 | running_device *beta = devtag_get_device(machine, BETA_DISK_TAG); | |
| 307 | UINT8 *messram = messram_get_ptr(machine->device("messram")); | |
| 308 | running_device *beta = machine->device(BETA_DISK_TAG); | |
| 309 | 309 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 310 | 310 | |
| 311 | 311 | memory_install_read_bank (space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| r8453 | r8454 | |
|---|---|---|
| 494 | 494 | abc80_state *state = (abc80_state *)machine->driver_data; |
| 495 | 495 | |
| 496 | 496 | /* configure RAM expansion */ |
| 497 | memory_configure_bank(machine, "bank1", 0, 1, messram_get_ptr( | |
| 497 | memory_configure_bank(machine, "bank1", 0, 1, messram_get_ptr(m | |
| 498 | 498 | memory_set_bank(machine, "bank1", 0); |
| 499 | 499 | |
| 500 | switch (messram_get_size( | |
| 500 | switch (messram_get_size(m | |
| 501 | 501 | { |
| 502 | 502 | case 16*1024: |
| 503 | 503 | memory_unmap_readwrite(cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0); |
| r8453 | r8454 | |
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | /* find devices */ |
| 512 | state->z80pio = devtag_get_device(machine, Z80PIO_TAG); | |
| 513 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 512 | state->z80pio = machine->device(Z80PIO_TAG); | |
| 513 | state->cassette = machine->device(CASSETTE_TAG); | |
| 514 | 514 | |
| 515 | 515 | /* register for state saving */ |
| 516 | 516 | state_save_register_global(machine, state->key_data); |
| r8453 | r8454 | |
|---|---|---|
| 60 | 60 | |
| 61 | 61 | static READ8_HANDLER( zexall_output_ack_r ) |
| 62 | 62 | { |
| 63 | running_device *devconf = | |
| 63 | running_device *devconf = | |
| 64 | 64 | // spit out the byte in out_byte if out_req is not equal to out_req_last |
| 65 | 65 | if (zexall.out_req != zexall.out_req_last) |
| 66 | 66 | { |
| r8453 | r8454 | |
|---|---|---|
| 295 | 295 | WRITE8_HANDLER(spectrum_port_fe_w) |
| 296 | 296 | { |
| 297 | 297 | spectrum_state *state = (spectrum_state *)space->machine->driver_data; |
| 298 | running_device *speaker = | |
| 298 | running_device *speaker = | |
| 299 | 299 | unsigned char Changed; |
| 300 | 300 | |
| 301 | 301 | Changed = state->port_fe_data^data; |
| r8453 | r8454 | |
| 316 | 316 | if ((Changed & (1<<3))!=0) |
| 317 | 317 | { |
| 318 | 318 | /* write cassette data */ |
| 319 | cassette_output( | |
| 319 | cassette_output( | |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | state->port_fe_data = data; |
| r8453 | r8454 | |
| 326 | 326 | { |
| 327 | 327 | /* Hack for correct handling 0xffff interrupt vector */ |
| 328 | 328 | if (address == 0x0001) |
| 329 | if (cpu_get_reg( | |
| 329 | if (cpu_get_reg( | |
| 330 | 330 | { |
| 331 | cpu_set_reg( | |
| 331 | cpu_set_reg( | |
| 332 | 332 | return 0xfff4; |
| 333 | 333 | } |
| 334 | 334 | return address; |
| r8453 | r8454 | |
| 392 | 392 | data |= (0xe0); /* Set bits 5-7 - as reset above */ |
| 393 | 393 | |
| 394 | 394 | /* cassette input from wav */ |
| 395 | if (cassette_input( | |
| 395 | if (cassette_input( | |
| 396 | 396 | { |
| 397 | 397 | data &= ~0x40; |
| 398 | 398 | } |
| r8453 | r8454 | |
| 624 | 624 | { |
| 625 | 625 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 626 | 626 | |
| 627 | switch (messram_get_size( | |
| 627 | switch (messram_get_size(m | |
| 628 | 628 | { |
| 629 | 629 | case 48*1024: |
| 630 | 630 | memory_install_ram(space, 0x8000, 0xffff, 0, 0, NULL); // Fall through |
| r8453 | r8454 | |
|---|---|---|
| 354 | 354 | { |
| 355 | 355 | // halt-LED; the red one, is turned on when the processor is halted |
| 356 | 356 | // TODO: processor seems to halt, but restarts(?) at 0x0000 after a while -> fix |
| 357 | INT64 led_halt = cpu_get_reg( | |
| 357 | INT64 led_halt = cpu_get_reg(m | |
| 358 | 358 | set_led_status(machine, 1, led_halt); |
| 359 | 359 | } |
| 360 | 360 | |
| r8453 | r8454 | |
| 363 | 363 | mpf1_state *state = (mpf1_state *)machine->driver_data; |
| 364 | 364 | |
| 365 | 365 | /* find devices */ |
| 366 | state->speaker = devtag_get_device(machine, SPEAKER_TAG); | |
| 367 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 366 | state->speaker = machine->device(SPEAKER_TAG); | |
| 367 | state->cassette = machine->device(CASSETTE_TAG); | |
| 368 | 368 | |
| 369 | 369 | state->led_refresh_timer = timer_alloc(machine, led_refresh, 0); |
| 370 | 370 |
| r8453 | r8454 | |
|---|---|---|
| 278 | 278 | static MACHINE_RESET(cat) |
| 279 | 279 | { |
| 280 | 280 | cat_state *state = (cat_state *)machine->driver_data; |
| 281 | cpu_set_irq_callback( | |
| 281 | cpu_set_irq_callback(m | |
| 282 | 282 | timer_adjust_periodic(state->keyboard_timer, attotime_zero, 0, ATTOTIME_IN_HZ(120)); |
| 283 | 283 | } |
| 284 | 284 |
| r8453 | r8454 | |
|---|---|---|
| 1454 | 1454 | const address_space *program = cputag_get_address_space(machine, M68000_TAG, ADDRESS_SPACE_PROGRAM); |
| 1455 | 1455 | UINT8 *RAM = memory_region(machine, M68000_TAG); |
| 1456 | 1456 | |
| 1457 | switch (messram_get_size( | |
| 1457 | switch (messram_get_size(m | |
| 1458 | 1458 | { |
| 1459 | 1459 | case 256 * 1024: |
| 1460 | 1460 | memory_install_readwrite_bank(program, 0x000008, 0x03ffff, 0, 0, "bank1"); |
| r8453 | r8454 | |
| 1524 | 1524 | atarist_configure_memory(machine); |
| 1525 | 1525 | |
| 1526 | 1526 | /* set CPU interrupt callback */ |
| 1527 | cpu_set_irq_callback( | |
| 1527 | cpu_set_irq_callback(m | |
| 1528 | 1528 | |
| 1529 | 1529 | /* find devices */ |
| 1530 | state->mc68901 = devtag_get_device(machine, MC68901_TAG); | |
| 1531 | state->wd1772 = devtag_get_device(machine, WD1772_TAG); | |
| 1532 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); | |
| 1533 | state->rs232 = devtag_get_device(machine, RS232_TAG); | |
| 1530 | state->mc68901 = machine->device(MC68901_TAG); | |
| 1531 | state->wd1772 = machine->device(WD1772_TAG); | |
| 1532 | state->centronics = machine->device(CENTRONICS_TAG); | |
| 1533 | state->rs232 = machine->device(RS232_TAG); | |
| 1534 | 1534 | |
| 1535 | 1535 | /* register for state saving */ |
| 1536 | 1536 | atarist_state_save(machine); |
| r8453 | r8454 | |
| 1622 | 1622 | atarist_configure_memory(machine); |
| 1623 | 1623 | |
| 1624 | 1624 | /* set CPU interrupt callback */ |
| 1625 | cpu_set_irq_callback( | |
| 1625 | cpu_set_irq_callback(m | |
| 1626 | 1626 | |
| 1627 | 1627 | /* allocate timers */ |
| 1628 | 1628 | state->dmasound_timer = timer_alloc(machine, atariste_dmasound_tick, NULL); |
| 1629 | 1629 | state->microwire_timer = timer_alloc(machine, atariste_microwire_tick, NULL); |
| 1630 | 1630 | |
| 1631 | 1631 | /* find devices */ |
| 1632 | state->mc68901 = devtag_get_device(machine, MC68901_TAG); | |
| 1633 | state->wd1772 = devtag_get_device(machine, WD1772_TAG); | |
| 1634 | state->lmc1992 = devtag_get_device(machine, LMC1992_TAG); | |
| 1635 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); | |
| 1636 | state->rs232 = devtag_get_device(machine, RS232_TAG); | |
| 1632 | state->mc68901 = machine->device(MC68901_TAG); | |
| 1633 | state->wd1772 = machine->device(WD1772_TAG); | |
| 1634 | state->lmc1992 = machine->device(LMC1992_TAG); | |
| 1635 | state->centronics = machine->device(CENTRONICS_TAG); | |
| 1636 | state->rs232 = machine->device(RS232_TAG); | |
| 1637 | 1637 | |
| 1638 | 1638 | /* register for state saving */ |
| 1639 | 1639 | atariste_state_save(machine); |
| r8453 | r8454 | |
| 1653 | 1653 | const address_space *program = cputag_get_address_space(machine, M68000_TAG, ADDRESS_SPACE_PROGRAM); |
| 1654 | 1654 | UINT8 *RAM = memory_region(machine, M68000_TAG); |
| 1655 | 1655 | |
| 1656 | switch (messram_get_size( | |
| 1656 | switch (messram_get_size(m | |
| 1657 | 1657 | { |
| 1658 | 1658 | case 1024 * 1024: |
| 1659 | 1659 | memory_install_readwrite_bank(program, 0x000008, 0x07ffff, 0, 0x080000, "bank1"); |
| r8453 | r8454 | |
| 1778 | 1778 | stbook_configure_memory(machine); |
| 1779 | 1779 | |
| 1780 | 1780 | /* set CPU interrupt callback */ |
| 1781 | cpu_set_irq_callback( | |
| 1781 | cpu_set_irq_callback(m | |
| 1782 | 1782 | |
| 1783 | 1783 | /* find devices */ |
| 1784 | state->mc68901 = devtag_get_device(machine, MC68901_TAG); | |
| 1785 | state->wd1772 = devtag_get_device(machine, WD1772_TAG); | |
| 1786 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); | |
| 1787 | state->rs232 = devtag_get_device(machine, RS232_TAG); | |
| 1784 | state->mc68901 = machine->device(MC68901_TAG); | |
| 1785 | state->wd1772 = machine->device(WD1772_TAG); | |
| 1786 | state->centronics = machine->device(CENTRONICS_TAG); | |
| 1787 | state->rs232 = machine->device(RS232_TAG); | |
| 1788 | 1788 | |
| 1789 | 1789 | /* register for state saving */ |
| 1790 | 1790 | atariste_state_save(machine); |
| r8453 | r8454 | |
|---|---|---|
| 997 | 997 | sg1000_state *state = (sg1000_state *)machine->driver_data; |
| 998 | 998 | |
| 999 | 999 | /* find devices */ |
| 1000 | state->cassette = | |
| 1000 | state->cassette = m | |
| 1001 | 1001 | |
| 1002 | 1002 | /* configure VDP */ |
| 1003 | 1003 | TMS9928A_configure(&tms9928a_interface); |
| r8453 | r8454 | |
| 1030 | 1030 | sg1000_state *state = (sg1000_state *)machine->driver_data; |
| 1031 | 1031 | |
| 1032 | 1032 | /* find devices */ |
| 1033 | state->upd765 = devtag_get_device(machine, UPD765_TAG); | |
| 1034 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 1035 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); | |
| 1033 | state->upd765 = machine->device(UPD765_TAG); | |
| 1034 | state->cassette = machine->device(CASSETTE_TAG); | |
| 1035 | state->centronics = machine->device(CENTRONICS_TAG); | |
| 1036 | 1036 | |
| 1037 | 1037 | /* configure VDP */ |
| 1038 | 1038 | TMS9928A_configure(&tms9928a_interface); |
| r8453 | r8454 | |
| 1042 | 1042 | |
| 1043 | 1043 | /* configure memory banking */ |
| 1044 | 1044 | memory_configure_bank(machine, "bank1", 0, 1, memory_region(machine, Z80_TAG), 0); |
| 1045 | memory_configure_bank(machine, "bank1", 1, 1, messram_get_ptr(devtag_get_device(machine, "messram")), 0); | |
| 1046 | memory_configure_bank(machine, "bank2", 0, 1, messram_get_ptr(devtag_get_device(machine, "messram")), 0); | |
| 1045 | memory_configure_bank(machine, "bank1", 1, 1, messram_get_ptr(machine->device("messram")), 0); | |
| 1046 | memory_configure_bank(machine, "bank2", 0, 1, messram_get_ptr(machine->device("messram")), 0); | |
| 1047 | 1047 | |
| 1048 | 1048 | /* register for state saving */ |
| 1049 | 1049 | state_save_register_global(machine, state->keylatch); |
| r8453 | r8454 | |
|---|---|---|
| 69 | 69 | va_start( v, s_fmt ); |
| 70 | 70 | vsprintf( buf, s_fmt, v ); |
| 71 | 71 | va_end( v ); |
| 72 | logerror("%08x: %s", cpu_get_pc( | |
| 72 | logerror("%08x: %s", cpu_get_pc(m | |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| r8453 | r8454 | |
| 186 | 186 | |
| 187 | 187 | static READ32_HANDLER( hpc3_pbus6_r ) |
| 188 | 188 | { |
| 189 | running_device *lpt = | |
| 189 | running_device *lpt = | |
| 190 | 190 | UINT8 ret8; |
| 191 | 191 | running_machine *machine = space->machine; |
| 192 | 192 | |
| r8453 | r8454 | |
| 237 | 237 | // mame_printf_info("INT3: r @ %x mask %08x (PC=%x)\n", offset*4, mem_mask, activecpu_get_pc()); |
| 238 | 238 | return int3_regs[offset-0x80/4]; |
| 239 | 239 | case 0xb0/4: |
| 240 | ret8 = pit8253_r( | |
| 240 | ret8 = pit8253_r(m | |
| 241 | 241 | verboselog( machine, 0, "HPC PBUS6 IOC4 Timer Counter 0 Register Read: 0x%02x (%08x)\n", ret8, mem_mask ); |
| 242 | 242 | return ret8; |
| 243 | 243 | case 0xb4/4: |
| 244 | ret8 = pit8253_r( | |
| 244 | ret8 = pit8253_r(m | |
| 245 | 245 | verboselog( machine, 0, "HPC PBUS6 IOC4 Timer Counter 1 Register Read: 0x%02x (%08x)\n", ret8, mem_mask ); |
| 246 | 246 | return ret8; |
| 247 | 247 | case 0xb8/4: |
| 248 | ret8 = pit8253_r( | |
| 248 | ret8 = pit8253_r(m | |
| 249 | 249 | verboselog( machine, 0, "HPC PBUS6 IOC4 Timer Counter 2 Register Read: 0x%02x (%08x)\n", ret8, mem_mask ); |
| 250 | 250 | return ret8; |
| 251 | 251 | case 0xbc/4: |
| 252 | ret8 = pit8253_r( | |
| 252 | ret8 = pit8253_r(m | |
| 253 | 253 | verboselog( machine, 0, "HPC PBUS6 IOC4 Timer Control Word Register Read: 0x%02x (%08x)\n", ret8, mem_mask ); |
| 254 | 254 | return ret8; |
| 255 | 255 | default: |
| r8453 | r8454 | |
| 261 | 261 | |
| 262 | 262 | static WRITE32_HANDLER( hpc3_pbus6_w ) |
| 263 | 263 | { |
| 264 | running_device *lpt = | |
| 264 | running_device *lpt = | |
| 265 | 265 | char cChar; |
| 266 | 266 | running_machine *machine = space->machine; |
| 267 | 267 | |
| r8453 | r8454 | |
| 343 | 343 | break; |
| 344 | 344 | case 0xb0/4: |
| 345 | 345 | verboselog( machine, 0, "HPC PBUS6 IOC4 Timer Counter 0 Register Write: 0x%08x (%08x)\n", data, mem_mask ); |
| 346 | pit8253_w( | |
| 346 | pit8253_w(m | |
| 347 | 347 | return; |
| 348 | 348 | case 0xb4/4: |
| 349 | 349 | verboselog( machine, 0, "HPC PBUS6 IOC4 Timer Counter 1 Register Write: 0x%08x (%08x)\n", data, mem_mask ); |
| 350 | pit8253_w( | |
| 350 | pit8253_w(m | |
| 351 | 351 | return; |
| 352 | 352 | case 0xb8/4: |
| 353 | 353 | verboselog( machine, 0, "HPC PBUS6 IOC4 Timer Counter 2 Register Write: 0x%08x (%08x)\n", data, mem_mask ); |
| 354 | pit8253_w( | |
| 354 | pit8253_w(m | |
| 355 | 355 | return; |
| 356 | 356 | case 0xbc/4: |
| 357 | 357 | verboselog( machine, 0, "HPC PBUS6 IOC4 Timer Control Word Register Write: 0x%08x (%08x)\n", data, mem_mask ); |
| 358 | pit8253_w( | |
| 358 | pit8253_w(m | |
| 359 | 359 | return; |
| 360 | 360 | default: |
| 361 | 361 | verboselog( machine, 0, "Unknown HPC PBUS6 Write: 0x%08x: 0x%08x (%08x)\n", 0x1fbd9800 + ( offset << 2 ), data, mem_mask ); |
| r8453 | r8454 | |
| 1041 | 1041 | UINT16 temp16 = ( ip22_mainram[(nPBUS_DMA_CurPtr - 0x08000000)/4] & 0xffff0000 ) >> 16; |
| 1042 | 1042 | INT16 stemp16 = (INT16)((temp16 >> 8) | (temp16 << 8)); |
| 1043 | 1043 | |
| 1044 | dac_signed_data_16_w( | |
| 1044 | dac_signed_data_16_w(m | |
| 1045 | 1045 | |
| 1046 | 1046 | nPBUS_DMA_CurPtr += 4; |
| 1047 | 1047 | |
| r8453 | r8454 | |
| 1205 | 1205 | |
| 1206 | 1206 | nPBUS_DMA_Active = 0; |
| 1207 | 1207 | |
| 1208 | mips3drc_set_options( | |
| 1208 | mips3drc_set_options(m | |
| 1209 | 1209 | } |
| 1210 | 1210 | |
| 1211 | 1211 | static void dump_chain(const address_space *space, UINT32 ch_base) |
| r8453 | r8454 | |
| 1341 | 1341 | |
| 1342 | 1342 | dump_chain(space, nHPC_SCSI0Descriptor); |
| 1343 | 1343 | |
| 1344 | printf("PC is %08x\n", cpu_get_pc( | |
| 1344 | printf("PC is %08x\n", cpu_get_pc(m | |
| 1345 | 1345 | printf("DMA to device: length %x xie %d eox %d\n", length, xie, eox); |
| 1346 | 1346 | |
| 1347 | 1347 | if (length <= 0x4000) |
| r8453 | r8454 | |
| 1488 | 1488 | } |
| 1489 | 1489 | |
| 1490 | 1490 | static int ip22_get_out2(running_machine *machine) { |
| 1491 | return pit8253_get_output( | |
| 1491 | return pit8253_get_output(m | |
| 1492 | 1492 | } |
| 1493 | 1493 | |
| 1494 | 1494 | static MACHINE_START( ip22 ) |
| r8453 | r8454 | |
|---|---|---|
| 300 | 300 | eti660_state *state = (eti660_state *)machine->driver_data; |
| 301 | 301 | |
| 302 | 302 | /* find devices */ |
| 303 | state->cdp1864 = devtag_get_device(machine, CDP1864_TAG); | |
| 304 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 303 | state->cdp1864 = machine->device(CDP1864_TAG); | |
| 304 | state->cassette = machine->device(CASSETTE_TAG); | |
| 305 | 305 | |
| 306 | 306 | /* register for state saving */ |
| 307 | 307 | state_save_register_global(machine, state->cdp1802_mode); |
| r8453 | r8454 | |
|---|---|---|
| 87 | 87 | { |
| 88 | 88 | px8_state *state = (px8_state *)machine->driver_data; |
| 89 | 89 | const address_space *program = cputag_get_address_space(machine, UPD70008_TAG, ADDRESS_SPACE_PROGRAM); |
| 90 | UINT8 *ram = messram_get_ptr( | |
| 90 | UINT8 *ram = messram_get_ptr(m | |
| 91 | 91 | UINT8 *ipl_rom = memory_region(machine, UPD70008_TAG); |
| 92 | 92 | |
| 93 | 93 | if (!state->bank0) |
| r8453 | r8454 | |
| 824 | 824 | px8_state *state = (px8_state *)machine->driver_data; |
| 825 | 825 | |
| 826 | 826 | /* find devices */ |
| 827 | state->sed1320 = devtag_get_device(machine, SED1320_TAG); | |
| 828 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 827 | state->sed1320 = machine->device(SED1320_TAG); | |
| 828 | state->cassette = machine->device(CASSETTE_TAG); | |
| 829 | 829 | |
| 830 | 830 | /* register for state saving */ |
| 831 | 831 | state_save_register_global(machine, state->ier); |
| r8453 | r8454 | |
|---|---|---|
| 340 | 340 | phc25_state *state = (phc25_state *)machine->driver_data; |
| 341 | 341 | |
| 342 | 342 | /* find devices */ |
| 343 | state->mc6847 = devtag_get_device(machine, MC6847_TAG); | |
| 344 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); | |
| 345 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 343 | state->mc6847 = machine->device(MC6847_TAG); | |
| 344 | state->centronics = machine->device(CENTRONICS_TAG); | |
| 345 | state->cassette = machine->device(CASSETTE_TAG); | |
| 346 | 346 | |
| 347 | 347 | /* register for state saving */ |
| 348 | 348 | // state_save_register_global(machine, state->); |
| r8453 | r8454 | |
|---|---|---|
| 689 | 689 | const address_space *program = cputag_get_address_space(machine, I8085A_TAG, ADDRESS_SPACE_PROGRAM); |
| 690 | 690 | |
| 691 | 691 | /* look up devices */ |
| 692 | state->i8212 = devtag_get_device(machine, I8212_TAG); | |
| 693 | state->i8237 = devtag_get_device(machine, I8237_TAG); | |
| 694 | state->i8275 = devtag_get_device(machine, I8275_TAG); | |
| 695 | state->upd765 = devtag_get_device(machine, UPD765_TAG); | |
| 696 | state->upd7201 = devtag_get_device(machine, UPD7201_TAG); | |
| 697 | state->upd7220 = devtag_get_device(machine, UPD7220_TAG); | |
| 698 | state->speaker = devtag_get_device(machine, SPEAKER_TAG); | |
| 692 | state->i8212 = machine->device(I8212_TAG); | |
| 693 | state->i8237 = machine->device(I8237_TAG); | |
| 694 | state->i8275 = machine->device(I8275_TAG); | |
| 695 | state->upd765 = machine->device(UPD765_TAG); | |
| 696 | state->upd7201 = machine->device(UPD7201_TAG); | |
| 697 | state->upd7220 = machine->device(UPD7220_TAG); | |
| 698 | state->speaker = machine->device(SPEAKER_TAG); | |
| 699 | 699 | |
| 700 | 700 | /* find memory regions */ |
| 701 | 701 | state->key_rom = memory_region(machine, "keyboard"); |
| r8453 | r8454 | |
| 704 | 704 | memory_install_read_bank(program, 0x0000, 0x0fff, 0, 0, "bank1"); |
| 705 | 705 | memory_unmap_write(program, 0x0000, 0x0fff, 0, 0); |
| 706 | 706 | memory_configure_bank(machine, "bank1", 0, 1, memory_region(machine, "bios"), 0); |
| 707 | memory_configure_bank(machine, "bank1", 1, 1, messram_get_ptr( | |
| 707 | memory_configure_bank(machine, "bank1", 1, 1, messram_get_ptr(m | |
| 708 | 708 | memory_set_bank(machine, "bank1", 0); |
| 709 | 709 | |
| 710 | 710 | /* register for state saving */ |
| r8453 | r8454 | |
|---|---|---|
| 327 | 327 | return 0x38; |
| 328 | 328 | |
| 329 | 329 | if(offset & 1) |
| 330 | return i8255a_r( | |
| 330 | return i8255a_r( | |
| 331 | 331 | |
| 332 | 332 | logerror("RS-232c R access %02x\n",offset >> 1); |
| 333 | 333 | return 0xff; |
| r8453 | r8454 | |
| 337 | 337 | static WRITE8_HANDLER( sys_port_w ) |
| 338 | 338 | { |
| 339 | 339 | if(offset & 1) |
| 340 | i8255a_w( | |
| 340 | i8255a_w( | |
| 341 | 341 | else |
| 342 | 342 | logerror("RS-232c W access %02x %02x\n",offset >> 1,data); |
| 343 | 343 | } |
| r8453 | r8454 | |
| 345 | 345 | static READ8_HANDLER( sio_port_r ) |
| 346 | 346 | { |
| 347 | 347 | if(!(offset & 1)) |
| 348 | return i8255a_r( | |
| 348 | return i8255a_r( | |
| 349 | 349 | |
| 350 | 350 | logerror("keyboard R access %02x\n",offset >> 1); |
| 351 | 351 | return 0xff; |
| r8453 | r8454 | |
| 355 | 355 | static WRITE8_HANDLER( sio_port_w ) |
| 356 | 356 | { |
| 357 | 357 | if(!(offset & 1)) |
| 358 | i8255a_w( | |
| 358 | i8255a_w( | |
| 359 | 359 | else |
| 360 | 360 | logerror("keyboard W access %02x %02x\n",offset >> 1,data); |
| 361 | 361 | } |
| r8453 | r8454 | |
| 476 | 476 | if(offset & 1) |
| 477 | 477 | { |
| 478 | 478 | logerror("pit port $70 R access %02x\n",offset >> 1); |
| 479 | return pit8253_r( | |
| 479 | return pit8253_r( | |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | logerror("crtc port $70 R access %02x\n",offset >> 1); |
| r8453 | r8454 | |
| 488 | 488 | if(offset & 1) |
| 489 | 489 | { |
| 490 | 490 | logerror("pit port $70 W access %02x %02x\n",offset >> 1,data); |
| 491 | pit8253_w( | |
| 491 | pit8253_w( | |
| 492 | 492 | } |
| 493 | 493 | else |
| 494 | 494 | logerror("crtc port $70 W access %02x %02x\n",offset >> 1,data); |
| r8453 | r8454 | |
| 499 | 499 | if(!(offset & 1)) |
| 500 | 500 | { |
| 501 | 501 | logerror("pic8259 port $00 R access %02x\n",offset >> 1); |
| 502 | return pic8259_r( | |
| 502 | return pic8259_r( | |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | //logerror("DMA port $00 R access %02x\n",offset >> 1); |
| 506 | return i8237_r( | |
| 506 | return i8237_r( | |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | static WRITE8_HANDLER( port_00_w ) |
| r8453 | r8454 | |
| 511 | 511 | if(!(offset & 1)) |
| 512 | 512 | { |
| 513 | 513 | logerror("pic8259 port $00 W access %02x %02x\n",offset >> 1,data); |
| 514 | pic8259_w( | |
| 514 | pic8259_w( | |
| 515 | 515 | } |
| 516 | 516 | else |
| 517 | 517 | { |
| 518 | 518 | //logerror("DMA port $00 W access %02x %02x\n",offset >> 1,data); |
| 519 | i8237_w( | |
| 519 | i8237_w( | |
| 520 | 520 | } |
| 521 | 521 | } |
| 522 | 522 | |
| r8453 | r8454 | |
| 649 | 649 | static IRQ_CALLBACK(irq_callback) |
| 650 | 650 | { |
| 651 | 651 | int r = 0; |
| 652 | r = pic8259_acknowledge( dev | |
| 652 | r = pic8259_acknowledge( dev | |
| 653 | 653 | if (r==0) |
| 654 | 654 | { |
| 655 | r = pic8259_acknowledge( dev | |
| 655 | r = pic8259_acknowledge( dev | |
| 656 | 656 | //printf("%02x ACK\n",r); |
| 657 | 657 | } |
| 658 | 658 | return r; |
| r8453 | r8454 | |
| 665 | 665 | { |
| 666 | 666 | UINT8 *ROM = memory_region(machine, "cpudata"); |
| 667 | 667 | |
| 668 | cpu_set_irq_callback( | |
| 668 | cpu_set_irq_callback(m | |
| 669 | 669 | |
| 670 | 670 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_A20, 0); |
| 671 | 671 | |
| 672 | 672 | gate_a20 = 0; |
| 673 | cpu_set_reg( | |
| 673 | cpu_set_reg(m | |
| 674 | 674 | |
| 675 | 675 | memory_set_bankptr(machine, "bank1", &ROM[0x20000]); |
| 676 | 676 | |
| r8453 | r8454 | |
| 681 | 681 | static MACHINE_RESET(pc9821) |
| 682 | 682 | { |
| 683 | 683 | UINT8 *ROM = memory_region(machine, "cpudata"); |
| 684 | cpu_set_irq_callback( | |
| 684 | cpu_set_irq_callback(m | |
| 685 | 685 | |
| 686 | 686 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_A20, 0); |
| 687 | 687 | |
| 688 | 688 | gate_a20 = 0; |
| 689 | cpu_set_reg( | |
| 689 | cpu_set_reg(m | |
| 690 | 690 | |
| 691 | 691 | memory_set_bankptr(machine, "bank1", &ROM[0x20000]); |
| 692 | 692 |
| r8453 | r8454 | |
|---|---|---|
| 214 | 214 | |
| 215 | 215 | static VIDEO_UPDATE( p2000t ) |
| 216 | 216 | { |
| 217 | running_device *saa5050 = | |
| 217 | running_device *saa5050 = | |
| 218 | 218 | |
| 219 | 219 | saa5050_update(saa5050, bitmap, NULL); |
| 220 | 220 | return 0; |
| r8453 | r8454 | |
|---|---|---|
| 192 | 192 | void spectrum_128_update_memory(running_machine *machine) |
| 193 | 193 | { |
| 194 | 194 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 195 | UINT8 *messram = messram_get_ptr( | |
| 195 | UINT8 *messram = messram_get_ptr(m | |
| 196 | 196 | unsigned char *ChosenROM; |
| 197 | 197 | int ROMSelection; |
| 198 | 198 | |
| r8453 | r8454 | |
| 255 | 255 | static MACHINE_RESET( spectrum_128 ) |
| 256 | 256 | { |
| 257 | 257 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 258 | UINT8 *messram = messram_get_ptr( | |
| 258 | UINT8 *messram = messram_get_ptr(m | |
| 259 | 259 | |
| 260 | 260 | memset(messram,0,128*1024); |
| 261 | 261 | /* 0x0000-0x3fff always holds ROM */ |
| r8453 | r8454 | |
|---|---|---|
| 639 | 639 | |
| 640 | 640 | static VIDEO_UPDATE( pet_crtc ) |
| 641 | 641 | { |
| 642 | running_device *mc6845 = | |
| 642 | running_device *mc6845 = | |
| 643 | 643 | mc6845_update(mc6845, bitmap, cliprect); |
| 644 | 644 | return 0; |
| 645 | 645 | } |
| r8453 | r8454 | |
|---|---|---|
| 685 | 685 | static void modeFV_switch(running_machine *machine, UINT16 offset, UINT8 data) |
| 686 | 686 | { |
| 687 | 687 | //printf("ModeFV %04x\n",offset); |
| 688 | if (!FVlocked && ( cpu_get_pc( | |
| 688 | if (!FVlocked && ( cpu_get_pc(m | |
| 689 | 689 | { |
| 690 | 690 | FVlocked = 1; |
| 691 | 691 | current_bank = current_bank ^ 0x01; |
| r8453 | r8454 | |
| 702 | 702 | current_bank ^= 1; |
| 703 | 703 | break; |
| 704 | 704 | default: |
| 705 | printf("%04X: write to unknown mapper address %02X\n", cpu_get_pc( | |
| 705 | printf("%04X: write to unknown mapper address %02X\n", cpu_get_pc(m | |
| 706 | 706 | break; |
| 707 | 707 | } |
| 708 | 708 | bank_base[1] = CART + 0x1000 * current_bank; |
| r8453 | r8454 | |
| 782 | 782 | { |
| 783 | 783 | UINT8 data = ( offset & 0x800 ) ? bank_base[2][offset & 0x7FF] : bank_base[1][offset]; |
| 784 | 784 | |
| 785 | //logerror("%04X: read from modeSS area offset = %04X\n", cpu_get_pc( | |
| 785 | //logerror("%04X: read from modeSS area offset = %04X\n", cpu_get_pc( | |
| 786 | 786 | /* Check for control register "write" */ |
| 787 | 787 | if ( offset == 0xFF8 ) |
| 788 | 788 | { |
| 789 | //logerror("%04X: write to modeSS control register data = %02X\n", cpu_get_pc( | |
| 789 | //logerror("%04X: write to modeSS control register data = %02X\n", cpu_get_pc( | |
| 790 | 790 | modeSS_write_enabled = modeSS_byte & 0x02; |
| 791 | 791 | modeSS_write_delay = modeSS_byte >> 5; |
| 792 | 792 | switch ( modeSS_byte & 0x1C ) |
| r8453 | r8454 | |
| 838 | 838 | else if ( offset == 0xFF9 ) |
| 839 | 839 | { |
| 840 | 840 | /* Cassette port read */ |
| 841 | double tap_val = cassette_input( devtag_get_device(space->machine, "cassette") ); | |
| 842 | //logerror("%04X: Cassette port read, tap_val = %f\n", cpu_get_pc(devtag_get_device(space->machine, "maincpu")), tap_val); | |
| 841 | double tap_val = cassette_input( space->machine->device("cassette") ); | |
| 842 | //logerror("%04X: Cassette port read, tap_val = %f\n", cpu_get_pc(space->machine->device("maincpu")), tap_val); | |
| 843 | 843 | if ( tap_val < 0 ) |
| 844 | 844 | { |
| 845 | 845 | data = 0x00; |
| r8453 | r8454 | |
| 855 | 855 | if ( modeSS_write_enabled ) |
| 856 | 856 | { |
| 857 | 857 | int diff = space->machine->device<cpu_device>("maincpu")->total_cycles() - modeSS_byte_started; |
| 858 | //logerror("%04X: offset = %04X, %d\n", cpu_get_pc( | |
| 858 | //logerror("%04X: offset = %04X, %d\n", cpu_get_pc( | |
| 859 | 859 | if ( diff - modeSS_diff_adjust == 5 ) |
| 860 | 860 | { |
| 861 | //logerror("%04X: RAM write offset = %04X, data = %02X\n", cpu_get_pc( | |
| 861 | //logerror("%04X: RAM write offset = %04X, data = %02X\n", cpu_get_pc( | |
| 862 | 862 | if ( offset & 0x800 ) |
| 863 | 863 | { |
| 864 | 864 | if ( modeSS_high_ram_enabled ) |
| r8453 | r8454 | |
| 896 | 896 | } |
| 897 | 897 | /* Because the mame core caches opcode data and doesn't perform reads like normal */ |
| 898 | 898 | /* we have to put in this little hack here to get Suicide Mission to work. */ |
| 899 | if ( offset != 0xFF8 && ( cpu_get_pc( | |
| 899 | if ( offset != 0xFF8 && ( cpu_get_pc( | |
| 900 | 900 | { |
| 901 | 901 | modeSS_r( space, 0xFF8 ); |
| 902 | 902 | } |
| r8453 | r8454 | |
| 960 | 960 | UINT8 data_fetcher = offset & 0x07; |
| 961 | 961 | UINT8 data = 0xFF; |
| 962 | 962 | |
| 963 | logerror("%04X: Read from DPC offset $%02X\n", cpu_get_pc( | |
| 963 | logerror("%04X: Read from DPC offset $%02X\n", cpu_get_pc( | |
| 964 | 964 | if ( offset < 0x08 ) |
| 965 | 965 | { |
| 966 | 966 | switch( offset & 0x06 ) |
| r8453 | r8454 | |
| 1067 | 1067 | dpc.movamt = data; |
| 1068 | 1068 | break; |
| 1069 | 1069 | case 0x28: /* Not used */ |
| 1070 | logerror("%04X: Write to unused DPC register $%02X, data $%02X\n", cpu_get_pc( | |
| 1070 | logerror("%04X: Write to unused DPC register $%02X, data $%02X\n", cpu_get_pc( | |
| 1071 | 1071 | break; |
| 1072 | 1072 | case 0x30: /* Random number generator reset */ |
| 1073 | 1073 | dpc.shift_reg = 0; |
| 1074 | 1074 | break; |
| 1075 | 1075 | case 0x38: /* Not used */ |
| 1076 | logerror("%04X: Write to unused DPC register $%02X, data $%02X\n", cpu_get_pc( | |
| 1076 | logerror("%04X: Write to unused DPC register $%02X, data $%02X\n", cpu_get_pc( | |
| 1077 | 1077 | break; |
| 1078 | 1078 | } |
| 1079 | 1079 | } |
| r8453 | r8454 | |
| 1165 | 1165 | keypad_right_column = data & 0x0F; |
| 1166 | 1166 | break; |
| 1167 | 1167 | case 0x0a: /* KidVid voice module */ |
| 1168 | cassette_change_state( | |
| 1168 | cassette_change_state( m | |
| 1169 | 1169 | break; |
| 1170 | 1170 | } |
| 1171 | 1171 | } |
| r8453 | r8454 | |
| 1473 | 1473 | UINT16 last_address, prev_address; |
| 1474 | 1474 | UINT8 last_byte, prev_byte; |
| 1475 | 1475 | |
| 1476 | last_address = cpu_get_pc( | |
| 1476 | last_address = cpu_get_pc( | |
| 1477 | 1477 | if ( ! ( last_address & 0x1080 ) ) |
| 1478 | 1478 | { |
| 1479 | 1479 | return offset; |
| r8453 | r8454 | |
| 1873 | 1873 | modeSS_byte_started = 0; |
| 1874 | 1874 | memory_set_direct_update_handler(space, modeSS_opbase ); |
| 1875 | 1875 | /* The Supercharger has no motor control so just enable it */ |
| 1876 | cassette_change_state( | |
| 1876 | cassette_change_state( m | |
| 1877 | 1877 | break; |
| 1878 | 1878 | |
| 1879 | 1879 | case modeFV: |
| r8453 | r8454 | |
| 1938 | 1938 | } |
| 1939 | 1939 | |
| 1940 | 1940 | /* Banks may have changed, reset the cpu so it uses the correct reset vector */ |
| 1941 | | |
| 1941 | m | |
| 1942 | 1942 | } |
| 1943 | 1943 | |
| 1944 | 1944 |
| r8453 | r8454 | |
|---|---|---|
| 257 | 257 | memory_install_read_bank(space,block * 0x04000 + 0x0000, block * 0x04000 + 0x3fff, 0, 0,block_name); |
| 258 | 258 | // LOG(("MEM: read block %i -> bank %i\n",block,bank)); |
| 259 | 259 | } |
| 260 | memory_set_bankptr(machine, block_name, messram_get_ptr( | |
| 260 | memory_set_bankptr(machine, block_name, messram_get_ptr(m | |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | |
| r8453 | r8454 | |
| 267 | 267 | char block_name[10]; |
| 268 | 268 | |
| 269 | 269 | sprintf(block_name,"bank%d",block+5); |
| 270 | memory_set_bankptr(machine, block_name, messram_get_ptr( | |
| 270 | memory_set_bankptr(machine, block_name, messram_get_ptr(m | |
| 271 | 271 | // LOG(("MEM: write block %i -> bank %i\n",block,bank)); |
| 272 | 272 | } |
| 273 | 273 | |
| r8453 | r8454 | |
| 420 | 420 | |
| 421 | 421 | static WRITE8_HANDLER(pcw_system_control_w) |
| 422 | 422 | { |
| 423 | running_device *fdc = devtag_get_device(space->machine, "upd765"); | |
| 424 | running_device *speaker = devtag_get_device(space->machine, "beep"); | |
| 423 | running_device *fdc = space->machine->device("upd765"); | |
| 424 | running_device *speaker = space->machine->device("beep"); | |
| 425 | 425 | LOG(("SYSTEM CONTROL: %d\n",data)); |
| 426 | 426 | |
| 427 | 427 | switch (data) |
| r8453 | r8454 | |
| 639 | 639 | |
| 640 | 640 | static READ8_HANDLER(pcw_fdc_r) |
| 641 | 641 | { |
| 642 | running_device *fdc = | |
| 642 | running_device *fdc = | |
| 643 | 643 | /* from Jacob Nevins docs. FDC I/O is not fully decoded */ |
| 644 | 644 | if (offset & 1) |
| 645 | 645 | { |
| r8453 | r8454 | |
| 651 | 651 | |
| 652 | 652 | static WRITE8_HANDLER(pcw_fdc_w) |
| 653 | 653 | { |
| 654 | running_device *fdc = | |
| 654 | running_device *fdc = | |
| 655 | 655 | /* from Jacob Nevins docs. FDC I/O is not fully decoded */ |
| 656 | 656 | if (offset & 1) |
| 657 | 657 | { |
| r8453 | r8454 | |
| 730 | 730 | |
| 731 | 731 | static TIMER_CALLBACK(setup_beep) |
| 732 | 732 | { |
| 733 | running_device *speaker = | |
| 733 | running_device *speaker = m | |
| 734 | 734 | beep_set_state(speaker, 0); |
| 735 | 735 | beep_set_frequency(speaker, 3750); |
| 736 | 736 | } |
| r8453 | r8454 | |
| 760 | 760 | /* copy boot code into RAM - yes, it's skipping a step, |
| 761 | 761 | but there is no verified dump of the boot sequence */ |
| 762 | 762 | |
| 763 | memset(messram_get_ptr( | |
| 763 | memset(messram_get_ptr(m | |
| 764 | 764 | for(x=0;x<256;x++) |
| 765 | messram_get_ptr( | |
| 765 | messram_get_ptr(m | |
| 766 | 766 | |
| 767 | 767 | } |
| 768 | 768 | |
| r8453 | r8454 | |
| 770 | 770 | { |
| 771 | 771 | pcw_boot = 0; |
| 772 | 772 | |
| 773 | cpu_set_input_line_vector( | |
| 773 | cpu_set_input_line_vector(m | |
| 774 | 774 | |
| 775 | 775 | |
| 776 | 776 | /* lower 4 bits are interrupt counter */ |
| r8453 | r8454 | |
|---|---|---|
| 147 | 147 | |
| 148 | 148 | static WRITE8_DEVICE_HANDLER( mk2_write_b ) |
| 149 | 149 | { |
| 150 | running_device *dac_device = dev | |
| 150 | running_device *dac_device = dev | |
| 151 | 151 | |
| 152 | 152 | if ((data&0x06)==0x06) |
| 153 | 153 | dac_data_w(dac_device,data&1?80:0); |
| r8453 | r8454 | |
|---|---|---|
| 449 | 449 | c16_state *state = (c16_state *)machine->driver_data; |
| 450 | 450 | |
| 451 | 451 | state->maincpu = machine->device<legacy_cpu_device>("maincpu"); |
| 452 | state->ted7360 = devtag_get_device(machine, "ted7360"); | |
| 453 | state->serbus = devtag_get_device(machine, "iec"); | |
| 454 | state->cassette = devtag_get_device(machine, "cassette"); | |
| 455 | state->messram = devtag_get_device(machine, "messram"); | |
| 456 | state->sid = devtag_get_device(machine, "sid"); | |
| 452 | state->ted7360 = machine->device("ted7360"); | |
| 453 | state->serbus = machine->device("iec"); | |
| 454 | state->cassette = machine->device("cassette"); | |
| 455 | state->messram = machine->device("messram"); | |
| 456 | state->sid = machine->device("sid"); | |
| 457 | 457 | |
| 458 | 458 | state_save_register_global(machine, state->old_level); |
| 459 | 459 | state_save_register_global(machine, state->lowrom); |
| r8453 | r8454 | |
|---|---|---|
| 407 | 407 | |
| 408 | 408 | static WRITE_LINE_DEVICE_HANDLER( studio2_q_w ) |
| 409 | 409 | { |
| 410 | running_device *speaker = dev | |
| 410 | running_device *speaker = dev | |
| 411 | 411 | beep_set_state(speaker, state); |
| 412 | 412 | } |
| 413 | 413 | |
| r8453 | r8454 | |
| 470 | 470 | studio2_state *state = (studio2_state *)machine->driver_data; |
| 471 | 471 | |
| 472 | 472 | /* find devices */ |
| 473 | state->cdp1861 = | |
| 473 | state->cdp1861 = m | |
| 474 | 474 | |
| 475 | 475 | /* register for state saving */ |
| 476 | 476 | state_save_register_global(machine, state->cdp1802_mode); |
| r8453 | r8454 | |
| 495 | 495 | studio2_state *state = (studio2_state *)machine->driver_data; |
| 496 | 496 | |
| 497 | 497 | /* find devices */ |
| 498 | state->cdp1864 = | |
| 498 | state->cdp1864 = m | |
| 499 | 499 | |
| 500 | 500 | /* register for state saving */ |
| 501 | 501 | state_save_register_global(machine, state->cdp1802_mode); |
| r8453 | r8454 | |
| 643 | 643 | |
| 644 | 644 | static TIMER_CALLBACK( setup_beep ) |
| 645 | 645 | { |
| 646 | running_device *speaker = | |
| 646 | running_device *speaker = m | |
| 647 | 647 | beep_set_state(speaker, 0); |
| 648 | 648 | beep_set_frequency(speaker, 300); |
| 649 | 649 | } |
| r8453 | r8454 | |
|---|---|---|
| 250 | 250 | |
| 251 | 251 | static WRITE8_HANDLER( osi600_keyboard_w ) |
| 252 | 252 | { |
| 253 | running_device *discrete = | |
| 253 | running_device *discrete = | |
| 254 | 254 | osi_state *state = (osi_state *)space->machine->driver_data; |
| 255 | 255 | |
| 256 | 256 | state->keylatch = data; |
| r8453 | r8454 | |
| 282 | 282 | |
| 283 | 283 | */ |
| 284 | 284 | |
| 285 | running_device *discrete = | |
| 285 | running_device *discrete = | |
| 286 | 286 | osi_state *state = (osi_state *)space->machine->driver_data; |
| 287 | 287 | |
| 288 | 288 | state->_32 = BIT(data, 0); |
| r8453 | r8454 | |
| 293 | 293 | |
| 294 | 294 | static WRITE8_HANDLER( osi630_ctrl_w ) |
| 295 | 295 | { |
| 296 | running_device *speaker = | |
| 296 | running_device *speaker = | |
| 297 | 297 | /* |
| 298 | 298 | |
| 299 | 299 | bit description |
| r8453 | r8454 | |
| 314 | 314 | |
| 315 | 315 | static WRITE8_HANDLER( osi630_sound_w ) |
| 316 | 316 | { |
| 317 | running_device *speaker = | |
| 317 | running_device *speaker = | |
| 318 | 318 | if (data) beep_set_frequency(speaker, 49152/data); |
| 319 | 319 | } |
| 320 | 320 | |
| r8453 | r8454 | |
| 670 | 670 | const address_space *program = cputag_get_address_space(machine, M6502_TAG, ADDRESS_SPACE_PROGRAM); |
| 671 | 671 | |
| 672 | 672 | /* find devices */ |
| 673 | state->cassette = | |
| 673 | state->cassette = m | |
| 674 | 674 | |
| 675 | 675 | /* configure RAM banking */ |
| 676 | 676 | memory_configure_bank(machine, "bank1", 0, 1, memory_region(machine, M6502_TAG), 0); |
| 677 | 677 | memory_set_bank(machine, "bank1", 0); |
| 678 | 678 | |
| 679 | switch (messram_get_size( | |
| 679 | switch (messram_get_size(m | |
| 680 | 680 | { |
| 681 | 681 | case 4*1024: |
| 682 | 682 | memory_install_readwrite_bank(program, 0x0000, 0x0fff, 0, 0, "bank1"); |
| r8453 | r8454 | |
| 700 | 700 | const address_space *program = cputag_get_address_space(machine, M6502_TAG, ADDRESS_SPACE_PROGRAM); |
| 701 | 701 | |
| 702 | 702 | /* find devices */ |
| 703 | state->cassette = | |
| 703 | state->cassette = m | |
| 704 | 704 | |
| 705 | 705 | /* configure RAM banking */ |
| 706 | 706 | memory_configure_bank(machine, "bank1", 0, 1, memory_region(machine, M6502_TAG), 0); |
| 707 | 707 | memory_set_bank(machine, "bank1", 0); |
| 708 | 708 | |
| 709 | switch (messram_get_size( | |
| 709 | switch (messram_get_size(m | |
| 710 | 710 | { |
| 711 | 711 | case 8*1024: |
| 712 | 712 | memory_install_readwrite_bank(program, 0x0000, 0x1fff, 0, 0, "bank1"); |
| r8453 | r8454 | |
| 923 | 923 | |
| 924 | 924 | static TIMER_CALLBACK( setup_beep ) |
| 925 | 925 | { |
| 926 | running_device *speaker = | |
| 926 | running_device *speaker = m | |
| 927 | 927 | beep_set_state(speaker, 0); |
| 928 | 928 | beep_set_frequency(speaker, 300); |
| 929 | 929 | } |
| r8453 | r8454 | |
|---|---|---|
| 15 | 15 | |
| 16 | 16 | static WRITE16_HANDLER(dual68_terminal_w) |
| 17 | 17 | { |
| 18 | running_device *devconf = | |
| 18 | running_device *devconf = | |
| 19 | 19 | terminal_write(devconf,0,data >> 8); |
| 20 | 20 | } |
| 21 | 21 | |
| r8453 | r8454 | |
| 49 | 49 | |
| 50 | 50 | memcpy((UINT8*)dual68_ram,user1,0x2000); |
| 51 | 51 | |
| 52 | | |
| 52 | m | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | static WRITE8_DEVICE_HANDLER( dual68_kbd_put ) |
| r8453 | r8454 | |
|---|---|---|
| 20 | 20 | |
| 21 | 21 | static WRITE8_HANDLER (rt1717_set_bank ) |
| 22 | 22 | { |
| 23 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr(devtag_get_device(space->machine, "messram"))); | |
| 24 | memory_set_bankptr(space->machine, "bank3", messram_get_ptr(devtag_get_device(space->machine, "messram"))); | |
| 23 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr(space->machine->device("messram"))); | |
| 24 | memory_set_bankptr(space->machine, "bank3", messram_get_ptr(space->machine->device("messram"))); | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /* Address maps */ |
| r8453 | r8454 | |
|---|---|---|
| 180 | 180 | |
| 181 | 181 | static MACHINE_START(ex800) |
| 182 | 182 | { |
| 183 | running_device *speaker = | |
| 183 | running_device *speaker = m | |
| 184 | 184 | /* Setup beep */ |
| 185 | 185 | beep_set_state(speaker, 0); |
| 186 | 186 | beep_set_frequency(speaker, 4000); /* measured at 4000 Hz */ |
| r8453 | r8454 | |
| 239 | 239 | |
| 240 | 240 | static WRITE8_HANDLER(ex800_portc_w) |
| 241 | 241 | { |
| 242 | running_device *speaker = | |
| 242 | running_device *speaker = | |
| 243 | 243 | if (data & 0x80) |
| 244 | 244 | beep_set_state(speaker, 0); |
| 245 | 245 | else |
| r8453 | r8454 | |
|---|---|---|
| 74 | 74 | UINT8 edit2_state = input_port_read(field->port->machine, "EDIT2"); |
| 75 | 75 | UINT8 edit3_state = input_port_read(field->port->machine, "EDIT3"); |
| 76 | 76 | UINT8 misc_state = input_port_read(field->port->machine, "MISC"); |
| 77 | running_device *ssem_cpu = | |
| 77 | running_device *ssem_cpu = | |
| 78 | 78 | |
| 79 | 79 | switch( (int)(FPTR)param ) |
| 80 | 80 | { |
| r8453 | r8454 | |
| 431 | 431 | static VIDEO_UPDATE( ssem ) |
| 432 | 432 | { |
| 433 | 433 | UINT32 line = 0; |
| 434 | running_device *ssem_cpu = | |
| 434 | running_device *ssem_cpu = | |
| 435 | 435 | UINT32 accum = cpu_get_reg(ssem_cpu, SSEM_A); |
| 436 | 436 | UINT32 bit = 0; |
| 437 | 437 | UINT32 word = 0; |
| r8453 | r8454 | |
|---|---|---|
| 27 | 27 | |
| 28 | 28 | static MACHINE_RESET(ipb) |
| 29 | 29 | { |
| 30 | cpu_set_reg( | |
| 30 | cpu_set_reg(m | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | static VIDEO_START( ipb ) |
| r8453 | r8454 | |
|---|---|---|
| 1104 | 1104 | const address_space *program = cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM); |
| 1105 | 1105 | |
| 1106 | 1106 | /* find devices */ |
| 1107 | state->i8214 = devtag_get_device(machine, UPB8214_TAG); | |
| 1108 | state->msm58321 = devtag_get_device(machine, MSM58321RS_TAG); | |
| 1109 | state->i8255a_crt_z80 = devtag_get_device(machine, I8255A_DISP_TAG); | |
| 1110 | state->i8255a_crt_m6502 = devtag_get_device(machine, I8255A_M6502_TAG); | |
| 1111 | state->i8251_kb = devtag_get_device(machine, I8251A_KB_TAG); | |
| 1112 | state->i8251_sio = devtag_get_device(machine, I8251A_SIO_TAG); | |
| 1107 | state->i8214 = machine->device(UPB8214_TAG); | |
| 1108 | state->msm58321 = machine->device(MSM58321RS_TAG); | |
| 1109 | state->i8255a_crt_z80 = machine->device(I8255A_DISP_TAG); | |
| 1110 | state->i8255a_crt_m6502 = machine->device(I8255A_M6502_TAG); | |
| 1111 | state->i8251_kb = machine->device(I8251A_KB_TAG); | |
| 1112 | state->i8251_sio = machine->device(I8251A_SIO_TAG); | |
| 1113 | 1113 | state->timer_sio = machine->device<timer_device>(TIMER_SIO_TAG); |
| 1114 | state->mb8877 = devtag_get_device(machine, MB8877_TAG); | |
| 1115 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); | |
| 1114 | state->mb8877 = machine->device(MB8877_TAG); | |
| 1115 | state->centronics = machine->device(CENTRONICS_TAG); | |
| 1116 | 1116 | |
| 1117 | 1117 | /* initialize I8214 */ |
| 1118 | 1118 | i8214_etlg_w(state->i8214, 1); |
| r8453 | r8454 | |
| 1122 | 1122 | msm58321_cs1_w(state->msm58321, 1); |
| 1123 | 1123 | |
| 1124 | 1124 | /* set CPU interrupt callback */ |
| 1125 | cpu_set_irq_callback( | |
| 1125 | cpu_set_irq_callback(m | |
| 1126 | 1126 | |
| 1127 | 1127 | /* setup memory banking */ |
| 1128 | memory_configure_bank(machine, "bank1", 0, 2, messram_get_ptr(devtag_get_device(machine, "messram")), 0x10000); | |
| 1129 | memory_configure_bank(machine, "bank1", 2, 1, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x1c000, 0); | |
| 1128 | memory_configure_bank(machine, "bank1", 0, 2, messram_get_ptr(machine->device("messram")), 0x10000); | |
| 1129 | memory_configure_bank(machine, "bank1", 2, 1, messram_get_ptr(machine->device("messram")) + 0x1c000, 0); | |
| 1130 | 1130 | memory_configure_bank(machine, "bank1", 3, 1, memory_region(machine, Z80_TAG), 0); |
| 1131 | 1131 | |
| 1132 | 1132 | memory_install_readwrite_bank(program, 0x2000, 0x3fff, 0, 0, "bank2"); |
| 1133 | memory_configure_bank(machine, "bank2", 0, 2, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x2000, 0x10000); | |
| 1134 | memory_configure_bank(machine, "bank2", 2, 1, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x1e000, 0); | |
| 1133 | memory_configure_bank(machine, "bank2", 0, 2, messram_get_ptr(machine->device("messram")) + 0x2000, 0x10000); | |
| 1134 | memory_configure_bank(machine, "bank2", 2, 1, messram_get_ptr(machine->device("messram")) + 0x1e000, 0); | |
| 1135 | 1135 | |
| 1136 | 1136 | memory_install_readwrite_bank(program, 0x4000, 0x7fff, 0, 0, "bank3"); |
| 1137 | memory_configure_bank(machine, "bank3", 0, 2, messram_get_ptr( | |
| 1137 | memory_configure_bank(machine, "bank3", 0, 2, messram_get_ptr(m | |
| 1138 | 1138 | |
| 1139 | 1139 | memory_install_readwrite_bank(program, 0x8000, 0xbfff, 0, 0, "bank4"); |
| 1140 | memory_configure_bank(machine, "bank4", 0, 2, messram_get_ptr( | |
| 1140 | memory_configure_bank(machine, "bank4", 0, 2, messram_get_ptr(m | |
| 1141 | 1141 | |
| 1142 | 1142 | memory_install_readwrite_bank(program, 0xc000, 0xffff, 0, 0, "bank5"); |
| 1143 | memory_configure_bank(machine, "bank5", 0, 3, messram_get_ptr( | |
| 1143 | memory_configure_bank(machine, "bank5", 0, 3, messram_get_ptr(m | |
| 1144 | 1144 | |
| 1145 | 1145 | v1050_bankswitch(machine); |
| 1146 | 1146 |
| r8453 | r8454 | |
|---|---|---|
| 410 | 410 | |
| 411 | 411 | memcpy((UINT8*)chrom_ram,user1,8); |
| 412 | 412 | |
| 413 | | |
| 413 | m | |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | /*************************************************************************** |
| r8453 | r8454 | |
|---|---|---|
| 105 | 105 | |
| 106 | 106 | */ |
| 107 | 107 | |
| 108 | running_device *speaker = | |
| 108 | running_device *speaker = | |
| 109 | 109 | ql_state *state = (ql_state *)space->machine->driver_data; |
| 110 | 110 | |
| 111 | 111 | int ipl = (BIT(data, 2) << 1) | BIT(data, 3); |
| r8453 | r8454 | |
| 472 | 472 | |
| 473 | 473 | static READ8_HANDLER( ql_ram_r ) |
| 474 | 474 | { |
| 475 | return messram_get_ptr( | |
| 475 | return messram_get_ptr( | |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | static WRITE8_HANDLER( ql_ram_w ) |
| 479 | 479 | { |
| 480 | messram_get_ptr( | |
| 480 | messram_get_ptr( | |
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | static ZX8301_INTERFACE( ql_zx8301_intf ) |
| r8453 | r8454 | |
| 540 | 540 | |
| 541 | 541 | /* configure RAM */ |
| 542 | 542 | |
| 543 | switch (messram_get_size( | |
| 543 | switch (messram_get_size(m | |
| 544 | 544 | { |
| 545 | 545 | case 128*1024: |
| 546 | 546 | memory_unmap_readwrite(program, 0x040000, 0x0fffff, 0, 0); |
| r8453 | r8454 | |
| 576 | 576 | |
| 577 | 577 | // find devices |
| 578 | 578 | |
| 579 | state->zx8301 = devtag_get_device(machine, ZX8301_TAG); | |
| 580 | state->zx8302 = devtag_get_device(machine, ZX8302_TAG); | |
| 579 | state->zx8301 = machine->device(ZX8301_TAG); | |
| 580 | state->zx8302 = machine->device(ZX8302_TAG); | |
| 581 | 581 | |
| 582 | 582 | // register for state saving |
| 583 | 583 | |
| r8453 | r8454 | |
| 903 | 903 | |
| 904 | 904 | static QUICKLOAD_LOAD( ql ) |
| 905 | 905 | { |
| 906 | image.fread(messram_get_ptr( | |
| 906 | image.fread(messram_get_ptr( | |
| 907 | 907 | |
| 908 | 908 | return IMAGE_INIT_PASS; |
| 909 | 909 | } |
| r8453 | r8454 | |
|---|---|---|
| 23 | 23 | |
| 24 | 24 | static MACHINE_RESET(vt220) |
| 25 | 25 | { |
| 26 | memset(messram_get_ptr( | |
| 26 | memset(messram_get_ptr(m | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | static VIDEO_START( vt220 ) |
| r8453 | r8454 | |
|---|---|---|
| 48 | 48 | |
| 49 | 49 | static READ16_HANDLER( amiga_clock_r ) |
| 50 | 50 | { |
| 51 | running_device *rtc = | |
| 51 | running_device *rtc = | |
| 52 | 52 | return msm6242_r(rtc, offset / 2); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | static WRITE16_HANDLER( amiga_clock_w ) |
| 57 | 57 | { |
| 58 | running_device *rtc = | |
| 58 | running_device *rtc = | |
| 59 | 59 | msm6242_w(rtc, offset / 2, data); |
| 60 | 60 | } |
| 61 | 61 | |
| r8453 | r8454 | |
| 494 | 494 | static READ8_DEVICE_HANDLER( amiga_cia_0_portA_r ) |
| 495 | 495 | { |
| 496 | 496 | UINT8 ret = input_port_read(device->machine, "CIA0PORTA") & 0xc0; /* Gameport 1 and 0 buttons */ |
| 497 | ret |= amiga_fdc_status_r(dev | |
| 497 | ret |= amiga_fdc_status_r(dev | |
| 498 | 498 | return ret; |
| 499 | 499 | } |
| 500 | 500 | |
| r8453 | r8454 | |
| 563 | 563 | |
| 564 | 564 | static UINT16 amiga_read_dskbytr(running_machine *machine) |
| 565 | 565 | { |
| 566 | return amiga_fdc_get_byte( | |
| 566 | return amiga_fdc_get_byte(m | |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | static void amiga_write_dsklen(running_machine *machine, UINT16 data) |
| 570 | 570 | { |
| 571 | 571 | if ( data & 0x8000 ) { |
| 572 | 572 | if ( CUSTOM_REG(REG_DSKLEN) & 0x8000 ) |
| 573 | amiga_fdc_setup_dma( | |
| 573 | amiga_fdc_setup_dma(m | |
| 574 | 574 | } |
| 575 | 575 | } |
| 576 | 576 |
| r8453 | r8454 | |
|---|---|---|
| 15 | 15 | |
| 16 | 16 | static WRITE16_HANDLER(isbc_terminal_w) |
| 17 | 17 | { |
| 18 | running_device *devconf = | |
| 18 | running_device *devconf = | |
| 19 | 19 | terminal_write(devconf,0,data); |
| 20 | 20 | } |
| 21 | 21 |
| r8453 | r8454 | |
|---|---|---|
| 86 | 86 | |
| 87 | 87 | static running_device *cassette_device_image(running_machine *machine) |
| 88 | 88 | { |
| 89 | return | |
| 89 | return m | |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /* Discrete Sound */ |
| r8453 | r8454 | |
| 248 | 248 | { |
| 249 | 249 | abc806_state *state = (abc806_state *)machine->driver_data; |
| 250 | 250 | const address_space *program = cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM); |
| 251 | UINT32 videoram_mask = messram_get_size( | |
| 251 | UINT32 videoram_mask = messram_get_size(m | |
| 252 | 252 | int bank; |
| 253 | 253 | char bank_name[10]; |
| 254 | 254 | |
| r8453 | r8454 | |
| 414 | 414 | |
| 415 | 415 | static READ8_HANDLER( abc800_pling_r ) |
| 416 | 416 | { |
| 417 | running_device *discrete = | |
| 417 | running_device *discrete = | |
| 418 | 418 | abc800_state *state = (abc800_state *)space->machine->driver_data; |
| 419 | 419 | |
| 420 | 420 | state->pling = !state->pling; |
| r8453 | r8454 | |
| 426 | 426 | |
| 427 | 427 | static READ8_HANDLER( abc802_pling_r ) |
| 428 | 428 | { |
| 429 | running_device *discrete = | |
| 429 | running_device *discrete = | |
| 430 | 430 | abc802_state *state = (abc802_state *)space->machine->driver_data; |
| 431 | 431 | |
| 432 | 432 | state->pling = !state->pling; |
| r8453 | r8454 | |
| 708 | 708 | |
| 709 | 709 | static TIMER_DEVICE_CALLBACK( ctc_tick ) |
| 710 | 710 | { |
| 711 | running_device *z80ctc = | |
| 711 | running_device *z80ctc = | |
| 712 | 712 | |
| 713 | 713 | z80ctc_trg0_w(z80ctc, 1); |
| 714 | 714 | z80ctc_trg0_w(z80ctc, 0); |
| r8453 | r8454 | |
| 722 | 722 | |
| 723 | 723 | static WRITE_LINE_DEVICE_HANDLER( ctc_z0_w ) |
| 724 | 724 | { |
| 725 | //running_device *z80sio = dev | |
| 725 | //running_device *z80sio = dev | |
| 726 | 726 | |
| 727 | 727 | UINT8 sb = input_port_read(device->machine, "SB"); |
| 728 | 728 | |
| r8453 | r8454 | |
| 744 | 744 | |
| 745 | 745 | static WRITE_LINE_DEVICE_HANDLER( ctc_z1_w ) |
| 746 | 746 | { |
| 747 | //running_device *z80sio = dev | |
| 747 | //running_device *z80sio = dev | |
| 748 | 748 | |
| 749 | 749 | UINT8 sb = input_port_read(device->machine, "SB"); |
| 750 | 750 | |
| r8453 | r8454 | |
| 764 | 764 | |
| 765 | 765 | static WRITE_LINE_DEVICE_HANDLER( ctc_z2_w ) |
| 766 | 766 | { |
| 767 | running_device *z80dart = dev | |
| 767 | running_device *z80dart = dev | |
| 768 | 768 | |
| 769 | 769 | /* connected to DART channel A clock inputs */ |
| 770 | 770 | z80dart_rxca_w(z80dart, state); |
| r8453 | r8454 | |
| 947 | 947 | abc800_state *state = (abc800_state *)machine->driver_data; |
| 948 | 948 | |
| 949 | 949 | /* find devices */ |
| 950 | state->z80ctc = devtag_get_device(machine, Z80CTC_TAG); | |
| 951 | state->z80dart = devtag_get_device(machine, Z80DART_TAG); | |
| 952 | state->z80sio = devtag_get_device(machine, Z80SIO_TAG); | |
| 953 | state->abc77 = devtag_get_device(machine, ABC77_TAG); | |
| 954 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 950 | state->z80ctc = machine->device(Z80CTC_TAG); | |
| 951 | state->z80dart = machine->device(Z80DART_TAG); | |
| 952 | state->z80sio = machine->device(Z80SIO_TAG); | |
| 953 | state->abc77 = machine->device(ABC77_TAG); | |
| 954 | state->cassette = machine->device(CASSETTE_TAG); | |
| 955 | 955 | |
| 956 | 956 | /* register for state saving */ |
| 957 | 957 | state_save_register_global(machine, state->fetch_charram); |
| r8453 | r8454 | |
| 971 | 971 | abc802_state *state = (abc802_state *)machine->driver_data; |
| 972 | 972 | |
| 973 | 973 | /* find devices */ |
| 974 | state->z80ctc = devtag_get_device(machine, Z80CTC_TAG); | |
| 975 | state->z80dart = devtag_get_device(machine, Z80DART_TAG); | |
| 976 | state->z80sio = devtag_get_device(machine, Z80SIO_TAG); | |
| 977 | state->abc77 = devtag_get_device(machine, ABC77_TAG); | |
| 978 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 974 | state->z80ctc = machine->device(Z80CTC_TAG); | |
| 975 | state->z80dart = machine->device(Z80DART_TAG); | |
| 976 | state->z80sio = machine->device(Z80SIO_TAG); | |
| 977 | state->abc77 = machine->device(ABC77_TAG); | |
| 978 | state->cassette = machine->device(CASSETTE_TAG); | |
| 979 | 979 | |
| 980 | 980 | /* configure memory */ |
| 981 | memory_configure_bank(machine, "bank1", 0, 1, messram_get_ptr( | |
| 981 | memory_configure_bank(machine, "bank1", 0, 1, messram_get_ptr(m | |
| 982 | 982 | memory_configure_bank(machine, "bank1", 1, 1, memory_region(machine, Z80_TAG), 0); |
| 983 | 983 | |
| 984 | 984 | /* register for state saving */ |
| r8453 | r8454 | |
| 1013 | 1013 | abc806_state *state = (abc806_state *)machine->driver_data; |
| 1014 | 1014 | |
| 1015 | 1015 | UINT8 *mem = memory_region(machine, Z80_TAG); |
| 1016 | UINT32 videoram_size = messram_get_size( | |
| 1016 | UINT32 videoram_size = messram_get_size(m | |
| 1017 | 1017 | int bank; |
| 1018 | 1018 | char bank_name[10]; |
| 1019 | 1019 | |
| 1020 | 1020 | /* find devices */ |
| 1021 | state->z80ctc = devtag_get_device(machine, Z80CTC_TAG); | |
| 1022 | state->z80dart = devtag_get_device(machine, Z80DART_TAG); | |
| 1023 | state->z80sio = devtag_get_device(machine, Z80SIO_TAG); | |
| 1024 | state->e0516 = devtag_get_device(machine, E0516_TAG); | |
| 1025 | state->abc77 = devtag_get_device(machine, ABC77_TAG); | |
| 1026 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 1021 | state->z80ctc = machine->device(Z80CTC_TAG); | |
| 1022 | state->z80dart = machine->device(Z80DART_TAG); | |
| 1023 | state->z80sio = machine->device(Z80SIO_TAG); | |
| 1024 | state->e0516 = machine->device(E0516_TAG); | |
| 1025 | state->abc77 = machine->device(ABC77_TAG); | |
| 1026 | state->cassette = machine->device(CASSETTE_TAG); | |
| 1027 | 1027 | |
| 1028 | 1028 | /* setup memory banking */ |
| 1029 | 1029 | state->videoram = auto_alloc_array(machine, UINT8, videoram_size); |
| r8453 | r8454 | |
| 1397 | 1397 | } |
| 1398 | 1398 | else |
| 1399 | 1399 | { |
| 1400 | direct->raw = direct->decrypted = messram_get_ptr( | |
| 1400 | direct->raw = direct->decrypted = messram_get_ptr( | |
| 1401 | 1401 | return ~0; |
| 1402 | 1402 | } |
| 1403 | 1403 |
| r8453 | r8454 | |
|---|---|---|
| 91 | 91 | } |
| 92 | 92 | else |
| 93 | 93 | { |
| 94 | memory_set_bankptr(machine, "bank1", messram_get_ptr( | |
| 94 | memory_set_bankptr(machine, "bank1", messram_get_ptr(m | |
| 95 | 95 | } |
| 96 | 96 | if (state->memcmos) |
| 97 | 97 | { |
| r8453 | r8454 | |
| 99 | 99 | } |
| 100 | 100 | else |
| 101 | 101 | { |
| 102 | memory_set_bankptr(machine, "bank2", messram_get_ptr( | |
| 102 | memory_set_bankptr(machine, "bank2", messram_get_ptr(m | |
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| r8453 | r8454 | |
| 456 | 456 | { |
| 457 | 457 | qx10_state *state = (qx10_state *)machine->driver_data; |
| 458 | 458 | |
| 459 | cpu_set_irq_callback( | |
| 459 | cpu_set_irq_callback(m | |
| 460 | 460 | |
| 461 | 461 | mc146818_init(machine, MC146818_STANDARD); |
| 462 | 462 | compis_init( &i82720_interface ); |
| 463 | 463 | |
| 464 | 464 | // find devices |
| 465 | state->pic8259_master = devtag_get_device(machine, "pic8259_master"); | |
| 466 | state->pic8259_slave = devtag_get_device(machine, "pic8259_slave"); | |
| 467 | state->dma8237_1 = devtag_get_device(machine, "8237dma_1"); | |
| 468 | state->upd765 = devtag_get_device(machine, "upd765"); | |
| 465 | state->pic8259_master = machine->device("pic8259_master"); | |
| 466 | state->pic8259_slave = machine->device("pic8259_slave"); | |
| 467 | state->dma8237_1 = machine->device("8237dma_1"); | |
| 468 | state->upd765 = machine->device("upd765"); | |
| 469 | 469 | |
| 470 | 470 | } |
| 471 | 471 |
| r8453 | r8454 | |
|---|---|---|
| 31 | 31 | break; |
| 32 | 32 | case 0x10 : // RAM selected |
| 33 | 33 | memory_install_readwrite_bank(space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 34 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr( | |
| 34 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr(m | |
| 35 | 35 | break; |
| 36 | 36 | } |
| 37 | 37 | // Bank 2 is always RAM |
| 38 | memory_set_bankptr(space->machine, "bank2", messram_get_ptr( | |
| 38 | memory_set_bankptr(space->machine, "bank2", messram_get_ptr(m | |
| 39 | 39 | if ((data & 0x20)==0) { |
| 40 | 40 | // Video RAM |
| 41 | memory_set_bankptr(space->machine, "bank3", messram_get_ptr( | |
| 41 | memory_set_bankptr(space->machine, "bank3", messram_get_ptr(m | |
| 42 | 42 | } else { |
| 43 | 43 | // System RAM page 3 |
| 44 | memory_set_bankptr(space->machine, "bank3", messram_get_ptr( | |
| 44 | memory_set_bankptr(space->machine, "bank3", messram_get_ptr(m | |
| 45 | 45 | } |
| 46 | 46 | switch(data & 0xc0) { |
| 47 | 47 | case 0x00 : // Cart ROM selected |
| r8453 | r8454 | |
| 56 | 56 | break; |
| 57 | 57 | case 0x80 : // RAM selected |
| 58 | 58 | memory_install_readwrite_bank(space, 0xc000, 0xffff, 0, 0, "bank4"); |
| 59 | memory_set_bankptr(space->machine, "bank4", messram_get_ptr( | |
| 59 | memory_set_bankptr(space->machine, "bank4", messram_get_ptr(m | |
| 60 | 60 | break; |
| 61 | 61 | case 0xc0 : // External ROM selected |
| 62 | 62 | memory_install_read_bank(space, 0xc000, 0xffff, 0, 0, "bank4"); |
| r8453 | r8454 | |
| 237 | 237 | |
| 238 | 238 | static MACHINE_RESET(tvc) |
| 239 | 239 | { |
| 240 | memset(messram_get_ptr( | |
| 240 | memset(messram_get_ptr(m | |
| 241 | 241 | tvc_set_mem_page(machine, 0); |
| 242 | 242 | tvc_video_mode = 0; |
| 243 | 243 | } |
| r8453 | r8454 | |
| 248 | 248 | |
| 249 | 249 | static VIDEO_UPDATE( tvc ) |
| 250 | 250 | { |
| 251 | running_device *mc6845 = | |
| 251 | running_device *mc6845 = | |
| 252 | 252 | mc6845_update(mc6845, bitmap, cliprect); |
| 253 | 253 | return 0; |
| 254 | 254 | } |
| r8453 | r8454 | |
| 263 | 263 | for ( i = 0; i < x_count; i++ ) |
| 264 | 264 | { |
| 265 | 265 | UINT16 offset = i + (y * 64); |
| 266 | UINT8 data = messram_get_ptr(dev | |
| 266 | UINT8 data = messram_get_ptr(dev | |
| 267 | 267 | *p = col[(data >> 7)]; p++; |
| 268 | 268 | *p = col[(data >> 6)]; p++; |
| 269 | 269 | *p = col[(data >> 5)]; p++; |
| r8453 | r8454 | |
| 278 | 278 | for ( i = 0; i < x_count; i++ ) |
| 279 | 279 | { |
| 280 | 280 | UINT16 offset = i + (y * 64); |
| 281 | UINT8 data = messram_get_ptr(dev | |
| 281 | UINT8 data = messram_get_ptr(dev | |
| 282 | 282 | *p = col[BIT(data,7)*2 + BIT(data,3)]; p++; |
| 283 | 283 | *p = col[BIT(data,7)*2 + BIT(data,3)]; p++; |
| 284 | 284 | *p = col[BIT(data,6)*2 + BIT(data,2)]; p++; |
| r8453 | r8454 | |
| 293 | 293 | for ( i = 0; i < x_count; i++ ) |
| 294 | 294 | { |
| 295 | 295 | UINT16 offset = i + (y * 64); |
| 296 | UINT8 data = messram_get_ptr(dev | |
| 296 | UINT8 data = messram_get_ptr(dev | |
| 297 | 297 | *p = col[(data >> 4) & 0xf]; p++; |
| 298 | 298 | *p = col[(data >> 4) & 0xf]; p++; |
| 299 | 299 | *p = col[(data >> 4) & 0xf]; p++; |
| r8453 | r8454 | |
|---|---|---|
| 198 | 198 | |
| 199 | 199 | memory_set_bank(device->machine, "bank1", TMC2000_BANK_RAM); |
| 200 | 200 | |
| 201 | switch (messram_get_size(dev | |
| 201 | switch (messram_get_size(dev | |
| 202 | 202 | { |
| 203 | 203 | case 4 * 1024: |
| 204 | 204 | memory_install_readwrite_bank(cputag_get_address_space(device->machine, CDP1802_TAG, ADDRESS_SPACE_PROGRAM), 0x0000, 0x0fff, 0, 0x7000, "bank1"); |
| r8453 | r8454 | |
| 714 | 714 | tmc1800_state *state = (tmc1800_state *)machine->driver_data; |
| 715 | 715 | |
| 716 | 716 | /* find devices */ |
| 717 | state->cdp1861 = devtag_get_device(machine, CDP1861_TAG); | |
| 718 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 717 | state->cdp1861 = machine->device(CDP1861_TAG); | |
| 718 | state->cassette = machine->device(CASSETTE_TAG); | |
| 719 | 719 | |
| 720 | 720 | /* register for state saving */ |
| 721 | 721 | state_save_register_global(machine, state->cdp1861_efx); |
| r8453 | r8454 | |
| 738 | 738 | osc1000b_state *state = (osc1000b_state *)machine->driver_data; |
| 739 | 739 | |
| 740 | 740 | /* find devices */ |
| 741 | state->cassette = | |
| 741 | state->cassette = m | |
| 742 | 742 | |
| 743 | 743 | /* register for state saving */ |
| 744 | 744 | state_save_register_global(machine, state->keylatch); |
| r8453 | r8454 | |
| 773 | 773 | } |
| 774 | 774 | |
| 775 | 775 | /* find devices */ |
| 776 | state->cdp1864 = devtag_get_device(machine, CDP1864_TAG); | |
| 777 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 776 | state->cdp1864 = machine->device(CDP1864_TAG); | |
| 777 | state->cassette = machine->device(CASSETTE_TAG); | |
| 778 | 778 | |
| 779 | 779 | /* register for state saving */ |
| 780 | 780 | state_save_register_global_pointer(machine, state->colorram, TMC2000_COLORRAM_SIZE); |
| r8453 | r8454 | |
| 817 | 817 | state->monitor_ef4 = 1; |
| 818 | 818 | |
| 819 | 819 | /* find devices */ |
| 820 | state->cdp1864 = devtag_get_device(machine, CDP1864_TAG); | |
| 821 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 820 | state->cdp1864 = machine->device(CDP1864_TAG); | |
| 821 | state->cassette = machine->device(CASSETTE_TAG); | |
| 822 | 822 | |
| 823 | 823 | /* register for state saving */ |
| 824 | 824 | state_save_register_global(machine, state->monitor_ef4); |
| r8453 | r8454 | |
| 998 | 998 | UINT8 *ptr = memory_region(image.device().machine, CDP1802_TAG); |
| 999 | 999 | int size = image.length(); |
| 1000 | 1000 | |
| 1001 | if (size > messram_get_size( | |
| 1001 | if (size > messram_get_size( | |
| 1002 | 1002 | { |
| 1003 | 1003 | return IMAGE_INIT_FAIL; |
| 1004 | 1004 | } |
| r8453 | r8454 | |
| 1012 | 1012 | |
| 1013 | 1013 | static TIMER_CALLBACK(setup_beep) |
| 1014 | 1014 | { |
| 1015 | running_device *speaker = | |
| 1015 | running_device *speaker = m | |
| 1016 | 1016 | beep_set_state(speaker, 0); |
| 1017 | 1017 | beep_set_frequency( speaker, 0 ); |
| 1018 | 1018 | } |
| r8453 | r8454 | |
|---|---|---|
| 529 | 529 | crvision_state *state = (crvision_state *)machine->driver_data; |
| 530 | 530 | |
| 531 | 531 | /* find devices */ |
| 532 | state->sn76489 = devtag_get_device(machine, SN76489_TAG); | |
| 533 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 532 | state->sn76489 = machine->device(SN76489_TAG); | |
| 533 | state->cassette = machine->device(CASSETTE_TAG); | |
| 534 | 534 | |
| 535 | 535 | /* register for state saving */ |
| 536 | 536 | state_save_register_global(machine, state->keylatch); |
| r8453 | r8454 | |
|---|---|---|
| 2145 | 2145 | static DRIVER_INIT( towns ) |
| 2146 | 2146 | { |
| 2147 | 2147 | towns_state* state = (towns_state*)machine->driver_data; |
| 2148 | state->pic_master = devtag_get_device(machine,"pic8259_master"); | |
| 2149 | state->pic_slave = devtag_get_device(machine,"pic8259_slave"); | |
| 2148 | state->pic_master = machine->device("pic8259_master"); | |
| 2149 | state->pic_slave = machine->device("pic8259_slave"); | |
| 2150 | 2150 | state->towns_vram = auto_alloc_array(machine,UINT32,0x20000); |
| 2151 | 2151 | state->towns_cmos = machine->generic.nvram.u8; |
| 2152 | 2152 | state->towns_gfxvram = auto_alloc_array(machine,UINT8,0x80000); |
| r8453 | r8454 | |
| 2160 | 2160 | state->towns_mouse_timer = timer_alloc(machine,towns_mouse_timeout,NULL); |
| 2161 | 2161 | |
| 2162 | 2162 | // CD-ROM init |
| 2163 | state->towns_cd.read_timer = timer_alloc(machine,towns_cdrom_read_byte,(void*) | |
| 2163 | state->towns_cd.read_timer = timer_alloc(machine,towns_cdrom_read_byte,(void*)m | |
| 2164 | 2164 | |
| 2165 | cpu_set_irq_callback( | |
| 2165 | cpu_set_irq_callback(m | |
| 2166 | 2166 | } |
| 2167 | 2167 | |
| 2168 | 2168 | static DRIVER_INIT( marty ) |
| r8453 | r8454 | |
| 2175 | 2175 | static MACHINE_RESET( towns ) |
| 2176 | 2176 | { |
| 2177 | 2177 | towns_state* state = (towns_state*)machine->driver_data; |
| 2178 | state->maincpu = devtag_get_device(machine,"maincpu"); | |
| 2179 | state->dma_1 = devtag_get_device(machine,"dma_1"); | |
| 2180 | state->dma_2 = devtag_get_device(machine,"dma_2"); | |
| 2181 | state->fdc = devtag_get_device(machine,"fdc"); | |
| 2182 | state->pic_master = devtag_get_device(machine,"pic8259_master"); | |
| 2183 | state->pic_slave = devtag_get_device(machine,"pic8259_slave"); | |
| 2184 | state->pit = devtag_get_device(machine,"pit"); | |
| 2185 | state->messram = devtag_get_device(machine,"messram"); | |
| 2186 | state->cdrom = devtag_get_device(machine,"cdrom"); | |
| 2187 | state->cdda = devtag_get_device(machine,"cdda"); | |
| 2178 | state->maincpu = machine->device("maincpu"); | |
| 2179 | state->dma_1 = machine->device("dma_1"); | |
| 2180 | state->dma_2 = machine->device("dma_2"); | |
| 2181 | state->fdc = machine->device("fdc"); | |
| 2182 | state->pic_master = machine->device("pic8259_master"); | |
| 2183 | state->pic_slave = machine->device("pic8259_slave"); | |
| 2184 | state->pit = machine->device("pit"); | |
| 2185 | state->messram = machine->device("messram"); | |
| 2186 | state->cdrom = machine->device("cdrom"); | |
| 2187 | state->cdda = machine->device("cdda"); | |
| 2188 | 2188 | state->ftimer = 0x00; |
| 2189 | 2189 | state->nmi_mask = 0x00; |
| 2190 | 2190 | state->compat_mode = 0x00; |
| r8453 | r8454 | |
|---|---|---|
| 277 | 277 | #if 0 |
| 278 | 278 | static READ8_HANDLER( mz2500_fdc_r ) |
| 279 | 279 | { |
| 280 | running_device* dev = | |
| 280 | running_device* dev = | |
| 281 | 281 | //UINT8 ret = 0; |
| 282 | 282 | |
| 283 | 283 | switch(offset+0xd8) |
| r8453 | r8454 | |
| 298 | 298 | |
| 299 | 299 | static WRITE8_HANDLER( mz2500_fdc_w ) |
| 300 | 300 | { |
| 301 | running_device* dev = | |
| 301 | running_device* dev = | |
| 302 | 302 | |
| 303 | 303 | switch(offset+0xdc) |
| 304 | 304 | { |
| r8453 | r8454 | |
|---|---|---|
| 1384 | 1384 | newbrain_state *state = (newbrain_state *)machine->driver_data; |
| 1385 | 1385 | |
| 1386 | 1386 | /* find devices */ |
| 1387 | state->cassette1 = devtag_get_device(machine, CASSETTE1_TAG); | |
| 1388 | state->cassette2 = devtag_get_device(machine, CASSETTE2_TAG); | |
| 1387 | state->cassette1 = machine->device(CASSETTE1_TAG); | |
| 1388 | state->cassette2 = machine->device(CASSETTE2_TAG); | |
| 1389 | 1389 | |
| 1390 | 1390 | /* allocate reset timer */ |
| 1391 | 1391 | state->reset_timer = timer_alloc(machine, reset_tick, NULL); |
| r8453 | r8454 | |
| 1447 | 1447 | state->eim_ram = auto_alloc_array(machine, UINT8, NEWBRAIN_EIM_RAM_SIZE); |
| 1448 | 1448 | |
| 1449 | 1449 | /* find devices */ |
| 1450 | state->z80ctc = devtag_get_device(machine, Z80CTC_TAG); | |
| 1451 | state->mc6850 = devtag_get_device(machine, MC6850_TAG); | |
| 1452 | state->upd765 = devtag_get_device(machine, UPD765_TAG); | |
| 1450 | state->z80ctc = machine->device(Z80CTC_TAG); | |
| 1451 | state->mc6850 = machine->device(MC6850_TAG); | |
| 1452 | state->upd765 = machine->device(UPD765_TAG); | |
| 1453 | 1453 | |
| 1454 | 1454 | /* register for state saving */ |
| 1455 | 1455 | state_save_register_global_pointer(machine, state->eim_ram, NEWBRAIN_EIM_RAM_SIZE); |
| r8453 | r8454 | |
|---|---|---|
| 252 | 252 | |
| 253 | 253 | static WRITE_LINE_DEVICE_HANDLER( einstein_serial_transmit_clock ) |
| 254 | 254 | { |
| 255 | running_device *uart = dev | |
| 255 | running_device *uart = dev | |
| 256 | 256 | msm8251_transmit_clock(uart); |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | static WRITE_LINE_DEVICE_HANDLER( einstein_serial_receive_clock ) |
| 260 | 260 | { |
| 261 | running_device *uart = dev | |
| 261 | running_device *uart = dev | |
| 262 | 262 | msm8251_receive_clock(uart); |
| 263 | 263 | } |
| 264 | 264 | |
| r8453 | r8454 | |
| 270 | 270 | static void einstein_page_rom(running_machine *machine) |
| 271 | 271 | { |
| 272 | 272 | einstein_state *einstein = (einstein_state *)machine->driver_data; |
| 273 | memory_set_bankptr(machine, "bank1", einstein->rom_enabled ? memory_region(machine, "bios") : messram_get_ptr( | |
| 273 | memory_set_bankptr(machine, "bank1", einstein->rom_enabled ? memory_region(machine, "bios") : messram_get_ptr(m | |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | /* writing to this port is a simple trigger, and switches between RAM and ROM */ |
| r8453 | r8454 | |
| 288 | 288 | |
| 289 | 289 | static READ8_HANDLER( einstein_kybintmsk_r ) |
| 290 | 290 | { |
| 291 | running_device *printer = | |
| 291 | running_device *printer = | |
| 292 | 292 | einstein_state *einstein = (einstein_state *)space->machine->driver_data; |
| 293 | 293 | UINT8 data = 0; |
| 294 | 294 | |
| r8453 | r8454 | |
| 395 | 395 | UINT8 config = input_port_read(machine, "config"); |
| 396 | 396 | |
| 397 | 397 | /* save pointers to our devices */ |
| 398 | einstein->color_screen = devtag_get_device(machine, "screen"); | |
| 399 | einstein->ctc = devtag_get_device(machine, IC_I058); | |
| 398 | einstein->color_screen = machine->device("screen"); | |
| 399 | einstein->ctc = machine->device(IC_I058); | |
| 400 | 400 | |
| 401 | 401 | /* initialize memory mapping */ |
| 402 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 403 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x8000); | |
| 402 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram"))); | |
| 403 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x8000); | |
| 404 | 404 | einstein->rom_enabled = 1; |
| 405 | 405 | einstein_page_rom(machine); |
| 406 | 406 | |
| r8453 | r8454 | |
| 414 | 414 | einstein->ctc_trigger = 0; |
| 415 | 415 | |
| 416 | 416 | /* configure floppy drives */ |
| 417 | floppy = | |
| 417 | floppy = m | |
| 418 | 418 | floppy_drive_set_geometry(floppy, config & 0x01 ? FLOPPY_DRIVE_DS_80 : FLOPPY_DRIVE_SS_40); |
| 419 | floppy = | |
| 419 | floppy = m | |
| 420 | 420 | floppy_drive_set_geometry(floppy, config & 0x02 ? FLOPPY_DRIVE_DS_80 : FLOPPY_DRIVE_SS_40); |
| 421 | floppy = | |
| 421 | floppy = m | |
| 422 | 422 | floppy_drive_set_geometry(floppy, config & 0x04 ? FLOPPY_DRIVE_DS_80 : FLOPPY_DRIVE_SS_40); |
| 423 | floppy = | |
| 423 | floppy = m | |
| 424 | 424 | floppy_drive_set_geometry(floppy, config & 0x08 ? FLOPPY_DRIVE_DS_80 : FLOPPY_DRIVE_SS_40); |
| 425 | 425 | } |
| 426 | 426 | |
| r8453 | r8454 | |
| 432 | 432 | MACHINE_RESET_CALL(einstein); |
| 433 | 433 | |
| 434 | 434 | /* get 80 column specific devices */ |
| 435 | einstein->mc6845 = | |
| 435 | einstein->mc6845 = m | |
| 436 | 436 | einstein->crtc_screen = machine->device<screen_device>("80column"); |
| 437 | 437 | |
| 438 | 438 | /* 80 column card palette */ |
| r8453 | r8454 | |
|---|---|---|
| 635 | 635 | vboy_state *state = (vboy_state *)screen->machine->driver_data; |
| 636 | 636 | int i; |
| 637 | 637 | UINT8 right = 0; |
| 638 | running_device *_3d_right_screen = | |
| 638 | running_device *_3d_right_screen = | |
| 639 | 639 | |
| 640 | 640 | bitmap_fill(state->screen_output, cliprect, state->vip_regs.BKCOL); |
| 641 | 641 |
| r8453 | r8454 | |
|---|---|---|
| 256 | 256 | { |
| 257 | 257 | const address_space *space_mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 258 | 258 | memory_install_write_bank(space_mem, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 259 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr(devtag_get_device(space->machine, "messram"))); | |
| 260 | memory_set_bankptr(space->machine, "bank2", messram_get_ptr(devtag_get_device(space->machine, "messram")) + 0x4000); | |
| 259 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr(space->machine->device("messram"))); | |
| 260 | memory_set_bankptr(space->machine, "bank2", messram_get_ptr(space->machine->device("messram")) + 0x4000); | |
| 261 | 261 | return 0; |
| 262 | 262 | } |
| 263 | 263 | |
| r8453 | r8454 | |
| 266 | 266 | const address_space *space_mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 267 | 267 | memory_unmap_write(space_mem, 0x0000, 0x3fff, 0, 0); |
| 268 | 268 | memory_set_bankptr(space->machine, "bank1", memory_region(space->machine, "maincpu")); |
| 269 | memory_set_bankptr(space->machine, "bank2", messram_get_ptr( | |
| 269 | memory_set_bankptr(space->machine, "bank2", messram_get_ptr( | |
| 270 | 270 | return 0; |
| 271 | 271 | } |
| 272 | 272 | |
| r8453 | r8454 | |
| 382 | 382 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 383 | 383 | memory_unmap_write(space, 0x0000, 0x3fff, 0, 0); |
| 384 | 384 | memory_set_bankptr(machine, "bank1", memory_region(machine, "maincpu")); // ROM |
| 385 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x10000); // VRAM | |
| 386 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x8000); | |
| 387 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xc000); | |
| 385 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0x10000); // VRAM | |
| 386 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x8000); | |
| 387 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0xc000); | |
| 388 | 388 | |
| 389 | cpu_set_irq_callback( | |
| 389 | cpu_set_irq_callback(m | |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | static MACHINE_START( fk1 ) |
| r8453 | r8454 | |
| 400 | 400 | fk1_state *state = (fk1_state *)screen->machine->driver_data; |
| 401 | 401 | UINT8 code; |
| 402 | 402 | int y, x, b; |
| 403 | UINT8 *ram = messram_get_ptr( | |
| 403 | UINT8 *ram = messram_get_ptr( | |
| 404 | 404 | |
| 405 | 405 | for (x = 0; x < 64; x++) |
| 406 | 406 | { |
| r8453 | r8454 | |
|---|---|---|
| 14 | 14 | |
| 15 | 15 | static WRITE8_HANDLER(ccs2422_terminal_w) |
| 16 | 16 | { |
| 17 | running_device *devconf = | |
| 17 | running_device *devconf = | |
| 18 | 18 | terminal_write(devconf,0,data); |
| 19 | 19 | } |
| 20 | 20 |
| r8453 | r8454 | |
|---|---|---|
| 239 | 239 | memory_write_byte(space, 0x788e, start % 256); /* usr subroutine address */ |
| 240 | 240 | memory_write_byte(space, 0x788f, start / 256); |
| 241 | 241 | image.message(" %s (M)\nsize=%04X : start=%04X : end=%04X",pgmname,size,start,end); |
| 242 | cpu_set_reg( | |
| 242 | cpu_set_reg( | |
| 243 | 243 | break; |
| 244 | 244 | |
| 245 | 245 | default: |
| r8453 | r8454 | |
| 253 | 253 | |
| 254 | 254 | static Z80BIN_EXECUTE( vtech1 ) |
| 255 | 255 | { |
| 256 | running_device *cpu = | |
| 256 | running_device *cpu = m | |
| 257 | 257 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 258 | 258 | |
| 259 | 259 | /* A Microsoft Basic program needs some manipulation before it can be run. |
| r8453 | r8454 | |
| 689 | 689 | int id; |
| 690 | 690 | |
| 691 | 691 | /* find devices */ |
| 692 | vtech1->mc6847 = devtag_get_device(machine, "mc6847"); | |
| 693 | vtech1->speaker = devtag_get_device(machine, "speaker"); | |
| 694 | vtech1->cassette = devtag_get_device(machine, "cassette"); | |
| 695 | vtech1->printer = devtag_get_device(machine, "printer"); | |
| 692 | vtech1->mc6847 = machine->device("mc6847"); | |
| 693 | vtech1->speaker = machine->device("speaker"); | |
| 694 | vtech1->cassette = machine->device("cassette"); | |
| 695 | vtech1->printer = machine->device("printer"); | |
| 696 | 696 | |
| 697 | 697 | /* ram */ |
| 698 | vtech1->ram = messram_get_ptr(devtag_get_device(machine, "messram")); | |
| 699 | vtech1->ram_size = messram_get_size(devtag_get_device(machine, "messram")); | |
| 698 | vtech1->ram = messram_get_ptr(machine->device("messram")); | |
| 699 | vtech1->ram_size = messram_get_size(machine->device("messram")); | |
| 700 | 700 | |
| 701 | 701 | /* setup memory banking */ |
| 702 | 702 | memory_set_bankptr(machine, "bank1", vtech1->ram); |
| r8453 | r8454 | |
|---|---|---|
| 110 | 110 | if (d) playfield.data|=1<<(playfield.bit^7); |
| 111 | 111 | playfield.bit++; |
| 112 | 112 | if (playfield.bit==8) { |
| 113 | logerror("%.4x playfield wrote %d %02x\n", (int)cpu_get_pc( | |
| 113 | logerror("%.4x playfield wrote %d %02x\n", (int)cpu_get_pc(m | |
| 114 | 114 | playfield.u.data[playfield.count]=playfield.data; |
| 115 | 115 | playfield.bit=0; |
| 116 | 116 | playfield.count=(playfield.count+1)%ARRAY_LENGTH(playfield.u.data); |
| r8453 | r8454 | |
| 216 | 216 | |
| 217 | 217 | static WRITE8_DEVICE_HANDLER(ssystem3_via_write_b) |
| 218 | 218 | { |
| 219 | running_device *via_0 = dev | |
| 219 | running_device *via_0 = dev | |
| 220 | 220 | UINT8 d; |
| 221 | 221 | |
| 222 | 222 | ssystem3_playfield_write(device->machine, data&1, data&8); |
| r8453 | r8454 | |
|---|---|---|
| 411 | 411 | { |
| 412 | 412 | camplynx_state *state = (camplynx_state *)machine->driver_data; |
| 413 | 413 | |
| 414 | state->mc6845 = | |
| 414 | state->mc6845 = m | |
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | static VIDEO_UPDATE( lynx48k ) |
| r8453 | r8454 | |
|---|---|---|
| 547 | 547 | neogeo_state *state = (neogeo_state *)field->port->machine->driver_data; |
| 548 | 548 | UINT32 ret = state->audio_result; |
| 549 | 549 | |
| 550 | // if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_result_r %02x\n", cpu_get_pc( | |
| 550 | // if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_result_r %02x\n", cpu_get_pc( | |
| 551 | 551 | |
| 552 | 552 | return ret; |
| 553 | 553 | } |
| r8453 | r8454 | |
| 835 | 835 | state->irq3_pending = 1; |
| 836 | 836 | |
| 837 | 837 | /* get devices */ |
| 838 | state->maincpu = devtag_get_device(machine, "maincpu"); | |
| 839 | state->audiocpu = devtag_get_device(machine, "audiocpu"); | |
| 840 | state->upd4990a = devtag_get_device(machine, "upd4990a"); | |
| 838 | state->maincpu = machine->device("maincpu"); | |
| 839 | state->audiocpu = machine->device("audiocpu"); | |
| 840 | state->upd4990a = machine->device("upd4990a"); | |
| 841 | 841 | |
| 842 | 842 | /* register state save */ |
| 843 | 843 | state_save_register_global(machine, state->display_position_interrupt_control); |
| r8453 | r8454 | |
| 888 | 888 | for (offs = 0; offs < 8; offs++) |
| 889 | 889 | system_control_w(space, offs, 0, 0x00ff); |
| 890 | 890 | |
| 891 | | |
| 891 | m | |
| 892 | 892 | |
| 893 | 893 | neogeo_reset_rng(machine); |
| 894 | 894 |
| r8453 | r8454 | |
|---|---|---|
| 82 | 82 | |
| 83 | 83 | static running_device *cassette_device_image(running_machine *machine) |
| 84 | 84 | { |
| 85 | return | |
| 85 | return m | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /* Read/Write Handlers */ |
| r8453 | r8454 | |
| 137 | 137 | switch (ram_bank) |
| 138 | 138 | { |
| 139 | 139 | case 0: |
| 140 | if (messram_get_size( | |
| 140 | if (messram_get_size(m | |
| 141 | 141 | { |
| 142 | 142 | memory_install_readwrite_bank(program, 0x8000, 0xffff, 0, 0, "bank2"); |
| 143 | 143 | } |
| r8453 | r8454 | |
| 153 | 153 | break; |
| 154 | 154 | |
| 155 | 155 | case 2: |
| 156 | if (messram_get_size( | |
| 156 | if (messram_get_size(m | |
| 157 | 157 | memory_install_readwrite_bank(program, 0x8000, 0xffff, 0, 0, "bank2"); |
| 158 | 158 | else |
| 159 | 159 | memory_unmap_readwrite(program, 0x8000, 0xffff, 0, 0); |
| 160 | 160 | break; |
| 161 | 161 | |
| 162 | 162 | case 3: |
| 163 | if (messram_get_size( | |
| 163 | if (messram_get_size(m | |
| 164 | 164 | memory_install_readwrite_bank(program, 0x8000, 0xffff, 0, 0, "bank2"); |
| 165 | 165 | else |
| 166 | 166 | memory_unmap_readwrite(program, 0x8000, 0xffff, 0, 0); |
| r8453 | r8454 | |
| 428 | 428 | memory_set_bank(space->machine, "bank1", rom_bank); |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | if (messram_get_size( | |
| 431 | if (messram_get_size( | |
| 432 | 432 | { |
| 433 | 433 | /* invalid RAM bank */ |
| 434 | 434 | memory_unmap_readwrite(program, 0xa000, 0xffff, 0, 0); |
| r8453 | r8454 | |
| 1134 | 1134 | const address_space *program = cputag_get_address_space(machine, I8085_TAG, ADDRESS_SPACE_PROGRAM); |
| 1135 | 1135 | |
| 1136 | 1136 | /* find devices */ |
| 1137 | state->upd1990a = devtag_get_device(machine, UPD1990A_TAG); | |
| 1138 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); | |
| 1139 | state->speaker = devtag_get_device(machine, SPEAKER_TAG); | |
| 1140 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 1137 | state->upd1990a = machine->device(UPD1990A_TAG); | |
| 1138 | state->centronics = machine->device(CENTRONICS_TAG); | |
| 1139 | state->speaker = machine->device(SPEAKER_TAG); | |
| 1140 | state->cassette = machine->device(CASSETTE_TAG); | |
| 1141 | 1141 | |
| 1142 | 1142 | /* initialize RTC */ |
| 1143 | 1143 | upd1990a_cs_w(state->upd1990a, 1); |
| r8453 | r8454 | |
| 1151 | 1151 | memory_set_bank(machine, "bank1", 0); |
| 1152 | 1152 | |
| 1153 | 1153 | /* configure RAM banking */ |
| 1154 | switch (messram_get_size( | |
| 1154 | switch (messram_get_size(m | |
| 1155 | 1155 | { |
| 1156 | 1156 | case 16 * 1024: |
| 1157 | 1157 | memory_unmap_readwrite(program, 0x8000, 0xbfff, 0, 0); |
| r8453 | r8454 | |
| 1163 | 1163 | break; |
| 1164 | 1164 | } |
| 1165 | 1165 | |
| 1166 | memory_configure_bank(machine, "bank2", 0, 1, messram_get_ptr( | |
| 1166 | memory_configure_bank(machine, "bank2", 0, 1, messram_get_ptr(m | |
| 1167 | 1167 | memory_set_bank(machine, "bank2", 0); |
| 1168 | 1168 | |
| 1169 | 1169 | /* register for state saving */ |
| r8453 | r8454 | |
| 1178 | 1178 | kc85_state *state = (kc85_state *)machine->driver_data; |
| 1179 | 1179 | |
| 1180 | 1180 | /* find devices */ |
| 1181 | state->upd1990a = devtag_get_device(machine, UPD1990A_TAG); | |
| 1182 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); | |
| 1183 | state->speaker = devtag_get_device(machine, SPEAKER_TAG); | |
| 1184 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 1181 | state->upd1990a = machine->device(UPD1990A_TAG); | |
| 1182 | state->centronics = machine->device(CENTRONICS_TAG); | |
| 1183 | state->speaker = machine->device(SPEAKER_TAG); | |
| 1184 | state->cassette = machine->device(CASSETTE_TAG); | |
| 1185 | 1185 | |
| 1186 | 1186 | /* initialize RTC */ |
| 1187 | 1187 | upd1990a_cs_w(state->upd1990a, 1); |
| r8453 | r8454 | |
| 1190 | 1190 | /* configure ROM banking */ |
| 1191 | 1191 | memory_configure_bank(machine, "bank1", 0, 1, memory_region(machine, I8085_TAG), 0); |
| 1192 | 1192 | memory_configure_bank(machine, "bank1", 1, 1, memory_region(machine, "option"), 0); |
| 1193 | memory_configure_bank(machine, "bank1", 2, 2, messram_get_ptr( | |
| 1193 | memory_configure_bank(machine, "bank1", 2, 2, messram_get_ptr(m | |
| 1194 | 1194 | memory_set_bank(machine, "bank1", 0); |
| 1195 | 1195 | |
| 1196 | 1196 | /* configure RAM banking */ |
| 1197 | memory_configure_bank(machine, "bank2", 0, 1, messram_get_ptr(devtag_get_device(machine, "messram")), 0); | |
| 1198 | memory_configure_bank(machine, "bank2", 2, 2, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x8000, 0x8000); | |
| 1197 | memory_configure_bank(machine, "bank2", 0, 1, messram_get_ptr(machine->device("messram")), 0); | |
| 1198 | memory_configure_bank(machine, "bank2", 2, 2, messram_get_ptr(machine->device("messram")) + 0x8000, 0x8000); | |
| 1199 | 1199 | memory_set_bank(machine, "bank2", 0); |
| 1200 | 1200 | |
| 1201 | 1201 | pc8201_bankswitch(machine, 0); |
| r8453 | r8454 | |
| 1215 | 1215 | const address_space *program = cputag_get_address_space(machine, I8085_TAG, ADDRESS_SPACE_PROGRAM); |
| 1216 | 1216 | |
| 1217 | 1217 | /* find devices */ |
| 1218 | state->upd1990a = devtag_get_device(machine, UPD1990A_TAG); | |
| 1219 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); | |
| 1220 | state->speaker = devtag_get_device(machine, SPEAKER_TAG); | |
| 1221 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 1218 | state->upd1990a = machine->device(UPD1990A_TAG); | |
| 1219 | state->centronics = machine->device(CENTRONICS_TAG); | |
| 1220 | state->speaker = machine->device(SPEAKER_TAG); | |
| 1221 | state->cassette = machine->device(CASSETTE_TAG); | |
| 1222 | 1222 | |
| 1223 | 1223 | /* initialize RTC */ |
| 1224 | 1224 | upd1990a_cs_w(state->upd1990a, 1); |
| r8453 | r8454 | |
| 1232 | 1232 | memory_set_bank(machine, "bank1", 0); |
| 1233 | 1233 | |
| 1234 | 1234 | /* configure RAM banking */ |
| 1235 | switch (messram_get_size( | |
| 1235 | switch (messram_get_size(m | |
| 1236 | 1236 | { |
| 1237 | 1237 | case 8 * 1024: |
| 1238 | 1238 | memory_unmap_readwrite(program, 0x8000, 0xcfff, 0, 0); |
| r8453 | r8454 | |
| 1254 | 1254 | break; |
| 1255 | 1255 | } |
| 1256 | 1256 | |
| 1257 | memory_configure_bank(machine, "bank2", 0, 1, messram_get_ptr( | |
| 1257 | memory_configure_bank(machine, "bank2", 0, 1, messram_get_ptr(m | |
| 1258 | 1258 | memory_set_bank(machine, "bank2", 0); |
| 1259 | 1259 | |
| 1260 | 1260 | /* register for state saving */ |
| r8453 | r8454 | |
| 1269 | 1269 | tandy200_state *state = (tandy200_state *)machine->driver_data; |
| 1270 | 1270 | |
| 1271 | 1271 | /* find devices */ |
| 1272 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); | |
| 1273 | state->speaker = devtag_get_device(machine, SPEAKER_TAG); | |
| 1274 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 1272 | state->centronics = machine->device(CENTRONICS_TAG); | |
| 1273 | state->speaker = machine->device(SPEAKER_TAG); | |
| 1274 | state->cassette = machine->device(CASSETTE_TAG); | |
| 1275 | 1275 | |
| 1276 | 1276 | /* configure ROM banking */ |
| 1277 | 1277 | memory_configure_bank(machine, "bank1", 0, 1, memory_region(machine, I8085_TAG), 0); |
| r8453 | r8454 | |
| 1280 | 1280 | memory_set_bank(machine, "bank1", 0); |
| 1281 | 1281 | |
| 1282 | 1282 | /* configure RAM banking */ |
| 1283 | memory_configure_bank(machine, "bank2", 0, 3, messram_get_ptr( | |
| 1283 | memory_configure_bank(machine, "bank2", 0, 3, messram_get_ptr(m | |
| 1284 | 1284 | memory_set_bank(machine, "bank2", 0); |
| 1285 | 1285 | |
| 1286 | 1286 | /* register for state saving */ |
| r8453 | r8454 | |
|---|---|---|
| 50 | 50 | va_start( v, s_fmt ); |
| 51 | 51 | vsprintf( buf, s_fmt, v ); |
| 52 | 52 | va_end( v ); |
| 53 | logerror( "%08x: %s", cpu_get_pc( | |
| 53 | logerror( "%08x: %s", cpu_get_pc(m | |
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | #else |
| r8453 | r8454 | |
| 608 | 608 | { |
| 609 | 609 | UINT8 interrupt = scc68070->picr1 & 7; |
| 610 | 610 | scc68070->timers.timer_status_register |= TSR_OV0; |
| 611 | cpu_set_input_line_vector( | |
| 611 | cpu_set_input_line_vector(m | |
| 612 | 612 | cputag_set_input_line(machine, "maincpu", M68K_IRQ_1 + (interrupt - 1), ASSERT_LINE); |
| 613 | 613 | } |
| 614 | 614 | scc68070_set_timer_callback(&state->scc68070_regs, 0); |
| r8453 | r8454 | |
| 1705 | 1705 | |
| 1706 | 1706 | // Set the CDIC interrupt line |
| 1707 | 1707 | verboselog(machine, 0, "Setting CDIC interrupt line for soundmap decode\n" ); |
| 1708 | cpu_set_input_line_vector( | |
| 1708 | cpu_set_input_line_vector(m | |
| 1709 | 1709 | cputag_set_input_line(machine, "maincpu", M68K_IRQ_4, ASSERT_LINE); |
| 1710 | 1710 | } |
| 1711 | 1711 | else |
| r8453 | r8454 | |
| 1931 | 1931 | |
| 1932 | 1932 | //printf( "Setting CDIC interrupt line\n" ); |
| 1933 | 1933 | verboselog(machine, 0, "Setting CDIC interrupt line for audio sector\n" ); |
| 1934 | cpu_set_input_line_vector( | |
| 1934 | cpu_set_input_line_vector(m | |
| 1935 | 1935 | cputag_set_input_line(machine, "maincpu", M68K_IRQ_4, ASSERT_LINE); |
| 1936 | 1936 | } |
| 1937 | 1937 | } |
| r8453 | r8454 | |
| 1951 | 1951 | { |
| 1952 | 1952 | //printf( "Setting CDIC interrupt line\n" ); |
| 1953 | 1953 | verboselog(machine, 0, "Setting CDIC interrupt line for message sector\n" ); |
| 1954 | cpu_set_input_line_vector( | |
| 1954 | cpu_set_input_line_vector(m | |
| 1955 | 1955 | cputag_set_input_line(machine, "maincpu", M68K_IRQ_4, ASSERT_LINE); |
| 1956 | 1956 | } |
| 1957 | 1957 | else |
| r8453 | r8454 | |
| 1971 | 1971 | |
| 1972 | 1972 | //printf( "Setting CDIC interrupt line\n" ); |
| 1973 | 1973 | verboselog(machine, 0, "Setting CDIC interrupt line for data sector\n" ); |
| 1974 | cpu_set_input_line_vector( | |
| 1974 | cpu_set_input_line_vector(m | |
| 1975 | 1975 | cputag_set_input_line(machine, "maincpu", M68K_IRQ_4, ASSERT_LINE); |
| 1976 | 1976 | } |
| 1977 | 1977 | } |
| r8453 | r8454 | |
| 2034 | 2034 | |
| 2035 | 2035 | verboselog(machine, 0, "Playing CDDA sector from MSF location %06x\n", cdic->time | 2 ); |
| 2036 | 2036 | |
| 2037 | cdda_start_audio( | |
| 2037 | cdda_start_audio(m | |
| 2038 | 2038 | |
| 2039 | 2039 | } |
| 2040 | 2040 | |
| r8453 | r8454 | |
| 2064 | 2064 | } |
| 2065 | 2065 | |
| 2066 | 2066 | verboselog(machine, 0, "Setting CDIC interrupt line for CDDA sector\n" ); |
| 2067 | cpu_set_input_line_vector( | |
| 2067 | cpu_set_input_line_vector(m | |
| 2068 | 2068 | cputag_set_input_line(machine, "maincpu", M68K_IRQ_4, ASSERT_LINE); |
| 2069 | 2069 | break; |
| 2070 | 2070 | } |
| r8453 | r8454 | |
| 2115 | 2115 | cdic->time = next_msf << 8; |
| 2116 | 2116 | |
| 2117 | 2117 | verboselog(machine, 0, "Setting CDIC interrupt line for Seek sector\n" ); |
| 2118 | cpu_set_input_line_vector( | |
| 2118 | cpu_set_input_line_vector(m | |
| 2119 | 2119 | cputag_set_input_line(machine, "maincpu", M68K_IRQ_4, ASSERT_LINE); |
| 2120 | 2120 | break; |
| 2121 | 2121 | } |
| r8453 | r8454 | |
| 2339 | 2339 | break; |
| 2340 | 2340 | } |
| 2341 | 2341 | case 0x2b: // Stop CDDA |
| 2342 | cdda_stop_audio( | |
| 2342 | cdda_stop_audio( | |
| 2343 | 2343 | timer_adjust_oneshot(cdic->interrupt_timer, attotime_never, 0); |
| 2344 | 2344 | break; |
| 2345 | 2345 | case 0x23: // Reset Mode 1 |
| r8453 | r8454 | |
| 2421 | 2421 | slave_regs_t *slave = &state->slave_regs; |
| 2422 | 2422 | |
| 2423 | 2423 | verboselog(machine, 0, "Asserting IRQ2\n" ); |
| 2424 | cpu_set_input_line_vector( | |
| 2424 | cpu_set_input_line_vector(m | |
| 2425 | 2425 | cputag_set_input_line(machine, "maincpu", M68K_IRQ_2, ASSERT_LINE); |
| 2426 | 2426 | timer_adjust_oneshot(slave->interrupt_timer, attotime_never, 0); |
| 2427 | 2427 | } |
| r8453 | r8454 | |
| 3284 | 3284 | UINT8 interrupt = (state->scc68070_regs.lir >> 4) & 7; |
| 3285 | 3285 | if(interrupt) |
| 3286 | 3286 | { |
| 3287 | cpu_set_input_line_vector( | |
| 3287 | cpu_set_input_line_vector(m | |
| 3288 | 3288 | cputag_set_input_line(machine, "maincpu", M68K_IRQ_1 + (interrupt - 1), ASSERT_LINE); |
| 3289 | 3289 | } |
| 3290 | 3290 | } |
| r8453 | r8454 | |
| 3294 | 3294 | UINT8 interrupt = state->scc68070_regs.lir & 7; |
| 3295 | 3295 | if(interrupt) |
| 3296 | 3296 | { |
| 3297 | cpu_set_input_line_vector( | |
| 3297 | cpu_set_input_line_vector(m | |
| 3298 | 3298 | cputag_set_input_line(machine, "maincpu", M68K_IRQ_1 + (interrupt - 1), ASSERT_LINE); |
| 3299 | 3299 | } |
| 3300 | 3300 | } |
| r8453 | r8454 | |
| 3375 | 3375 | UINT8 interrupt = (state->scc68070_regs.lir >> 4) & 7; |
| 3376 | 3376 | if(interrupt) |
| 3377 | 3377 | { |
| 3378 | cpu_set_input_line_vector( | |
| 3378 | cpu_set_input_line_vector(m | |
| 3379 | 3379 | cputag_set_input_line(machine, "maincpu", M68K_IRQ_1 + (interrupt - 1), ASSERT_LINE); |
| 3380 | 3380 | } |
| 3381 | 3381 | } |
| r8453 | r8454 | |
| 3385 | 3385 | UINT8 interrupt = state->scc68070_regs.lir & 7; |
| 3386 | 3386 | if(interrupt) |
| 3387 | 3387 | { |
| 3388 | cpu_set_input_line_vector( | |
| 3388 | cpu_set_input_line_vector(m | |
| 3389 | 3389 | cputag_set_input_line(machine, "maincpu", M68K_IRQ_1 + (interrupt - 1), ASSERT_LINE); |
| 3390 | 3390 | } |
| 3391 | 3391 | } |
| r8453 | r8454 | |
| 4470 | 4470 | static VIDEO_UPDATE(cdi) |
| 4471 | 4471 | { |
| 4472 | 4472 | cdi_state *state = (cdi_state *)screen->machine->driver_data; |
| 4473 | running_device *main_screen = devtag_get_device(screen->machine, "screen"); | |
| 4474 | running_device *lcd_screen = devtag_get_device(screen->machine, "lcd"); | |
| 4473 | running_device *main_screen = screen->machine->device("screen"); | |
| 4474 | running_device *lcd_screen = screen->machine->device("lcd"); | |
| 4475 | 4475 | |
| 4476 | 4476 | if (screen == main_screen) |
| 4477 | 4477 | { |
| r8453 | r8454 | |
| 4493 | 4493 | if(state->timer_set == 0) |
| 4494 | 4494 | { |
| 4495 | 4495 | state->timer_set = 1; |
| 4496 | cpu_set_input_line_vector( | |
| 4496 | cpu_set_input_line_vector(m | |
| 4497 | 4497 | cputag_set_input_line(machine, "maincpu", M68K_IRQ_4, ASSERT_LINE); |
| 4498 | 4498 | timer_adjust_oneshot(state->test_timer, ATTOTIME_IN_HZ(10000), 0); |
| 4499 | 4499 | } |
| r8453 | r8454 | |
| 4621 | 4621 | cdi_state *state = (cdi_state *)machine->driver_data; |
| 4622 | 4622 | UINT16 *src = (UINT16*)memory_region(machine, "maincpu"); |
| 4623 | 4623 | UINT16 *dst = state->planea; |
| 4624 | running_device *cdrom_dev = | |
| 4624 | running_device *cdrom_dev = m | |
| 4625 | 4625 | memcpy(dst, src, 0x8); |
| 4626 | 4626 | |
| 4627 | 4627 | scc68070_init(machine, &state->scc68070_regs); |
| r8453 | r8454 | |
| 4631 | 4631 | if( cdrom_dev ) |
| 4632 | 4632 | { |
| 4633 | 4633 | state->cdic_regs.cd = mess_cd_get_cdrom_file(cdrom_dev); |
| 4634 | cdda_set_cdrom( | |
| 4634 | cdda_set_cdrom(m | |
| 4635 | 4635 | } |
| 4636 | 4636 | |
| 4637 | | |
| 4637 | m | |
| 4638 | 4638 | |
| 4639 | 4639 | state->dmadac[0] = machine->device<dmadac_sound_device>("dac1"); |
| 4640 | 4640 | state->dmadac[1] = machine->device<dmadac_sound_device>("dac2"); |
| r8453 | r8454 | |
|---|---|---|
| 388 | 388 | { |
| 389 | 389 | if( address == 0x80030000 ) |
| 390 | 390 | { |
| 391 | running_device *cpu = | |
| 391 | running_device *cpu = | |
| 392 | 392 | |
| 393 | 393 | memory_set_direct_update_handler( space, NULL ); |
| 394 | 394 | |
| r8453 | r8454 | |
| 999 | 999 | |
| 1000 | 1000 | static MACHINE_RESET( psx ) |
| 1001 | 1001 | { |
| 1002 | running_device *cdrom_dev = | |
| 1002 | running_device *cdrom_dev = m | |
| 1003 | 1003 | if( cdrom_dev ) |
| 1004 | 1004 | { |
| 1005 | 1005 | psx_cdrom = mess_cd_get_cdrom_file(cdrom_dev); |
| r8453 | r8454 | |
|---|---|---|
| 26 | 26 | |
| 27 | 27 | static MACHINE_RESET(ipc) |
| 28 | 28 | { |
| 29 | cpu_set_reg( | |
| 29 | cpu_set_reg(m | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | static VIDEO_START( ipc ) |
| r8453 | r8454 | |
|---|---|---|
| 61 | 61 | |
| 62 | 62 | static READ8_HANDLER( samcoupe_disk_r ) |
| 63 | 63 | { |
| 64 | running_device *fdc = | |
| 64 | running_device *fdc = | |
| 65 | 65 | |
| 66 | 66 | /* drive and side is encoded into bit 5 and 3 */ |
| 67 | 67 | wd17xx_set_drive(fdc, (offset >> 4) & 1); |
| r8453 | r8454 | |
| 81 | 81 | |
| 82 | 82 | static WRITE8_HANDLER( samcoupe_disk_w ) |
| 83 | 83 | { |
| 84 | running_device *fdc = | |
| 84 | running_device *fdc = | |
| 85 | 85 | |
| 86 | 86 | /* drive and side is encoded into bit 5 and 3 */ |
| 87 | 87 | wd17xx_set_drive(fdc, (offset >> 4) & 1); |
| r8453 | r8454 | |
| 212 | 212 | |
| 213 | 213 | static READ8_HANDLER( samcoupe_keyboard_r ) |
| 214 | 214 | { |
| 215 | running_device *cassette = | |
| 215 | running_device *cassette = | |
| 216 | 216 | UINT8 data = 0x1f; |
| 217 | 217 | |
| 218 | 218 | /* bit 0-4, keyboard input */ |
| r8453 | r8454 | |
| 250 | 250 | |
| 251 | 251 | static WRITE8_HANDLER( samcoupe_border_w ) |
| 252 | 252 | { |
| 253 | running_device *cassette = devtag_get_device(space->machine, "cassette"); | |
| 254 | running_device *speaker = devtag_get_device(space->machine, "speaker"); | |
| 253 | running_device *cassette = space->machine->device("cassette"); | |
| 254 | running_device *speaker = space->machine->device("speaker"); | |
| 255 | 255 | coupe_asic *asic = (coupe_asic *)space->machine->driver_data; |
| 256 | 256 | |
| 257 | 257 | asic->border = data; |
| r8453 | r8454 | |
|---|---|---|
| 365 | 365 | static TIMER_CALLBACK(tape_interrupt_handler) |
| 366 | 366 | { |
| 367 | 367 | //assert(tape_interrupt_enable); |
| 368 | cputag_set_input_line(machine, "maincpu", 1, (cassette_input( | |
| 368 | cputag_set_input_line(machine, "maincpu", 1, (cassette_input(m | |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | /* CRU handler */ |
| 372 | 372 | static READ8_HANDLER(tutor_cassette_r) |
| 373 | 373 | { |
| 374 | return (cassette_input( | |
| 374 | return (cassette_input( | |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | /* memory handler */ |
| r8453 | r8454 | |
| 388 | 388 | { |
| 389 | 389 | case 0: |
| 390 | 390 | /* data out */ |
| 391 | cassette_output( | |
| 391 | cassette_output( | |
| 392 | 392 | break; |
| 393 | 393 | case 1: |
| 394 | 394 | /* interrupt control??? */ |
| r8453 | r8454 | |
|---|---|---|
| 614 | 614 | jtc_state *state = (jtc_state *)machine->driver_data; |
| 615 | 615 | |
| 616 | 616 | /* find devices */ |
| 617 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 618 | state->speaker = devtag_get_device(machine, SPEAKER_TAG); | |
| 619 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); | |
| 617 | state->cassette = machine->device(CASSETTE_TAG); | |
| 618 | state->speaker = machine->device(SPEAKER_TAG); | |
| 619 | state->centronics = machine->device(CENTRONICS_TAG); | |
| 620 | 620 | |
| 621 | 621 | /* register for state saving */ |
| 622 | 622 | //state_save_register_global(machine, state->); |
| r8453 | r8454 | |
|---|---|---|
| 582 | 582 | tiki100_state *state = (tiki100_state *)machine->driver_data; |
| 583 | 583 | |
| 584 | 584 | /* find devices */ |
| 585 | state->fd1797 = devtag_get_device(machine, FD1797_TAG); | |
| 586 | state->z80ctc = devtag_get_device(machine, Z80CTC_TAG); | |
| 585 | state->fd1797 = machine->device(FD1797_TAG); | |
| 586 | state->z80ctc = machine->device(Z80CTC_TAG); | |
| 587 | 587 | |
| 588 | 588 | /* allocate video RAM */ |
| 589 | 589 | state->video_ram = auto_alloc_array(machine, UINT8, TIKI100_VIDEORAM_SIZE); |
| 590 | 590 | |
| 591 | 591 | /* setup memory banking */ |
| 592 | 592 | memory_configure_bank(machine, "bank1", BANK_ROM, 1, memory_region(machine, Z80_TAG), 0); |
| 593 | memory_configure_bank(machine, "bank1", BANK_RAM, 1, messram_get_ptr( | |
| 593 | memory_configure_bank(machine, "bank1", BANK_RAM, 1, messram_get_ptr(m | |
| 594 | 594 | memory_configure_bank(machine, "bank1", BANK_VIDEO_RAM, 1, state->video_ram, 0); |
| 595 | 595 | |
| 596 | memory_configure_bank(machine, "bank2", BANK_RAM, 1, messram_get_ptr( | |
| 596 | memory_configure_bank(machine, "bank2", BANK_RAM, 1, messram_get_ptr(m | |
| 597 | 597 | memory_configure_bank(machine, "bank2", BANK_VIDEO_RAM, 1, state->video_ram + 0x4000, 0); |
| 598 | 598 | |
| 599 | memory_configure_bank(machine, "bank3", BANK_RAM, 1, messram_get_ptr( | |
| 599 | memory_configure_bank(machine, "bank3", BANK_RAM, 1, messram_get_ptr(m | |
| 600 | 600 | |
| 601 | 601 | tiki100_bankswitch(machine); |
| 602 | 602 |
| r8453 | r8454 | |
|---|---|---|
| 12 | 12 | static DIRECT_UPDATE_HANDLER( atm_direct ) |
| 13 | 13 | { |
| 14 | 14 | spectrum_state *state = (spectrum_state *)space->machine->driver_data; |
| 15 | running_device *beta = devtag_get_device(space->machine, BETA_DISK_TAG); | |
| 16 | UINT16 pc = cpu_get_reg(devtag_get_device(space->machine, "maincpu"), STATE_GENPCBASE); | |
| 15 | running_device *beta = space->machine->device(BETA_DISK_TAG); | |
| 16 | UINT16 pc = cpu_get_reg(space->machine->device("maincpu"), STATE_GENPCBASE); | |
| 17 | 17 | |
| 18 | 18 | if (beta->started() && betadisk_is_active(beta)) |
| 19 | 19 | { |
| r8453 | r8454 | |
| 49 | 49 | static void atm_update_memory(running_machine *machine) |
| 50 | 50 | { |
| 51 | 51 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 52 | running_device *beta = devtag_get_device(machine, BETA_DISK_TAG); | |
| 53 | UINT8 *messram = messram_get_ptr(devtag_get_device(machine, "messram")); | |
| 52 | running_device *beta = machine->device(BETA_DISK_TAG); | |
| 53 | UINT8 *messram = messram_get_ptr(machine->device("messram")); | |
| 54 | 54 | |
| 55 | 55 | state->screen_location = messram + ((state->port_7ffd_data & 8) ? (7<<14) : (5<<14)); |
| 56 | 56 | |
| r8453 | r8454 | |
| 99 | 99 | static MACHINE_RESET( atm ) |
| 100 | 100 | { |
| 101 | 101 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 102 | UINT8 *messram = messram_get_ptr( | |
| 102 | UINT8 *messram = messram_get_ptr(m | |
| 103 | 103 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 104 | running_device *beta = | |
| 104 | running_device *beta = m | |
| 105 | 105 | |
| 106 | 106 | memory_install_read_bank(space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 107 | 107 | memory_unmap_write(space, 0x0000, 0x3fff, 0, 0); |
| r8453 | r8454 | |
|---|---|---|
| 19 | 19 | |
| 20 | 20 | static WRITE16_HANDLER(tricep_terminal_w) |
| 21 | 21 | { |
| 22 | running_device *devconf = | |
| 22 | running_device *devconf = | |
| 23 | 23 | terminal_write(devconf,0,data >> 8); |
| 24 | 24 | } |
| 25 | 25 | |
| r8453 | r8454 | |
| 42 | 42 | |
| 43 | 43 | memcpy((UINT8*)tricep_ram,user1,0x2000); |
| 44 | 44 | |
| 45 | | |
| 45 | m | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | static WRITE8_DEVICE_HANDLER( tricep_kbd_put ) |
| r8453 | r8454 | |
|---|---|---|
| 304 | 304 | } |
| 305 | 305 | if(intc_regs.hold & intc_regs.enable & PS_INT_IRQ_MASK) |
| 306 | 306 | { |
| 307 | cpu_set_input_line( | |
| 307 | cpu_set_input_line(m | |
| 308 | 308 | } |
| 309 | 309 | else |
| 310 | 310 | { |
| 311 | cpu_set_input_line( | |
| 311 | cpu_set_input_line(m | |
| 312 | 312 | } |
| 313 | 313 | if(intc_regs.hold & intc_regs.enable & PS_INT_FIQ_MASK) |
| 314 | 314 | { |
| 315 | cpu_set_input_line( | |
| 315 | cpu_set_input_line(m | |
| 316 | 316 | } |
| 317 | 317 | else |
| 318 | 318 | { |
| 319 | cpu_set_input_line( | |
| 319 | cpu_set_input_line(m | |
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | |
| r8453 | r8454 | |
| 803 | 803 | |
| 804 | 804 | static WRITE32_HANDLER( ps_dac_w ) |
| 805 | 805 | { |
| 806 | dac_data_16_w( | |
| 806 | dac_data_16_w( | |
| 807 | 807 | } |
| 808 | 808 | |
| 809 | 809 | static ADDRESS_MAP_START(pockstat_mem, ADDRESS_SPACE_PROGRAM, 32) |
| r8453 | r8454 | |
| 884 | 884 | |
| 885 | 885 | static MACHINE_RESET( pockstat ) |
| 886 | 886 | { |
| 887 | cpu_set_reg( | |
| 887 | cpu_set_reg(m | |
| 888 | 888 | |
| 889 | 889 | ps_flash_write_enable_count = 0; |
| 890 | 890 | ps_flash_write_count = 0; |
| r8453 | r8454 | |
|---|---|---|
| 37 | 37 | |
| 38 | 38 | memcpy((UINT8*)sage2_ram,user1,0x2000); |
| 39 | 39 | |
| 40 | | |
| 40 | m | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | static WRITE8_DEVICE_HANDLER( sage2_kbd_put ) |
| r8453 | r8454 | |
|---|---|---|
| 194 | 194 | vcs80_state *state = (vcs80_state *)machine->driver_data; |
| 195 | 195 | |
| 196 | 196 | /* find devices */ |
| 197 | state->z80pio = | |
| 197 | state->z80pio = m | |
| 198 | 198 | |
| 199 | 199 | z80pio_astb_w(state->z80pio, 1); |
| 200 | 200 | z80pio_bstb_w(state->z80pio, 1); |
| r8453 | r8454 | |
|---|---|---|
| 26 | 26 | static WRITE8_HANDLER(out_w) |
| 27 | 27 | { |
| 28 | 28 | mod8_state *state = (mod8_state *)space->machine->driver_data; |
| 29 | running_device *devconf = | |
| 29 | running_device *devconf = | |
| 30 | 30 | |
| 31 | 31 | state->tty_data >>= 1; |
| 32 | 32 | state->tty_data |= (data & 0x01) ? 0x8000 : 0; |
| r8453 | r8454 | |
| 79 | 79 | |
| 80 | 80 | static MACHINE_RESET(mod8) |
| 81 | 81 | { |
| 82 | cpu_set_irq_callback( | |
| 82 | cpu_set_irq_callback(m | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | static WRITE8_DEVICE_HANDLER( mod8_kbd_put ) |
| r8453 | r8454 | |
|---|---|---|
| 456 | 456 | tandy2k_state *state = (tandy2k_state *)machine->driver_data; |
| 457 | 457 | |
| 458 | 458 | /* find devices */ |
| 459 | state->vpac = | |
| 459 | state->vpac = m | |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | static VIDEO_UPDATE( tandy2k ) |
| r8453 | r8454 | |
| 765 | 765 | tandy2k_state *state = (tandy2k_state *)machine->driver_data; |
| 766 | 766 | |
| 767 | 767 | /* find devices */ |
| 768 | state->uart = devtag_get_device(machine, I8251A_TAG); | |
| 769 | state->pit = devtag_get_device(machine, I8253_TAG); | |
| 770 | state->pic0 = devtag_get_device(machine, I8259A_0_TAG); | |
| 771 | state->pic1 = devtag_get_device(machine, I8259A_1_TAG); | |
| 772 | state->fdc = devtag_get_device(machine, I8272A_TAG); | |
| 773 | state->speaker = devtag_get_device(machine, SPEAKER_TAG); | |
| 774 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); | |
| 768 | state->uart = machine->device(I8251A_TAG); | |
| 769 | state->pit = machine->device(I8253_TAG); | |
| 770 | state->pic0 = machine->device(I8259A_0_TAG); | |
| 771 | state->pic1 = machine->device(I8259A_1_TAG); | |
| 772 | state->fdc = machine->device(I8272A_TAG); | |
| 773 | state->speaker = machine->device(SPEAKER_TAG); | |
| 774 | state->centronics = machine->device(CENTRONICS_TAG); | |
| 775 | 775 | |
| 776 | 776 | /* memory banking */ |
| 777 | 777 | const address_space *program = cputag_get_address_space(machine, I80186_TAG, ADDRESS_SPACE_PROGRAM); |
| 778 | UINT8 *ram = messram_get_ptr(devtag_get_device(machine, "messram")); | |
| 779 | int ram_size = messram_get_size(devtag_get_device(machine, "messram")); | |
| 778 | UINT8 *ram = messram_get_ptr(machine->device("messram")); | |
| 779 | int ram_size = messram_get_size(machine->device("messram")); | |
| 780 | 780 | |
| 781 | 781 | memory_install_ram(program, 0x00000, ram_size - 1, 0, 0, ram); |
| 782 | 782 |
| r8453 | r8454 | |
|---|---|---|
| 719 | 719 | if (!state->lcd_on) |
| 720 | 720 | { |
| 721 | 721 | state->lcd_on = 1; |
| 722 | cpu_set_reg( | |
| 722 | cpu_set_reg(m | |
| 723 | 723 | } |
| 724 | 724 | else |
| 725 | 725 | state->kb_brk = 1; |
| r8453 | r8454 | |
| 977 | 977 | state->enable_k7=((data & 0x0c) == 8) ? 1 : 0; |
| 978 | 978 | if((data & 0x0e) == 0x0e) |
| 979 | 979 | { |
| 980 | running_device *speaker = | |
| 980 | running_device *speaker = | |
| 981 | 981 | |
| 982 | 982 | beep_set_state(speaker, 1); |
| 983 | 983 | beep_set_frequency(speaker, 192000 / (state->regs_w[2] | (state->regs_w[3] << 8))); |
| r8453 | r8454 | |
| 1148 | 1148 | |
| 1149 | 1149 | static TIMER_CALLBACK( beep_stop ) |
| 1150 | 1150 | { |
| 1151 | running_device *speaker = | |
| 1151 | running_device *speaker = m | |
| 1152 | 1152 | beep_set_state(speaker, 0); |
| 1153 | 1153 | } |
| 1154 | 1154 | |
| r8453 | r8454 | |
| 1187 | 1187 | state->irq_clear = timer_alloc(machine, irq_clear, 0); |
| 1188 | 1188 | state->beep_clear = timer_alloc(machine, beep_stop, 0); |
| 1189 | 1189 | state->kb_clear = timer_alloc(machine, keyboard_clear, 0); |
| 1190 | state->printer = | |
| 1190 | state->printer = m | |
| 1191 | 1191 | |
| 1192 | 1192 | /* Save State */ |
| 1193 | 1193 | |
| r8453 | r8454 | |
| 1238 | 1238 | { |
| 1239 | 1239 | t6834_state *state = (t6834_state *)machine->driver_data; |
| 1240 | 1240 | |
| 1241 | cpu_set_reg( | |
| 1241 | cpu_set_reg(m | |
| 1242 | 1242 | |
| 1243 | 1243 | memset(state->regs_r, 0, sizeof(state->regs_r)); |
| 1244 | 1244 | memset(state->regs_w, 0, sizeof(state->regs_w)); |
| r8453 | r8454 | |
|---|---|---|
| 26 | 26 | |
| 27 | 27 | static WRITE8_HANDLER(nanos_tc_w) |
| 28 | 28 | { |
| 29 | running_device *fdc = | |
| 29 | running_device *fdc = | |
| 30 | 30 | upd765_tc_w(fdc, BIT(data,1)); |
| 31 | 31 | } |
| 32 | 32 | |
| r8453 | r8454 | |
| 248 | 248 | { |
| 249 | 249 | if (ra < 8) |
| 250 | 250 | { |
| 251 | chr = messram_get_ptr( | |
| 251 | chr = messram_get_ptr( | |
| 252 | 252 | |
| 253 | 253 | /* get pattern of pixels for that character scanline */ |
| 254 | 254 | gfx = FNT[(chr<<3) | ra ]; |
| r8453 | r8454 | |
| 299 | 299 | if (BIT(data,7)) { |
| 300 | 300 | memory_set_bankptr(device->machine, "bank1", memory_region(device->machine, "maincpu")); |
| 301 | 301 | } else { |
| 302 | memory_set_bankptr(device->machine, "bank1", messram_get_ptr(dev | |
| 302 | memory_set_bankptr(device->machine, "bank1", messram_get_ptr(dev | |
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 | static UINT8 row_number(UINT8 code) { |
| r8453 | r8454 | |
| 410 | 410 | memory_install_write_bank(space, 0x1000, 0xffff, 0, 0, "bank2"); |
| 411 | 411 | |
| 412 | 412 | memory_set_bankptr(machine, "bank1", memory_region(machine, "maincpu")); |
| 413 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x1000); | |
| 414 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 413 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0x1000); | |
| 414 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram"))); | |
| 415 | 415 | |
| 416 | 416 | floppy_mon_w(floppy_get_device(space->machine, 0), CLEAR_LINE); |
| 417 | 417 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1,1); |
| r8453 | r8454 | |
|---|---|---|
| 38 | 38 | |
| 39 | 39 | static MACHINE_RESET(z9001) |
| 40 | 40 | { |
| 41 | cpu_set_reg( | |
| 41 | cpu_set_reg(m | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | static VIDEO_START( z9001 ) |
| r8453 | r8454 | |
|---|---|---|
| 336 | 336 | amu880_state *state = (amu880_state *)machine->driver_data; |
| 337 | 337 | |
| 338 | 338 | /* find devices */ |
| 339 | state->cassette = | |
| 339 | state->cassette = m | |
| 340 | 340 | |
| 341 | 341 | /* find memory regions */ |
| 342 | 342 | state->keyboard_rom = memory_region(machine, "keyboard"); |
| r8453 | r8454 | |
|---|---|---|
| 280 | 280 | |
| 281 | 281 | static TIMER_CALLBACK( fm7_beeper_off ) |
| 282 | 282 | { |
| 283 | beep_set_state( | |
| 283 | beep_set_state(m | |
| 284 | 284 | logerror("timed beeper off\n"); |
| 285 | 285 | } |
| 286 | 286 | |
| r8453 | r8454 | |
| 290 | 290 | |
| 291 | 291 | if(!speaker_active) // speaker not active, disable all beeper sound |
| 292 | 292 | { |
| 293 | beep_set_state( | |
| 293 | beep_set_state( | |
| 294 | 294 | return; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | if(data & 0x80) |
| 298 | 298 | { |
| 299 | 299 | if(speaker_active) |
| 300 | beep_set_state( | |
| 300 | beep_set_state( | |
| 301 | 301 | } |
| 302 | 302 | else |
| 303 | beep_set_state( | |
| 303 | beep_set_state( | |
| 304 | 304 | |
| 305 | 305 | if(data & 0x40) |
| 306 | 306 | { |
| 307 | 307 | if(speaker_active) |
| 308 | 308 | { |
| 309 | beep_set_state( | |
| 309 | beep_set_state( | |
| 310 | 310 | logerror("timed beeper on\n"); |
| 311 | 311 | timer_set(space->machine,ATTOTIME_IN_MSEC(205),NULL,0,fm7_beeper_off); |
| 312 | 312 | } |
| r8453 | r8454 | |
| 323 | 323 | { |
| 324 | 324 | if(speaker_active) |
| 325 | 325 | { |
| 326 | beep_set_state( | |
| 326 | beep_set_state( | |
| 327 | 327 | logerror("timed beeper on\n"); |
| 328 | 328 | timer_set(space->machine,ATTOTIME_IN_MSEC(205),NULL,0,fm7_beeper_off); |
| 329 | 329 | } |
| r8453 | r8454 | |
| 452 | 452 | |
| 453 | 453 | static READ8_HANDLER( fm7_fdc_r ) |
| 454 | 454 | { |
| 455 | running_device* dev = | |
| 455 | running_device* dev = | |
| 456 | 456 | UINT8 ret = 0; |
| 457 | 457 | |
| 458 | 458 | switch(offset) |
| r8453 | r8454 | |
| 486 | 486 | |
| 487 | 487 | static WRITE8_HANDLER( fm7_fdc_w ) |
| 488 | 488 | { |
| 489 | running_device* dev = | |
| 489 | running_device* dev = | |
| 490 | 490 | switch(offset) |
| 491 | 491 | { |
| 492 | 492 | case 0: |
| r8453 | r8454 | |
| 773 | 773 | // bit 1: printer error |
| 774 | 774 | // bit 0: printer busy |
| 775 | 775 | UINT8 ret = 0x00; |
| 776 | double data = cassette_input(devtag_get_device(space->machine,"cass")); | |
| 777 | running_device* printer_dev = devtag_get_device(space->machine,"lpt"); | |
| 776 | double data = cassette_input(space->machine->device("cass")); | |
| 777 | running_device* printer_dev = space->machine->device("lpt"); | |
| 778 | 778 | UINT8 pdata; |
| 779 | 779 | int x; |
| 780 | 780 | |
| 781 | 781 | if(data > 0.03) |
| 782 | 782 | ret |= 0x80; |
| 783 | 783 | |
| 784 | if(cassette_get_state( | |
| 784 | if(cassette_get_state( | |
| 785 | 785 | ret |= 0x80; // cassette input is high when not in use. |
| 786 | 786 | |
| 787 | 787 | ret |= 0x70; |
| r8453 | r8454 | |
| 799 | 799 | } |
| 800 | 800 | else |
| 801 | 801 | { |
| 802 | device_image_interface *image = dynamic_cast<device_image_interface *>( | |
| 802 | device_image_interface *image = dynamic_cast<device_image_interface *>( | |
| 803 | 803 | if(image->exists()) |
| 804 | 804 | { |
| 805 | 805 | if(centronics_pe_r(printer_dev)) |
| r8453 | r8454 | |
| 828 | 828 | // bit 1: cassette motor |
| 829 | 829 | // bit 0: cassette output |
| 830 | 830 | if((data & 0x01) != (prev & 0x01)) |
| 831 | cassette_output( | |
| 831 | cassette_output( | |
| 832 | 832 | if((data & 0x02) != (prev & 0x02)) |
| 833 | cassette_change_state(devtag_get_device(space->machine, "cass" ),(data & 0x02) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); | |
| 834 | centronics_strobe_w(devtag_get_device(space->machine,"lpt"),!(data & 0x40)); | |
| 833 | cassette_change_state(space->machine->device("cass" ),(data & 0x02) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); | |
| 834 | centronics_strobe_w(space->machine->device("lpt"),!(data & 0x40)); | |
| 835 | 835 | prev = data; |
| 836 | 836 | break; |
| 837 | 837 | case 1: |
| 838 | 838 | // Printer data |
| 839 | centronics_data_w( | |
| 839 | centronics_data_w( | |
| 840 | 840 | break; |
| 841 | 841 | } |
| 842 | 842 | } |
| r8453 | r8454 | |
| 875 | 875 | break; |
| 876 | 876 | case 0x01: |
| 877 | 877 | // Data read |
| 878 | psg_data = ay8910_r( | |
| 878 | psg_data = ay8910_r( | |
| 879 | 879 | break; |
| 880 | 880 | case 0x02: |
| 881 | 881 | // Data write |
| 882 | ay8910_data_w( | |
| 882 | ay8910_data_w( | |
| 883 | 883 | break; |
| 884 | 884 | case 0x03: |
| 885 | 885 | // Address latch |
| 886 | ay8910_address_w( | |
| 886 | ay8910_address_w( | |
| 887 | 887 | break; |
| 888 | 888 | } |
| 889 | 889 | } |
| r8453 | r8454 | |
| 896 | 896 | break; |
| 897 | 897 | case 0x01: |
| 898 | 898 | // Data read |
| 899 | psg_data = ym2203_r( | |
| 899 | psg_data = ym2203_r( | |
| 900 | 900 | break; |
| 901 | 901 | case 0x02: |
| 902 | 902 | // Data write |
| 903 | ym2203_w( | |
| 903 | ym2203_w( | |
| 904 | 904 | logerror("YM: data write 0x%02x\n",psg_data); |
| 905 | 905 | break; |
| 906 | 906 | case 0x03: |
| 907 | 907 | // Address latch |
| 908 | ym2203_w( | |
| 908 | ym2203_w( | |
| 909 | 909 | logerror("YM: address latch 0x%02x\n",psg_data); |
| 910 | 910 | break; |
| 911 | 911 | case 0x04: |
| 912 | 912 | // Status register |
| 913 | psg_data = ym2203_r( | |
| 913 | psg_data = ym2203_r( | |
| 914 | 914 | break; |
| 915 | 915 | case 0x09: |
| 916 | 916 | // Joystick port read |
| r8453 | r8454 | |
| 1705 | 1705 | fm7_keyboard_timer = timer_alloc(machine,fm7_keyboard_poll,NULL); |
| 1706 | 1706 | if(fm7_type != SYS_FM7) |
| 1707 | 1707 | fm77av_vsync_timer = timer_alloc(machine,fm77av_vsync,NULL); |
| 1708 | cpu_set_irq_callback(devtag_get_device(machine,"maincpu"),fm7_irq_ack); | |
| 1709 | cpu_set_irq_callback(devtag_get_device(machine,"sub"),fm7_sub_irq_ack); | |
| 1708 | cpu_set_irq_callback(machine->device("maincpu"),fm7_irq_ack); | |
| 1709 | cpu_set_irq_callback(machine->device("sub"),fm7_sub_irq_ack); | |
| 1710 | 1710 | } |
| 1711 | 1711 | |
| 1712 | 1712 | static MACHINE_START(fm7) |
| r8453 | r8454 | |
| 1721 | 1721 | memset(fm7_shared_ram,0xff,0x80); |
| 1722 | 1722 | fm7_type = SYS_FM7; |
| 1723 | 1723 | |
| 1724 | beep_set_frequency(devtag_get_device(machine,"beeper"),1200); | |
| 1725 | beep_set_state(devtag_get_device(machine,"beeper"),0); | |
| 1724 | beep_set_frequency(machine->device("beeper"),1200); | |
| 1725 | beep_set_state(machine->device("beeper"),0); | |
| 1726 | 1726 | } |
| 1727 | 1727 | |
| 1728 | 1728 | static MACHINE_START(fm77av) |
| r8453 | r8454 | |
| 1742 | 1742 | memory_set_bankptr(machine,"bank21",RAM+0x800); |
| 1743 | 1743 | |
| 1744 | 1744 | fm7_type = SYS_FM77AV; |
| 1745 | beep_set_frequency(devtag_get_device(machine,"beeper"),1200); | |
| 1746 | beep_set_state(devtag_get_device(machine,"beeper"),0); | |
| 1745 | beep_set_frequency(machine->device("beeper"),1200); | |
| 1746 | beep_set_state(machine->device("beeper"),0); | |
| 1747 | 1747 | } |
| 1748 | 1748 | |
| 1749 | 1749 | static MACHINE_RESET(fm7) |
| r8453 | r8454 | |
| 1800 | 1800 | } |
| 1801 | 1801 | if(fm7_type != SYS_FM7) // set default RAM banks |
| 1802 | 1802 | { |
| 1803 | fm7_mmr_refresh(cpu_get_address_space( | |
| 1803 | fm7_mmr_refresh(cpu_get_address_space(m | |
| 1804 | 1804 | } |
| 1805 | 1805 | } |
| 1806 | 1806 |
| r8453 | r8454 | |
|---|---|---|
| 485 | 485 | vidbrain_state *state = (vidbrain_state *)machine->driver_data; |
| 486 | 486 | |
| 487 | 487 | /* find devices */ |
| 488 | state->discrete = | |
| 488 | state->discrete = m | |
| 489 | 489 | |
| 490 | 490 | /* register for state saving */ |
| 491 | 491 | state_save_register_global(machine, state->keylatch); |
| r8453 | r8454 | |
|---|---|---|
| 161 | 161 | |
| 162 | 162 | static READ16_HANDLER( cps1_eeprom_port_r ) |
| 163 | 163 | { |
| 164 | running_device *eeprom = | |
| 164 | running_device *eeprom = | |
| 165 | 165 | return eeprom_read_bit(eeprom); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | static WRITE16_HANDLER( cps1_eeprom_port_w ) |
| 169 | 169 | { |
| 170 | running_device *eeprom = | |
| 170 | running_device *eeprom = | |
| 171 | 171 | if (ACCESSING_BITS_0_7) |
| 172 | 172 | { |
| 173 | 173 | /* |
| r8453 | r8454 | |
|---|---|---|
| 187 | 187 | memory_set_bank(machine, "bank1", 0); |
| 188 | 188 | |
| 189 | 189 | /* find devices */ |
| 190 | state->speaker = devtag_get_device(machine, SPEAKER_TAG); | |
| 191 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 190 | state->speaker = machine->device(SPEAKER_TAG); | |
| 191 | state->cassette = machine->device(CASSETTE_TAG); | |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /* Machine Driver */ |
| r8453 | r8454 | |
|---|---|---|
| 84 | 84 | |
| 85 | 85 | static MACHINE_RESET( esq1 ) |
| 86 | 86 | { |
| 87 | es5503_set_base( | |
| 87 | es5503_set_base(m | |
| 88 | 88 | |
| 89 | 89 | // set default OSROM banking |
| 90 | 90 | memory_set_bankptr(machine, "osbank", memory_region(machine, "osrom") ); |
| r8453 | r8454 | |
|---|---|---|
| 91 | 91 | static WRITE8_DEVICE_HANDLER( cd32_cia_0_porta_w ) |
| 92 | 92 | { |
| 93 | 93 | /* bit 1 = cd audio mute */ |
| 94 | running_device *cdda = dev | |
| 94 | running_device *cdda = dev | |
| 95 | 95 | |
| 96 | 96 | if (cdda != NULL) |
| 97 | 97 | sound_set_output_gain(cdda, 0, BIT(data, 0) ? 0.0 : 1.0 ); |
| r8453 | r8454 | |
| 380 | 380 | static READ8_DEVICE_HANDLER( a1200_cia_0_portA_r ) |
| 381 | 381 | { |
| 382 | 382 | UINT8 ret = input_port_read(device->machine, "CIA0PORTA") & 0xc0; /* Gameport 1 and 0 buttons */ |
| 383 | ret |= amiga_fdc_status_r(dev | |
| 383 | ret |= amiga_fdc_status_r(dev | |
| 384 | 384 | return ret; |
| 385 | 385 | } |
| 386 | 386 | |
| r8453 | r8454 | |
| 576 | 576 | |
| 577 | 577 | static UINT16 a1200_read_dskbytr(running_machine *machine) |
| 578 | 578 | { |
| 579 | return amiga_fdc_get_byte( | |
| 579 | return amiga_fdc_get_byte(m | |
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | static void a1200_write_dsklen(running_machine *machine, UINT16 data) |
| r8453 | r8454 | |
| 584 | 584 | if ( data & 0x8000 ) |
| 585 | 585 | { |
| 586 | 586 | if ( CUSTOM_REG(REG_DSKLEN) & 0x8000 ) |
| 587 | amiga_fdc_setup_dma( | |
| 587 | amiga_fdc_setup_dma(m | |
| 588 | 588 | } |
| 589 | 589 | } |
| 590 | 590 |
| r8453 | r8454 | |
|---|---|---|
| 49 | 49 | |
| 50 | 50 | static MACHINE_RESET(vt320) |
| 51 | 51 | { |
| 52 | memset(messram_get_ptr( | |
| 52 | memset(messram_get_ptr(m | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | static VIDEO_START( vt320 ) |
| r8453 | r8454 | |
|---|---|---|
| 163 | 163 | trs80m2_state *state = (trs80m2_state *)machine->driver_data; |
| 164 | 164 | |
| 165 | 165 | const address_space *program = cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM); |
| 166 | running_device *messram = | |
| 166 | running_device *messram = m | |
| 167 | 167 | UINT8 *rom = memory_region(machine, Z80_TAG); |
| 168 | 168 | UINT8 *ram = messram_get_ptr(messram); |
| 169 | 169 | int last_page = (messram_get_size(messram) / 0x8000) - 1; |
| r8453 | r8454 | |
| 733 | 733 | trs80m2_state *state = (trs80m2_state *)machine->driver_data; |
| 734 | 734 | |
| 735 | 735 | /* find devices */ |
| 736 | state->mc6845 = | |
| 736 | state->mc6845 = m | |
| 737 | 737 | |
| 738 | 738 | /* find memory regions */ |
| 739 | 739 | state->char_rom = memory_region(machine, MC6845_TAG); |
| r8453 | r8454 | |
| 953 | 953 | trs80m2_state *state = (trs80m2_state *)machine->driver_data; |
| 954 | 954 | |
| 955 | 955 | /* find devices */ |
| 956 | state->z80ctc = devtag_get_device(machine, Z80CTC_TAG); | |
| 957 | state->z80pio = devtag_get_device(machine, Z80PIO_TAG); | |
| 958 | state->mc6845 = devtag_get_device(machine, MC6845_TAG); | |
| 959 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); | |
| 960 | state->floppy = devtag_get_device(machine, FLOPPY_0); | |
| 956 | state->z80ctc = machine->device(Z80CTC_TAG); | |
| 957 | state->z80pio = machine->device(Z80PIO_TAG); | |
| 958 | state->mc6845 = machine->device(MC6845_TAG); | |
| 959 | state->centronics = machine->device(CENTRONICS_TAG); | |
| 960 | state->floppy = machine->device(FLOPPY_0); | |
| 961 | 961 | |
| 962 | 962 | /* Shugart SA-800 motor spins constantly */ |
| 963 | 963 | floppy_mon_w(state->floppy, CLEAR_LINE); |
| r8453 | r8454 | |
|---|---|---|
| 338 | 338 | |
| 339 | 339 | state->irq_on_timer = timer_alloc( machine, d65010_irq_on_cb, NULL ); |
| 340 | 340 | state->irq_off_timer = timer_alloc( machine, d65010_irq_off_cb, NULL ); |
| 341 | state->maincpu = | |
| 341 | state->maincpu = m | |
| 342 | 342 | state->screen = machine->device<screen_device>("screen" ); |
| 343 | 343 | } |
| 344 | 344 |
| r8453 | r8454 | |
|---|---|---|
| 84 | 84 | { |
| 85 | 85 | mac_state *mac = (mac_state *)space->machine->driver_data; |
| 86 | 86 | |
| 87 | logerror("ASC: Read @ %x (PC %x)\n", offset, cpu_get_pc( | |
| 87 | logerror("ASC: Read @ %x (PC %x)\n", offset, cpu_get_pc( | |
| 88 | 88 | |
| 89 | 89 | switch (offset) |
| 90 | 90 | { |
| r8453 | r8454 | |
| 123 | 123 | INT32 i; |
| 124 | 124 | mac_state *mac = (mac_state *)space->machine->driver_data; |
| 125 | 125 | |
| 126 | logerror("ASC: %02x to %x (PC %x)\n", data, offset, cpu_get_pc( | |
| 126 | logerror("ASC: %02x to %x (PC %x)\n", data, offset, cpu_get_pc( | |
| 127 | 127 | |
| 128 | 128 | mac->mac_asc_regs[offset] = data; |
| 129 | 129 | |
| r8453 | r8454 | |
| 228 | 228 | static READ16_HANDLER ( mac_rbv_r ) |
| 229 | 229 | { |
| 230 | 230 | int data; |
| 231 | running_device *via_1 = | |
| 231 | running_device *via_1 = | |
| 232 | 232 | |
| 233 | 233 | logerror("rbv_r: %x, mask %x\n", offset, mem_mask); |
| 234 | 234 | |
| r8453 | r8454 | |
| 257 | 257 | |
| 258 | 258 | static WRITE16_HANDLER ( mac_rbv_w ) |
| 259 | 259 | { |
| 260 | running_device *via_1 = | |
| 260 | running_device *via_1 = | |
| 261 | 261 | |
| 262 | 262 | logerror("rbv_w: %x to offset %x, mask %x\n", data, offset, mem_mask); |
| 263 | 263 | |
| r8453 | r8454 | |
| 277 | 277 | static READ16_HANDLER ( mac_v8_r ) |
| 278 | 278 | { |
| 279 | 279 | int data, viaoffs; |
| 280 | running_device *via_1 = | |
| 280 | running_device *via_1 = | |
| 281 | 281 | |
| 282 | 282 | // printf("v8_r: %x, mask %x (PC %x)\n", offset*2, mem_mask, cpu_get_pc(space->cpu)); |
| 283 | 283 | |
| r8453 | r8454 | |
| 298 | 298 | |
| 299 | 299 | static WRITE16_HANDLER ( mac_v8_w ) |
| 300 | 300 | { |
| 301 | running_device *via_1 = | |
| 301 | running_device *via_1 = | |
| 302 | 302 | int viaoffs; |
| 303 | 303 | |
| 304 | 304 | // printf("v8_w: %x to offset %x, mask %x (PC %x)\n", data, offset*2, mem_mask, cpu_get_pc(space->cpu)); |
| r8453 | r8454 | |
| 369 | 369 | static READ16_HANDLER ( mac_sonora_r ) |
| 370 | 370 | { |
| 371 | 371 | int data, viaoffs; |
| 372 | running_device *via_1 = | |
| 372 | running_device *via_1 = | |
| 373 | 373 | |
| 374 | 374 | // printf("sonora_r: %x, mask %x (PC %x)\n", offset*2, mem_mask, cpu_get_pc(space->cpu)); |
| 375 | 375 | |
| r8453 | r8454 | |
| 390 | 390 | |
| 391 | 391 | static WRITE16_HANDLER ( mac_sonora_w ) |
| 392 | 392 | { |
| 393 | running_device *via_1 = | |
| 393 | running_device *via_1 = | |
| 394 | 394 | int viaoffs; |
| 395 | 395 | |
| 396 | 396 | // printf("sonora_w: %x to offset %x, mask %x (PC %x)\n", data, offset*2, mem_mask, cpu_get_pc(space->cpu)); |
| r8453 | r8454 | |
|---|---|---|
| 378 | 378 | |
| 379 | 379 | mem_bank = mem_bank & nc_membank_internal_ram_mask; |
| 380 | 380 | |
| 381 | addr = messram_get_ptr( | |
| 381 | addr = messram_get_ptr(m | |
| 382 | 382 | |
| 383 | 383 | memory_set_bankptr(machine, bank1, addr); |
| 384 | 384 | memory_set_bankptr(machine, bank5, addr); |
| r8453 | r8454 | |
| 451 | 451 | /* get size of memory data stored */ |
| 452 | 452 | mame_fread(file, &stored_size, sizeof(unsigned long)); |
| 453 | 453 | |
| 454 | if (stored_size > messram_get_size(devtag_get_device(machine, "messram"))) | |
| 455 | restore_size = messram_get_size(devtag_get_device(machine, "messram")); | |
| 454 | if (stored_size > messram_get_size(machine->device("messram"))) | |
| 455 | restore_size = messram_get_size(machine->device("messram")); | |
| 456 | 456 | else |
| 457 | 457 | restore_size = stored_size; |
| 458 | 458 | |
| 459 | 459 | /* read as much as will fit into memory */ |
| 460 | mame_fread(file, messram_get_ptr( | |
| 460 | mame_fread(file, messram_get_ptr(m | |
| 461 | 461 | /* seek over remaining data */ |
| 462 | 462 | mame_fseek(file, SEEK_CUR,stored_size - restore_size); |
| 463 | 463 | } |
| r8453 | r8454 | |
| 465 | 465 | /* store a block of memory to the nvram file */ |
| 466 | 466 | static void nc_common_store_memory_to_stream(running_machine *machine) |
| 467 | 467 | { |
| 468 | UINT32 size = messram_get_size( | |
| 468 | UINT32 size = messram_get_size(m | |
| 469 | 469 | if (!file) |
| 470 | 470 | return; |
| 471 | 471 | |
| r8453 | r8454 | |
| 474 | 474 | mame_fwrite(file, &size, sizeof(UINT32)); |
| 475 | 475 | |
| 476 | 476 | /* write data block */ |
| 477 | mame_fwrite(file, messram_get_ptr( | |
| 477 | mame_fwrite(file, messram_get_ptr(m | |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | static void nc_common_open_stream_for_reading(running_machine *machine) |
| r8453 | r8454 | |
| 711 | 711 | frequency = (int)(1000000.0f/((float)((period & 0x07fff)<<1) * 1.6276f)); |
| 712 | 712 | |
| 713 | 713 | /* set state */ |
| 714 | beep_set_state( | |
| 714 | beep_set_state(m | |
| 715 | 715 | /* set frequency */ |
| 716 | beep_set_frequency( | |
| 716 | beep_set_frequency(m | |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | static WRITE8_HANDLER(nc_sound_w) |
| r8453 | r8454 | |
| 779 | 779 | |
| 780 | 780 | static TIMER_CALLBACK(nc_serial_timer_callback) |
| 781 | 781 | { |
| 782 | running_device *uart = | |
| 782 | running_device *uart = m | |
| 783 | 783 | |
| 784 | 784 | msm8251_transmit_clock(uart); |
| 785 | 785 | msm8251_receive_clock(uart); |
| r8453 | r8454 | |
| 813 | 813 | /* same for nc100 and nc200 */ |
| 814 | 814 | static void nc_printer_update(running_machine *machine, UINT8 data) |
| 815 | 815 | { |
| 816 | running_device *printer = | |
| 816 | running_device *printer = m | |
| 817 | 817 | centronics_strobe_w(printer, BIT(data, 6)); |
| 818 | 818 | } |
| 819 | 819 | |
| r8453 | r8454 | |
| 952 | 952 | nc_common_open_stream_for_reading(machine); |
| 953 | 953 | |
| 954 | 954 | { |
| 955 | running_device *rtc = | |
| 955 | running_device *rtc = m | |
| 956 | 956 | tc8521_load_stream(rtc, file); |
| 957 | 957 | } |
| 958 | 958 | |
| r8453 | r8454 | |
| 968 | 968 | { |
| 969 | 969 | nc_common_open_stream_for_writing(&machine); |
| 970 | 970 | { |
| 971 | running_device *rtc = | |
| 971 | running_device *rtc = m | |
| 972 | 972 | tc8521_save_stream(rtc, file); |
| 973 | 973 | } |
| 974 | 974 | nc_common_store_memory_to_stream(&machine); |
| r8453 | r8454 | |
| 1005 | 1005 | /* nc100 version of card/battery status */ |
| 1006 | 1006 | static READ8_HANDLER(nc100_card_battery_status_r) |
| 1007 | 1007 | { |
| 1008 | running_device *printer = | |
| 1008 | running_device *printer = | |
| 1009 | 1009 | int nc_card_battery_status = 0x0fc; |
| 1010 | 1010 | |
| 1011 | 1011 | /* printer */ |
| r8453 | r8454 | |
| 1434 | 1434 | |
| 1435 | 1435 | static READ8_HANDLER(nc200_printer_status_r) |
| 1436 | 1436 | { |
| 1437 | running_device *printer = | |
| 1437 | running_device *printer = | |
| 1438 | 1438 | UINT8 result = 0; |
| 1439 | 1439 | |
| 1440 | 1440 | result |= centronics_busy_r(printer); |
| r8453 | r8454 | |
| 1457 | 1457 | } |
| 1458 | 1458 | |
| 1459 | 1459 | /* bit 5 is used in disk interface */ |
| 1460 | LOG_DEBUG(("bit 5: PC: %04x %02x\n", cpu_get_pc( | |
| 1460 | LOG_DEBUG(("bit 5: PC: %04x %02x\n", cpu_get_pc( | |
| 1461 | 1461 | } |
| 1462 | 1462 | |
| 1463 | 1463 | |
| r8453 | r8454 | |
| 1475 | 1475 | |
| 1476 | 1476 | static WRITE8_HANDLER(nc200_memory_card_wait_state_w) |
| 1477 | 1477 | { |
| 1478 | running_device *fdc = devtag_get_device(space->machine, "upd765"); | |
| 1479 | LOG_DEBUG(("nc200 memory card wait state: PC: %04x %02x\n", cpu_get_pc(devtag_get_device(space->machine, "maincpu")), data)); | |
| 1478 | running_device *fdc = space->machine->device("upd765"); | |
| 1479 | LOG_DEBUG(("nc200 memory card wait state: PC: %04x %02x\n", cpu_get_pc(space->machine->device("maincpu")), data)); | |
| 1480 | 1480 | #if 0 |
| 1481 | 1481 | floppy_drive_set_motor_state(0, 1); |
| 1482 | 1482 | floppy_drive_set_ready_state(0, 1, 1); |
| r8453 | r8454 | |
| 1489 | 1489 | /* bit 0 seems to be the same as nc100 */ |
| 1490 | 1490 | static WRITE8_HANDLER(nc200_poweroff_control_w) |
| 1491 | 1491 | { |
| 1492 | LOG_DEBUG(("nc200 power off: PC: %04x %02x\n", cpu_get_pc( | |
| 1492 | LOG_DEBUG(("nc200 power off: PC: %04x %02x\n", cpu_get_pc( | |
| 1493 | 1493 | |
| 1494 | 1494 | nc200_video_set_backlight(((data ^ (1 << 2)) >> 2) & 0x01); |
| 1495 | 1495 | } |
| r8453 | r8454 | |
| 1629 | 1629 | /* Serial */ |
| 1630 | 1630 | static DEVICE_IMAGE_LOAD( nc_serial ) |
| 1631 | 1631 | { |
| 1632 | running_device *uart = | |
| 1632 | running_device *uart = | |
| 1633 | 1633 | |
| 1634 | 1634 | /* filename specified */ |
| 1635 | 1635 | if (device_load_serial(image)==IMAGE_INIT_PASS) |
| r8453 | r8454 | |
|---|---|---|
| 177 | 177 | { |
| 178 | 178 | if (state) |
| 179 | 179 | { |
| 180 | running_device *i8272 = dev | |
| 180 | running_device *i8272 = dev | |
| 181 | 181 | upd765_tc_w(i8272, state); |
| 182 | 182 | } |
| 183 | 183 | |
| r8453 | r8454 | |
| 315 | 315 | |
| 316 | 316 | static WRITE_LINE_DEVICE_HANDLER( p8k_i8272_irq_w ) |
| 317 | 317 | { |
| 318 | running_device *z80pio = dev | |
| 318 | running_device *z80pio = dev | |
| 319 | 319 | |
| 320 | 320 | z80pio_pb_w(z80pio, 0, (state) ? 0x10 : 0x00); |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | static UPD765_DMA_REQUEST( p8k_i8272_drq_w ) |
| 324 | 324 | { |
| 325 | running_device *z80dma = dev | |
| 325 | running_device *z80dma = dev | |
| 326 | 326 | |
| 327 | 327 | z80dma_rdy_w(z80dma, state); |
| 328 | 328 | } |
| r8453 | r8454 | |
|---|---|---|
| 112 | 112 | |
| 113 | 113 | LOG(("fd5 0x010 r: %02x %04x\n",state->fd5_databus,cpu_get_pc(space->cpu))); |
| 114 | 114 | |
| 115 | ppi8255_set_port_c(devtag_get_device(space->machine, "ppi8255"), 0x50); | |
| 116 | ppi8255_set_port_c(devtag_get_device(space->machine, "ppi8255"), 0x10); | |
| 117 | ppi8255_set_port_c(devtag_get_device(space->machine, "ppi8255"), 0x50); | |
| 115 | ppi8255_set_port_c(space->machine->device("ppi8255"), 0x50); | |
| 116 | ppi8255_set_port_c(space->machine->device("ppi8255"), 0x10); | |
| 117 | ppi8255_set_port_c(space->machine->device("ppi8255"), 0x50); | |
| 118 | 118 | |
| 119 | 119 | return state->fd5_databus; |
| 120 | 120 | } |
| r8453 | r8454 | |
| 128 | 128 | state->fd5_databus = data; |
| 129 | 129 | |
| 130 | 130 | /* set stb on data write */ |
| 131 | ppi8255_set_port_c(devtag_get_device(space->machine, "ppi8255"), 0x50); | |
| 132 | ppi8255_set_port_c(devtag_get_device(space->machine, "ppi8255"), 0x40); | |
| 133 | ppi8255_set_port_c(devtag_get_device(space->machine, "ppi8255"), 0x50); | |
| 131 | ppi8255_set_port_c(space->machine->device("ppi8255"), 0x50); | |
| 132 | ppi8255_set_port_c(space->machine->device("ppi8255"), 0x40); | |
| 133 | ppi8255_set_port_c(space->machine->device("ppi8255"), 0x50); | |
| 134 | 134 | |
| 135 | 135 | cpu_yield(space->cpu); |
| 136 | 136 | } |
| r8453 | r8454 | |
| 154 | 154 | |
| 155 | 155 | static WRITE8_HANDLER( fd5_tc_w ) |
| 156 | 156 | { |
| 157 | running_device *fdc = | |
| 157 | running_device *fdc = | |
| 158 | 158 | upd765_tc_w(fdc, 1); |
| 159 | 159 | upd765_tc_w(fdc, 0); |
| 160 | 160 | } |
| r8453 | r8454 | |
| 192 | 192 | static MACHINE_RESET( sord_m5_fd5 ) |
| 193 | 193 | { |
| 194 | 194 | MACHINE_RESET_CALL(sord_m5); |
| 195 | ppi8255_set_port_c( | |
| 195 | ppi8255_set_port_c(m | |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | |
| r8453 | r8454 | |
| 203 | 203 | { |
| 204 | 204 | sord_state *state = (sord_state *)device->machine->driver_data; |
| 205 | 205 | |
| 206 | cpu_yield(dev | |
| 206 | cpu_yield(dev | |
| 207 | 207 | |
| 208 | 208 | return state->fd5_databus; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | static READ8_DEVICE_HANDLER(sord_ppi_portb_r) |
| 212 | 212 | { |
| 213 | cpu_yield(dev | |
| 213 | cpu_yield(dev | |
| 214 | 214 | |
| 215 | LOG(("m5 read from pi5 port b %04x\n", cpu_get_pc(dev | |
| 215 | LOG(("m5 read from pi5 port b %04x\n", cpu_get_pc(dev | |
| 216 | 216 | |
| 217 | 217 | return 0x0ff; |
| 218 | 218 | } |
| r8453 | r8454 | |
| 221 | 221 | { |
| 222 | 222 | sord_state *state = (sord_state *)device->machine->driver_data; |
| 223 | 223 | |
| 224 | cpu_yield(dev | |
| 224 | cpu_yield(dev | |
| 225 | 225 | |
| 226 | LOG(("m5 read from pi5 port c %04x\n", cpu_get_pc(dev | |
| 226 | LOG(("m5 read from pi5 port c %04x\n", cpu_get_pc(dev | |
| 227 | 227 | |
| 228 | 228 | /* from fd5 */ |
| 229 | 229 | /* 00 = 0000 = write */ |
| r8453 | r8454 | |
| 254 | 254 | { |
| 255 | 255 | sord_state *state = (sord_state *)device->machine->driver_data; |
| 256 | 256 | |
| 257 | cpu_yield(dev | |
| 257 | cpu_yield(dev | |
| 258 | 258 | |
| 259 | 259 | state->fd5_databus = data; |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | static WRITE8_DEVICE_HANDLER(sord_ppi_portb_w) |
| 263 | 263 | { |
| 264 | cpu_yield(dev | |
| 264 | cpu_yield(dev | |
| 265 | 265 | |
| 266 | 266 | /* f0, 40 */ |
| 267 | 267 | /* 1111 */ |
| r8453 | r8454 | |
| 272 | 272 | cputag_set_input_line(device->machine, "floppy", INPUT_LINE_RESET, ASSERT_LINE); |
| 273 | 273 | cputag_set_input_line(device->machine, "floppy", INPUT_LINE_RESET, CLEAR_LINE); |
| 274 | 274 | } |
| 275 | LOG(("m5 write to pi5 port b: %02x %04x\n", data, cpu_get_pc(dev | |
| 275 | LOG(("m5 write to pi5 port b: %02x %04x\n", data, cpu_get_pc(dev | |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | /* A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, */ |
| r8453 | r8454 | |
| 289 | 289 | state->intra = (data & 0x08) ? 1 : 0; |
| 290 | 290 | state->ibfa = (data & 0x20) ? 1 : 0; |
| 291 | 291 | |
| 292 | cpu_yield(devtag_get_device(device->machine, "maincpu")); | |
| 293 | LOG(("m5 write to pi5 port c: %02x %04x\n", data, cpu_get_pc(devtag_get_device(device->machine, "maincpu")))); | |
| 292 | cpu_yield(device->machine->device("maincpu")); | |
| 293 | LOG(("m5 write to pi5 port c: %02x %04x\n", data, cpu_get_pc(device->machine->device("maincpu")))); | |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | static const ppi8255_interface sord_ppi8255_interface = |
| r8453 | r8454 | |
| 313 | 313 | { |
| 314 | 314 | if (state) |
| 315 | 315 | { |
| 316 | z80ctc_trg3_w(devtag_get_device(machine, "z80ctc"), 1); | |
| 317 | z80ctc_trg3_w(devtag_get_device(machine, "z80ctc"), 0); | |
| 316 | z80ctc_trg3_w(machine->device("z80ctc"), 1); | |
| 317 | z80ctc_trg3_w(machine->device("z80ctc"), 0); | |
| 318 | 318 | } |
| 319 | 319 | } |
| 320 | 320 | |
| r8453 | r8454 | |
| 330 | 330 | /* bit 7 is the reset/halt key */ |
| 331 | 331 | static READ8_HANDLER( sord_sts_r ) |
| 332 | 332 | { |
| 333 | running_device *printer = devtag_get_device(space->machine, "centronics"); | |
| 334 | running_device *cassette = devtag_get_device(space->machine, "cassette"); | |
| 333 | running_device *printer = space->machine->device("centronics"); | |
| 334 | running_device *cassette = space->machine->device("cassette"); | |
| 335 | 335 | UINT8 data = 0; |
| 336 | 336 | |
| 337 | 337 | data |= cassette_input(cassette) >= 0 ? 1 : 0; |
| r8453 | r8454 | |
| 348 | 348 | /* bit 1 is cassette remote */ |
| 349 | 349 | static WRITE8_HANDLER( sord_com_w ) |
| 350 | 350 | { |
| 351 | running_device *printer = devtag_get_device(space->machine, "centronics"); | |
| 352 | running_device *cassette = devtag_get_device(space->machine, "cassette"); | |
| 351 | running_device *printer = space->machine->device("centronics"); | |
| 352 | running_device *cassette = space->machine->device("cassette"); | |
| 353 | 353 | |
| 354 | 354 | /* cassette data */ |
| 355 | 355 | cassette_output(cassette, BIT(data, 0) ? -1.0 : 1.0); |
| r8453 | r8454 | |
|---|---|---|
| 71 | 71 | |
| 72 | 72 | case 2: /* BK1 */ |
| 73 | 73 | case 3: /* BK2 */ |
| 74 | if (messram_get_size( | |
| 74 | if (messram_get_size(m | |
| 75 | 75 | { |
| 76 | 76 | memory_install_readwrite_bank(program, 0x0000, 0x7fff, 0, 0, "bank1"); |
| 77 | 77 | } |
| r8453 | r8454 | |
| 409 | 409 | bw12_state *state =(bw12_state *) machine->driver_data; |
| 410 | 410 | |
| 411 | 411 | /* find devices */ |
| 412 | state->mc6845 = | |
| 412 | state->mc6845 = m | |
| 413 | 413 | |
| 414 | 414 | /* find memory regions */ |
| 415 | 415 | state->char_rom = memory_region(machine, "chargen"); |
| r8453 | r8454 | |
| 674 | 674 | bw12_state *state =(bw12_state *) machine->driver_data; |
| 675 | 675 | |
| 676 | 676 | /* find devices */ |
| 677 | state->pia6821 = devtag_get_device(machine, PIA6821_TAG); | |
| 678 | state->upd765 = devtag_get_device(machine, UPD765_TAG); | |
| 679 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); | |
| 677 | state->pia6821 = machine->device(PIA6821_TAG); | |
| 678 | state->upd765 = machine->device(UPD765_TAG); | |
| 679 | state->centronics = machine->device(CENTRONICS_TAG); | |
| 680 | 680 | |
| 681 | 681 | /* allocate floppy motor off timer */ |
| 682 | 682 | state->floppy_motor_off_timer = timer_alloc(machine, floppy_motor_off_tick, NULL); |
| 683 | 683 | |
| 684 | 684 | /* setup memory banking */ |
| 685 | 685 | memory_configure_bank(machine, "bank1", 0, 1, memory_region(machine, Z80_TAG), 0); |
| 686 | memory_configure_bank(machine, "bank1", 1, 1, messram_get_ptr(devtag_get_device(machine, "messram")), 0); | |
| 687 | memory_configure_bank(machine, "bank1", 2, 2, messram_get_ptr(devtag_get_device(machine, "messram")) + 0x10000, 0x8000); | |
| 686 | memory_configure_bank(machine, "bank1", 1, 1, messram_get_ptr(machine->device("messram")), 0); | |
| 687 | memory_configure_bank(machine, "bank1", 2, 2, messram_get_ptr(machine->device("messram")) + 0x10000, 0x8000); | |
| 688 | 688 | |
| 689 | 689 | /* register for state saving */ |
| 690 | 690 | state_save_register_global(machine, state->bank); |
| r8453 | r8454 | |
|---|---|---|
| 12 | 12 | static DIRECT_UPDATE_HANDLER( pentagon_direct ) |
| 13 | 13 | { |
| 14 | 14 | spectrum_state *state = (spectrum_state *)space->machine->driver_data; |
| 15 | running_device *beta = devtag_get_device(space->machine, BETA_DISK_TAG); | |
| 16 | UINT16 pc = cpu_get_reg(devtag_get_device(space->machine, "maincpu"), STATE_GENPCBASE); | |
| 15 | running_device *beta = space->machine->device(BETA_DISK_TAG); | |
| 16 | UINT16 pc = cpu_get_reg(space->machine->device("maincpu"), STATE_GENPCBASE); | |
| 17 | 17 | |
| 18 | 18 | if (beta->started() && betadisk_is_active(beta)) |
| 19 | 19 | { |
| r8453 | r8454 | |
| 49 | 49 | static void pentagon_update_memory(running_machine *machine) |
| 50 | 50 | { |
| 51 | 51 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 52 | running_device *beta = devtag_get_device(machine, BETA_DISK_TAG); | |
| 53 | UINT8 *messram = messram_get_ptr(devtag_get_device(machine, "messram")); | |
| 52 | running_device *beta = machine->device(BETA_DISK_TAG); | |
| 53 | UINT8 *messram = messram_get_ptr(machine->device("messram")); | |
| 54 | 54 | state->screen_location = messram + ((state->port_7ffd_data & 8) ? (7<<14) : (5<<14)); |
| 55 | 55 | |
| 56 | 56 | memory_set_bankptr(machine, "bank4", messram + ((state->port_7ffd_data & 0x07) * 0x4000)); |
| r8453 | r8454 | |
| 103 | 103 | static MACHINE_RESET( pentagon ) |
| 104 | 104 | { |
| 105 | 105 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 106 | UINT8 *messram = messram_get_ptr(devtag_get_device(machine, "messram")); | |
| 107 | running_device *beta = devtag_get_device(machine, BETA_DISK_TAG); | |
| 106 | UINT8 *messram = messram_get_ptr(machine->device("messram")); | |
| 107 | running_device *beta = machine->device(BETA_DISK_TAG); | |
| 108 | 108 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 109 | 109 | |
| 110 | 110 | memory_install_read_bank(space, 0x0000, 0x3fff, 0, 0, "bank1"); |
| r8453 | r8454 | |
|---|---|---|
| 21 | 21 | |
| 22 | 22 | static running_device *cassette_device_image(running_machine *machine) |
| 23 | 23 | { |
| 24 | return | |
| 24 | return m | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | static void pk8000_set_bank(running_machine *machine,UINT8 data) |
| r8453 | r8454 | |
| 35 | 35 | switch(block1) { |
| 36 | 36 | case 0: |
| 37 | 37 | memory_set_bankptr(machine, "bank1", rom + 0x10000); |
| 38 | memory_set_bankptr(machine, "bank5", messram_get_ptr( | |
| 38 | memory_set_bankptr(machine, "bank5", messram_get_ptr(m | |
| 39 | 39 | break; |
| 40 | 40 | case 1: break; |
| 41 | 41 | case 2: break; |
| 42 | 42 | case 3: |
| 43 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 44 | memory_set_bankptr(machine, "bank5", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 43 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram"))); | |
| 44 | memory_set_bankptr(machine, "bank5", messram_get_ptr(machine->device("messram"))); | |
| 45 | 45 | break; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | switch(block2) { |
| 49 | 49 | case 0: |
| 50 | 50 | memory_set_bankptr(machine, "bank2", rom + 0x14000); |
| 51 | memory_set_bankptr(machine, "bank6", messram_get_ptr( | |
| 51 | memory_set_bankptr(machine, "bank6", messram_get_ptr(m | |
| 52 | 52 | break; |
| 53 | 53 | case 1: break; |
| 54 | 54 | case 2: break; |
| 55 | 55 | case 3: |
| 56 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 57 | memory_set_bankptr(machine, "bank6", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x4000); | |
| 56 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 57 | memory_set_bankptr(machine, "bank6", messram_get_ptr(machine->device("messram")) + 0x4000); | |
| 58 | 58 | break; |
| 59 | 59 | } |
| 60 | 60 | switch(block3) { |
| 61 | 61 | case 0: |
| 62 | 62 | memory_set_bankptr(machine, "bank3", rom + 0x18000); |
| 63 | memory_set_bankptr(machine, "bank7", messram_get_ptr( | |
| 63 | memory_set_bankptr(machine, "bank7", messram_get_ptr(m | |
| 64 | 64 | break; |
| 65 | 65 | case 1: break; |
| 66 | 66 | case 2: break; |
| 67 | 67 | case 3: |
| 68 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x8000); | |
| 69 | memory_set_bankptr(machine, "bank7", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x8000); | |
| 68 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0x8000); | |
| 69 | memory_set_bankptr(machine, "bank7", messram_get_ptr(machine->device("messram")) + 0x8000); | |
| 70 | 70 | break; |
| 71 | 71 | } |
| 72 | 72 | switch(block4) { |
| 73 | 73 | case 0: |
| 74 | 74 | memory_set_bankptr(machine, "bank4", rom + 0x1c000); |
| 75 | memory_set_bankptr(machine, "bank8", messram_get_ptr( | |
| 75 | memory_set_bankptr(machine, "bank8", messram_get_ptr(m | |
| 76 | 76 | break; |
| 77 | 77 | case 1: break; |
| 78 | 78 | case 2: break; |
| 79 | 79 | case 3: |
| 80 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xc000); | |
| 81 | memory_set_bankptr(machine, "bank8", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xc000); | |
| 80 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0xc000); | |
| 81 | memory_set_bankptr(machine, "bank8", messram_get_ptr(machine->device("messram")) + 0xc000); | |
| 82 | 82 | break; |
| 83 | 83 | } |
| 84 | 84 | } |
| r8453 | r8454 | |
| 100 | 100 | { |
| 101 | 101 | keyboard_line = data & 0x0f; |
| 102 | 102 | |
| 103 | speaker_level_w(dev | |
| 103 | speaker_level_w(dev | |
| 104 | 104 | |
| 105 | 105 | cassette_change_state(cassette_device_image(device->machine), |
| 106 | 106 | (BIT(data,4)) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, |
| r8453 | r8454 | |
| 303 | 303 | static MACHINE_RESET(pk8000) |
| 304 | 304 | { |
| 305 | 305 | pk8000_set_bank(machine,0); |
| 306 | cpu_set_irq_callback( | |
| 306 | cpu_set_irq_callback(m | |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | static VIDEO_START( pk8000 ) |
| r8453 | r8454 | |
| 312 | 312 | |
| 313 | 313 | static VIDEO_UPDATE( pk8000 ) |
| 314 | 314 | { |
| 315 | return pk8000_video_update(screen, bitmap, cliprect, messram_get_ptr( | |
| 315 | return pk8000_video_update(screen, bitmap, cliprect, messram_get_ptr( | |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | /* Machine driver */ |
| r8453 | r8454 | |
|---|---|---|
| 615 | 615 | ngp_state *state = (ngp_state *)machine->driver_data; |
| 616 | 616 | |
| 617 | 617 | state->old_to3 = 0; |
| 618 | state->tlcs900 = devtag_get_device( machine, "maincpu" ); | |
| 619 | state->z80 = devtag_get_device( machine, "soundcpu" ); | |
| 620 | state->t6w28 = devtag_get_device( machine, "t6w28" ); | |
| 621 | state->dac_l = devtag_get_device( machine, "dac_l" ); | |
| 622 | state->dac_r = devtag_get_device( machine, "dac_r" ); | |
| 623 | state->k1ge = devtag_get_device( machine, "k1ge" ); | |
| 618 | state->tlcs900 = machine->device( "maincpu" ); | |
| 619 | state->z80 = machine->device( "soundcpu" ); | |
| 620 | state->t6w28 = machine->device( "t6w28" ); | |
| 621 | state->dac_l = machine->device( "dac_l" ); | |
| 622 | state->dac_r = machine->device( "dac_r" ); | |
| 623 | state->k1ge = machine->device( "k1ge" ); | |
| 624 | 624 | |
| 625 | 625 | cpu_suspend( state->z80, SUSPEND_REASON_HALT, 1 ); |
| 626 | 626 | cpu_set_input_line( state->z80, 0, CLEAR_LINE ); |
| r8453 | r8454 | |
|---|---|---|
| 248 | 248 | } |
| 249 | 249 | else |
| 250 | 250 | { |
| 251 | read_addr = write_addr = messram_get_ptr( | |
| 251 | read_addr = write_addr = messram_get_ptr(m | |
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | else |
| r8453 | r8454 | |
| 285 | 285 | else |
| 286 | 286 | { |
| 287 | 287 | /* ram bank 20 */ |
| 288 | read_addr = messram_get_ptr(devtag_get_device(machine, "messram")); | |
| 289 | write_addr = messram_get_ptr(devtag_get_device(machine, "messram")); | |
| 288 | read_addr = messram_get_ptr(machine->device("messram")); | |
| 289 | write_addr = messram_get_ptr(machine->device("messram")); | |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | z88_install_memory_handler_pair(machine, 0x0000, 0x2000, 9, read_addr, write_addr); |
| r8453 | r8454 | |
| 300 | 300 | |
| 301 | 301 | static MACHINE_RESET( z88 ) |
| 302 | 302 | { |
| 303 | memset(messram_get_ptr( | |
| 303 | memset(messram_get_ptr(m | |
| 304 | 304 | |
| 305 | 305 | blink_reset(); |
| 306 | 306 | |
| r8453 | r8454 | |
| 400 | 400 | |
| 401 | 401 | static WRITE8_HANDLER(z88_port_w) |
| 402 | 402 | { |
| 403 | running_device *speaker = | |
| 403 | running_device *speaker = | |
| 404 | 404 | unsigned char port; |
| 405 | 405 | |
| 406 | 406 | port = offset & 0x0ff; |
| r8453 | r8454 | |
| 554 | 554 | { |
| 555 | 555 | z88_blink.z88_state = Z88_SNOOZE; |
| 556 | 556 | /* spin cycles until rtc timer */ |
| 557 | cpu_spinuntil_trigger( | |
| 557 | cpu_spinuntil_trigger( | |
| 558 | 558 | |
| 559 | 559 | logerror("z88 entering snooze!\n"); |
| 560 | 560 | } |
| r8453 | r8454 | |
|---|---|---|
| 96 | 96 | UINT8 bank = BIT(data,2); |
| 97 | 97 | memory_install_write_bank(space_prg, 0x0000, 0x3fff, 0, 0, "bank1"); |
| 98 | 98 | |
| 99 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr(devtag_get_device(space->machine, "messram"))+0x0000+bank*0x8000); | |
| 100 | memory_set_bankptr(space->machine, "bank2", messram_get_ptr(devtag_get_device(space->machine, "messram"))+0x4000+bank*0x8000); | |
| 99 | memory_set_bankptr(space->machine, "bank1", messram_get_ptr(space->machine->device("messram"))+0x0000+bank*0x8000); | |
| 100 | memory_set_bankptr(space->machine, "bank2", messram_get_ptr(space->machine->device("messram"))+0x4000+bank*0x8000); | |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | static ADDRESS_MAP_START(pce220_mem, ADDRESS_SPACE_PROGRAM, 8) |
| r8453 | r8454 | |
|---|---|---|
| 62 | 62 | va_start( v, s_fmt ); |
| 63 | 63 | vsprintf( buf, s_fmt, v ); |
| 64 | 64 | va_end( v ); |
| 65 | logerror("%08x: %s", cpu_get_pc( | |
| 65 | logerror("%08x: %s", cpu_get_pc(m | |
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | #else |
| r8453 | r8454 | |
| 305 | 305 | |
| 306 | 306 | static WRITE8_DEVICE_HANDLER( sgi_kbd_put ) |
| 307 | 307 | { |
| 308 | duart68681_rx_data(dev | |
| 308 | duart68681_rx_data(dev | |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | static GENERIC_TERMINAL_INTERFACE( sgi_terminal_intf ) |
| r8453 | r8454 | |
| 379 | 379 | |
| 380 | 380 | static void duarta_tx(running_device *device, int channel, UINT8 data) |
| 381 | 381 | { |
| 382 | running_device *devconf = dev | |
| 382 | running_device *devconf = dev | |
| 383 | 383 | verboselog(device->machine, 0, "duarta_tx: %02x\n", data); |
| 384 | 384 | terminal_write(devconf,0,data); |
| 385 | 385 | } |
| r8453 | r8454 | |
| 500 | 500 | UINT32 *dst = mainram; |
| 501 | 501 | memcpy(dst, src, 8); |
| 502 | 502 | |
| 503 | | |
| 503 | m | |
| 504 | 504 | |
| 505 | 505 | mc146818_init(machine, MC146818_IGNORE_CENTURY); |
| 506 | 506 | } |
| r8453 | r8454 | |
|---|---|---|
| 407 | 407 | |
| 408 | 408 | static void pcw16_update_bank(running_machine *machine, int bank) |
| 409 | 409 | { |
| 410 | unsigned char *mem_ptr = messram_get_ptr( | |
| 410 | unsigned char *mem_ptr = messram_get_ptr(m | |
| 411 | 411 | int bank_id = 0; |
| 412 | 412 | int bank_offs = 0; |
| 413 | 413 | char bank1[10]; |
| r8453 | r8454 | |
| 445 | 445 | { |
| 446 | 446 | bank_offs = 128; |
| 447 | 447 | /* dram */ |
| 448 | mem_ptr = messram_get_ptr( | |
| 448 | mem_ptr = messram_get_ptr(m | |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | mem_ptr = mem_ptr + ((bank_id - bank_offs)<<14); |
| r8453 | r8454 | |
| 1053 | 1053 | |
| 1054 | 1054 | static WRITE8_HANDLER(pcw16_system_control_w) |
| 1055 | 1055 | { |
| 1056 | running_device *speaker = | |
| 1056 | running_device *speaker = | |
| 1057 | 1057 | //logerror("0x0f8: function: %d\n",data); |
| 1058 | 1058 | |
| 1059 | 1059 | /* lower 4 bits define function code */ |
| r8453 | r8454 | |
| 1201 | 1201 | |
| 1202 | 1202 | static running_device * pcw16_get_device(running_machine *machine) |
| 1203 | 1203 | { |
| 1204 | return | |
| 1204 | return m | |
| 1205 | 1205 | } |
| 1206 | 1206 | |
| 1207 | 1207 | static const struct pc_fdc_interface pcw16_fdc_interface= |
| r8453 | r8454 | |
| 1331 | 1331 | |
| 1332 | 1332 | static MACHINE_START( pcw16 ) |
| 1333 | 1333 | { |
| 1334 | running_device *speaker = | |
| 1334 | running_device *speaker = m | |
| 1335 | 1335 | pcw16_system_status = 0; |
| 1336 | 1336 | pcw16_interrupt_counter = 0; |
| 1337 | 1337 | |
| r8453 | r8454 | |
| 1347 | 1347 | |
| 1348 | 1348 | /* initialise mouse */ |
| 1349 | 1349 | pc_mouse_initialise(machine); |
| 1350 | pc_mouse_set_serial_port( | |
| 1350 | pc_mouse_set_serial_port( m | |
| 1351 | 1351 | |
| 1352 | 1352 | /* initialise keyboard */ |
| 1353 | 1353 | at_keyboard_init(machine, AT_KEYBOARD_TYPE_AT); |
| r8453 | r8454 | |
|---|---|---|
| 91 | 91 | |
| 92 | 92 | static WRITE8_HANDLER ( ckon_ckof_callback ) |
| 93 | 93 | { |
| 94 | running_device *maincpu = | |
| 94 | running_device *maincpu = | |
| 95 | 95 | ti990_ckon_ckof_callback(maincpu, (offset & 0x1000) ? 1 : 0); |
| 96 | 96 | } |
| 97 | 97 |
| r8453 | r8454 | |
|---|---|---|
| 37 | 37 | |
| 38 | 38 | memcpy((UINT8*)ht68k_ram,user1,0x8000); |
| 39 | 39 | |
| 40 | | |
| 40 | m | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | static void duart_irq_handler(running_device *device, UINT8 vector) |
| r8453 | r8454 | |
| 47 | 47 | |
| 48 | 48 | static void duart_tx(running_device *device, int channel, UINT8 data) |
| 49 | 49 | { |
| 50 | running_device *devconf = dev | |
| 50 | running_device *devconf = dev | |
| 51 | 51 | terminal_write(devconf,0,data); |
| 52 | 52 | } |
| 53 | 53 | |
| r8453 | r8454 | |
| 58 | 58 | |
| 59 | 59 | static void duart_output(running_device *device, UINT8 data) |
| 60 | 60 | { |
| 61 | running_device *fdc = dev | |
| 61 | running_device *fdc = dev | |
| 62 | 62 | wd17xx_set_side(fdc,BIT(data,3) ? 0 : 1); |
| 63 | 63 | if (BIT(data,7)==0) { |
| 64 | 64 | wd17xx_set_drive(fdc,0); |
| r8453 | r8454 | |
| 73 | 73 | |
| 74 | 74 | static WRITE8_DEVICE_HANDLER( ht68k_kbd_put ) |
| 75 | 75 | { |
| 76 | duart68681_rx_data(dev | |
| 76 | duart68681_rx_data(dev | |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | static GENERIC_TERMINAL_INTERFACE( ht68k_terminal_intf ) |
| r8453 | r8454 | |
|---|---|---|
| 50 | 50 | static READ8_HANDLER(vt100_flags_r) |
| 51 | 51 | { |
| 52 | 52 | UINT8 retVal = 0; |
| 53 | retVal |= vt_video_lba7_r( | |
| 53 | retVal |= vt_video_lba7_r( | |
| 54 | 54 | retVal |= vt100_keyboard_int * 0x80; |
| 55 | 55 | return retVal; |
| 56 | 56 | } |
| r8453 | r8454 | |
| 83 | 83 | static WRITE8_HANDLER(vt100_keyboard_w) |
| 84 | 84 | { |
| 85 | 85 | |
| 86 | running_device *speaker = | |
| 86 | running_device *speaker = | |
| 87 | 87 | |
| 88 | 88 | output_set_value("online_led",BIT(data,5) ? 0 : 1); |
| 89 | 89 | output_set_value("local_led", BIT(data,5)); |
| r8453 | r8454 | |
| 261 | 261 | |
| 262 | 262 | static VIDEO_UPDATE( vt100 ) |
| 263 | 263 | { |
| 264 | running_device *devconf = | |
| 264 | running_device *devconf = | |
| 265 | 265 | vt_video_update( devconf, bitmap, cliprect); |
| 266 | 266 | return 0; |
| 267 | 267 | } |
| r8453 | r8454 | |
| 299 | 299 | |
| 300 | 300 | vt100_key_scan = 0; |
| 301 | 301 | |
| 302 | cpu_set_irq_callback( | |
| 302 | cpu_set_irq_callback(m | |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | static READ8_DEVICE_HANDLER (vt100_read_video_ram_r ) |
| r8453 | r8454 | |
|---|---|---|
| 153 | 153 | { |
| 154 | 154 | prof80_state *state = (prof80_state *)machine->driver_data; |
| 155 | 155 | const address_space *program = cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM); |
| 156 | UINT8 *ram = messram_get_ptr( | |
| 156 | UINT8 *ram = messram_get_ptr(m | |
| 157 | 157 | UINT8 *rom = memory_region(machine, Z80_TAG); |
| 158 | 158 | int bank; |
| 159 | 159 | |
| r8453 | r8454 | |
| 1187 | 1187 | prof80_state *state = (prof80_state *)machine->driver_data; |
| 1188 | 1188 | |
| 1189 | 1189 | /* find devices */ |
| 1190 | state->upd765 = devtag_get_device(machine, UPD765_TAG); | |
| 1191 | state->upd1990a = devtag_get_device(machine, UPD1990A_TAG); | |
| 1190 | state->upd765 = machine->device(UPD765_TAG); | |
| 1191 | state->upd1990a = machine->device(UPD1990A_TAG); | |
| 1192 | 1192 | |
| 1193 | 1193 | /* initialize RTC */ |
| 1194 | 1194 | upd1990a_cs_w(state->upd1990a, 1); |
| r8453 | r8454 | |
| 1235 | 1235 | MACHINE_START_CALL(prof80); |
| 1236 | 1236 | |
| 1237 | 1237 | /* find devices */ |
| 1238 | state->mc6845 = devtag_get_device(machine, MC6845_TAG); | |
| 1239 | state->ppi8255 = devtag_get_device(machine, I8255A_TAG); | |
| 1240 | state->z80sti = devtag_get_device(machine, Z80STI_TAG); | |
| 1241 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); | |
| 1238 | state->mc6845 = machine->device(MC6845_TAG); | |
| 1239 | state->ppi8255 = machine->device(I8255A_TAG); | |
| 1240 | state->z80sti = machine->device(Z80STI_TAG); | |
| 1241 | state->centronics = machine->device(CENTRONICS_TAG); | |
| 1242 | 1242 | |
| 1243 | 1243 | /* allocate video RAM */ |
| 1244 | 1244 | state->video_ram = auto_alloc_array(machine, UINT8, GRIP_VIDEORAM_SIZE); |
| r8453 | r8454 | |
|---|---|---|
| 16 | 16 | |
| 17 | 17 | static WRITE8_HANDLER(microdec_terminal_w) |
| 18 | 18 | { |
| 19 | running_device *devconf = | |
| 19 | running_device *devconf = | |
| 20 | 20 | terminal_write(devconf,0,data); |
| 21 | 21 | } |
| 22 | 22 |
| r8453 | r8454 | |
|---|---|---|
| 200 | 200 | |
| 201 | 201 | static MACHINE_RESET( dc_console ) |
| 202 | 202 | { |
| 203 | running_device *aica = | |
| 203 | running_device *aica = m | |
| 204 | 204 | MACHINE_RESET_CALL(dc); |
| 205 | 205 | aica_set_ram_base(aica, dc_sound_ram, 2*1024*1024); |
| 206 | 206 | dreamcast_atapi_reset(machine); |
| r8453 | r8454 | |
|---|---|---|
| 463 | 463 | |
| 464 | 464 | static IRQ_CALLBACK(pasogo_irq_callback) |
| 465 | 465 | { |
| 466 | return pic8259_acknowledge( dev | |
| 466 | return pic8259_acknowledge( dev | |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | static MACHINE_RESET( pasogo ) |
| 470 | 470 | { |
| 471 | cpu_set_irq_callback( | |
| 471 | cpu_set_irq_callback(m | |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | //static const unsigned i86_address_mask = 0x000fffff; |
| r8453 | r8454 | |
|---|---|---|
| 62 | 62 | */ |
| 63 | 63 | static READ8_HANDLER( cassette_r ) |
| 64 | 64 | { |
| 65 | running_device *cassette = | |
| 65 | running_device *cassette = | |
| 66 | 66 | return (cassette_input(cassette) < +0.0) ? 0 : 1; |
| 67 | 67 | } |
| 68 | 68 | |
| r8453 | r8454 | |
| 74 | 74 | */ |
| 75 | 75 | static WRITE8_HANDLER( cassette_w ) |
| 76 | 76 | { |
| 77 | running_device *speaker = devtag_get_device(space->machine, "speaker"); | |
| 78 | running_device *cassette = devtag_get_device(space->machine, "cassette"); | |
| 77 | running_device *speaker = space->machine->device("speaker"); | |
| 78 | running_device *cassette = space->machine->device("cassette"); | |
| 79 | 79 | |
| 80 | 80 | speaker_level_w(speaker, BIT(data, 0)); |
| 81 | 81 | cassette_output(cassette, BIT(data, 0) ? +1.0 : -1.0); |
| r8453 | r8454 | |
| 215 | 215 | static DRIVER_INIT( aquarius ) |
| 216 | 216 | { |
| 217 | 217 | /* install expansion memory if available */ |
| 218 | if (messram_get_size( | |
| 218 | if (messram_get_size(m | |
| 219 | 219 | { |
| 220 | 220 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 221 | 221 | |
| 222 | memory_install_readwrite_bank(space, 0x4000, 0x4000 + messram_get_size(devtag_get_device(machine, "messram")) - 0x1000 - 1, 0, 0, "bank1"); | |
| 223 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 222 | memory_install_readwrite_bank(space, 0x4000, 0x4000 + messram_get_size(machine->device("messram")) - 0x1000 - 1, 0, 0, "bank1"); | |
| 223 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram"))); | |
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 |
| r8453 | r8454 | |
|---|---|---|
| 139 | 139 | |
| 140 | 140 | static QUICKLOAD_LOAD( lynx ) |
| 141 | 141 | { |
| 142 | running_device *cpu = | |
| 142 | running_device *cpu = | |
| 143 | 143 | const address_space *space = cputag_get_address_space(image.device().machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 144 | 144 | UINT8 *data = NULL; |
| 145 | 145 | UINT8 *rom = memory_region(image.device().machine, "maincpu"); |
| r8453 | r8454 | |
| 176 | 176 | memory_write_byte(space, 0x1fc, start & 0xff); |
| 177 | 177 | memory_write_byte(space, 0x1fd, start >> 8); |
| 178 | 178 | |
| 179 | lynx_crc_keyword((device_image_interface&)* | |
| 179 | lynx_crc_keyword((device_image_interface&)* | |
| 180 | 180 | |
| 181 | 181 | cpu_set_reg(cpu, STATE_GENPC, start); |
| 182 | 182 |
| r8453 | r8454 | |
|---|---|---|
| 185 | 185 | { |
| 186 | 186 | spectrum_state *state = (spectrum_state *)space->machine->driver_data; |
| 187 | 187 | if (state->floppy==1) |
| 188 | upd765_data_w( | |
| 188 | upd765_data_w( | |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | static READ8_HANDLER(spectrum_plus3_port_3ffd_r) |
| r8453 | r8454 | |
| 194 | 194 | if (state->floppy==0) |
| 195 | 195 | return 0xff; |
| 196 | 196 | else |
| 197 | return upd765_data_r( | |
| 197 | return upd765_data_r( | |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | |
| r8453 | r8454 | |
| 204 | 204 | if (state->floppy==0) |
| 205 | 205 | return 0xff; |
| 206 | 206 | else |
| 207 | return upd765_status_r( | |
| 207 | return upd765_status_r( | |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | |
| r8453 | r8454 | |
| 212 | 212 | { |
| 213 | 213 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 214 | 214 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 215 | UINT8 *messram = messram_get_ptr( | |
| 215 | UINT8 *messram = messram_get_ptr(m | |
| 216 | 216 | |
| 217 | 217 | if (state->port_7ffd_data & 8) |
| 218 | 218 | { |
| r8453 | r8454 | |
| 355 | 355 | static MACHINE_RESET( spectrum_plus3 ) |
| 356 | 356 | { |
| 357 | 357 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 358 | UINT8 *messram = messram_get_ptr( | |
| 358 | UINT8 *messram = messram_get_ptr(m | |
| 359 | 359 | memset(messram,0,128*1024); |
| 360 | 360 | |
| 361 | 361 | MACHINE_RESET_CALL(spectrum); |
| r8453 | r8454 | |
|---|---|---|
| 607 | 607 | |
| 608 | 608 | apexc_draw_led(bitmap, 0, 0, 1); |
| 609 | 609 | |
| 610 | apexc_draw_led(bitmap, 0, 8, cpu_get_reg( | |
| 610 | apexc_draw_led(bitmap, 0, 8, cpu_get_reg( | |
| 611 | 611 | |
| 612 | 612 | for (i=0; i<32; i++) |
| 613 | 613 | { |
| r8453 | r8454 | |
|---|---|---|
| 349 | 349 | // 4 channel DMA controller (Hitachi HD63450) |
| 350 | 350 | static WRITE16_HANDLER( x68k_dmac_w ) |
| 351 | 351 | { |
| 352 | running_device* device = | |
| 352 | running_device* device = | |
| 353 | 353 | hd63450_w(device, offset, data, mem_mask); |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | static READ16_HANDLER( x68k_dmac_r ) |
| 357 | 357 | { |
| 358 | running_device* device = | |
| 358 | running_device* device = | |
| 359 | 359 | return hd63450_r(device, offset, mem_mask); |
| 360 | 360 | } |
| 361 | 361 | |
| r8453 | r8454 | |
| 537 | 537 | // typically read from the SCC data port on receive buffer full interrupt per byte |
| 538 | 538 | static int x68k_read_mouse(running_machine *machine) |
| 539 | 539 | { |
| 540 | running_device *scc = | |
| 540 | running_device *scc = m | |
| 541 | 541 | char val = 0; |
| 542 | 542 | char ipt = 0; |
| 543 | 543 | |
| r8453 | r8454 | |
| 582 | 582 | */ |
| 583 | 583 | static READ16_HANDLER( x68k_scc_r ) |
| 584 | 584 | { |
| 585 | running_device *scc = | |
| 585 | running_device *scc = | |
| 586 | 586 | offset %= 4; |
| 587 | 587 | switch(offset) |
| 588 | 588 | { |
| r8453 | r8454 | |
| 601 | 601 | |
| 602 | 602 | static WRITE16_HANDLER( x68k_scc_w ) |
| 603 | 603 | { |
| 604 | running_device *scc = | |
| 604 | running_device *scc = | |
| 605 | 605 | static unsigned char prev; |
| 606 | 606 | offset %= 4; |
| 607 | 607 | |
| r8453 | r8454 | |
| 635 | 635 | |
| 636 | 636 | static TIMER_CALLBACK(x68k_scc_ack) |
| 637 | 637 | { |
| 638 | running_device *scc = | |
| 638 | running_device *scc = m | |
| 639 | 639 | if(x68k_sys.mouse.bufferempty != 0) // nothing to do if the mouse data buffer is empty |
| 640 | 640 | return; |
| 641 | 641 | |
| r8453 | r8454 | |
| 660 | 660 | |
| 661 | 661 | static void x68k_set_adpcm(running_machine* machine) |
| 662 | 662 | { |
| 663 | running_device *dev = | |
| 663 | running_device *dev = m | |
| 664 | 664 | UINT32 rate = 0; |
| 665 | 665 | |
| 666 | 666 | switch(x68k_sys.adpcm.rate & 0x0c) |
| r8453 | r8454 | |
| 917 | 917 | static WRITE8_DEVICE_HANDLER( ppi_port_c_w ) |
| 918 | 918 | { |
| 919 | 919 | // ADPCM / Joystick control |
| 920 | running_device *oki = dev | |
| 920 | running_device *oki = dev | |
| 921 | 921 | static UINT16 prev1; |
| 922 | 922 | static UINT16 prev2; |
| 923 | 923 | static UINT16 prevA; |
| r8453 | r8454 | |
| 960 | 960 | // NEC uPD72065 at 0xe94000 |
| 961 | 961 | static WRITE16_HANDLER( x68k_fdc_w ) |
| 962 | 962 | { |
| 963 | running_device *fdc = | |
| 963 | running_device *fdc = | |
| 964 | 964 | unsigned int drive, x; |
| 965 | 965 | switch(offset) |
| 966 | 966 | { |
| r8453 | r8454 | |
| 1038 | 1038 | { |
| 1039 | 1039 | unsigned int ret; |
| 1040 | 1040 | int x; |
| 1041 | running_device *fdc = | |
| 1041 | running_device *fdc = | |
| 1042 | 1042 | |
| 1043 | 1043 | switch(offset) |
| 1044 | 1044 | { |
| r8453 | r8454 | |
| 1087 | 1087 | static int x68k_fdc_read_byte(running_machine *machine,int addr) |
| 1088 | 1088 | { |
| 1089 | 1089 | int data = -1; |
| 1090 | running_device *fdc = | |
| 1090 | running_device *fdc = m | |
| 1091 | 1091 | |
| 1092 | 1092 | if(x68k_sys.fdc.drq_state != 0) |
| 1093 | 1093 | data = upd765_dack_r(fdc, 0); |
| r8453 | r8454 | |
| 1097 | 1097 | |
| 1098 | 1098 | static void x68k_fdc_write_byte(running_machine *machine,int addr, int data) |
| 1099 | 1099 | { |
| 1100 | running_device *fdc = | |
| 1100 | running_device *fdc = m | |
| 1101 | 1101 | upd765_dack_w(fdc, 0, data); |
| 1102 | 1102 | } |
| 1103 | 1103 | |
| r8453 | r8454 | |
| 1112 | 1112 | { |
| 1113 | 1113 | case 0x00: |
| 1114 | 1114 | case 0x01: |
| 1115 | ym2151_w( | |
| 1115 | ym2151_w( | |
| 1116 | 1116 | break; |
| 1117 | 1117 | } |
| 1118 | 1118 | } |
| r8453 | r8454 | |
| 1120 | 1120 | static READ16_HANDLER( x68k_fm_r ) |
| 1121 | 1121 | { |
| 1122 | 1122 | if(offset == 0x01) |
| 1123 | return ym2151_r( | |
| 1123 | return ym2151_r( | |
| 1124 | 1124 | |
| 1125 | 1125 | return 0xffff; |
| 1126 | 1126 | } |
| 1127 | 1127 | |
| 1128 | 1128 | static WRITE8_DEVICE_HANDLER( x68k_ct_w ) |
| 1129 | 1129 | { |
| 1130 | running_device *fdc = devtag_get_device(device->machine, "upd72065"); | |
| 1131 | running_device *okim = devtag_get_device(device->machine, "okim6258"); | |
| 1130 | running_device *fdc = device->machine->device("upd72065"); | |
| 1131 | running_device *okim = device->machine->device("okim6258"); | |
| 1132 | 1132 | |
| 1133 | 1133 | // CT1 and CT2 bits from YM2151 port 0x1b |
| 1134 | 1134 | // CT1 - ADPCM clock - 0 = 8MHz, 1 = 4MHz |
| r8453 | r8454 | |
| 1265 | 1265 | #ifdef UNUSED_FUNCTION |
| 1266 | 1266 | static READ16_HANDLER( x68k_mfp_r ) |
| 1267 | 1267 | { |
| 1268 | running_device *x68k_mfp = | |
| 1268 | running_device *x68k_mfp = | |
| 1269 | 1269 | |
| 1270 | 1270 | return mc68901_register_r(x68k_mfp, offset); |
| 1271 | 1271 | } |
| r8453 | r8454 | |
| 1273 | 1273 | |
| 1274 | 1274 | static READ16_HANDLER( x68k_mfp_r ) |
| 1275 | 1275 | { |
| 1276 | running_device *x68k_mfp = | |
| 1276 | running_device *x68k_mfp = | |
| 1277 | 1277 | // Initial settings indicate that IRQs are generated for FM (YM2151), Receive buffer error or full, |
| 1278 | 1278 | // MFP Timer C, and the power switch |
| 1279 | 1279 | // logerror("MFP: [%08x] Reading offset %i\n",cpu_get_pc(space->cpu),offset); |
| r8453 | r8454 | |
| 1337 | 1337 | |
| 1338 | 1338 | static WRITE16_HANDLER( x68k_mfp_w ) |
| 1339 | 1339 | { |
| 1340 | running_device *x68k_mfp = | |
| 1340 | running_device *x68k_mfp = | |
| 1341 | 1341 | |
| 1342 | 1342 | /* For the Interrupt registers, the bits are set out as such: |
| 1343 | 1343 | Reg A - bit 7: GPIP7 (HSync) |
| r8453 | r8454 | |
| 1518 | 1518 | // if(offset == 0x5a/2) // 0x5a should be 0 if no SASI HDs are present. |
| 1519 | 1519 | // return 0x0000; |
| 1520 | 1520 | if(offset == 0x08/2) |
| 1521 | return messram_get_size( | |
| 1521 | return messram_get_size( | |
| 1522 | 1522 | #if 0 |
| 1523 | 1523 | if(offset == 0x46/2) |
| 1524 | 1524 | return 0x0024; |
| r8453 | r8454 | |
| 1533 | 1533 | static READ32_HANDLER( x68k_sram32_r ) |
| 1534 | 1534 | { |
| 1535 | 1535 | if(offset == 0x08/4) |
| 1536 | return (messram_get_size( | |
| 1536 | return (messram_get_size( | |
| 1537 | 1537 | #if 0 |
| 1538 | 1538 | if(offset == 0x46/2) |
| 1539 | 1539 | return 0x0024; |
| r8453 | r8454 | |
| 1659 | 1659 | v = 0x09; |
| 1660 | 1660 | |
| 1661 | 1661 | // rather hacky, but this generally works for programs that check for MIDI hardware |
| 1662 | if(messram_get_ptr( | |
| 1662 | if(messram_get_ptr(m | |
| 1663 | 1663 | { |
| 1664 | int addr = (messram_get_ptr(devtag_get_device(machine, "messram"))[0x09] << 24) | (messram_get_ptr(devtag_get_device(machine, "messram"))[0x08] << 16) |(messram_get_ptr(devtag_get_device(machine, "messram"))[0x0b] << 8) | messram_get_ptr(devtag_get_device(machine, "messram"))[0x0a]; | |
| 1665 | int sp = cpu_get_reg(devtag_get_device(machine, "maincpu"), STATE_GENSP); | |
| 1666 | int pc = cpu_get_reg(devtag_get_device(machine, "maincpu"), STATE_GENPC); | |
| 1667 | int sr = cpu_get_reg(devtag_get_device(machine, "maincpu"), M68K_SR); | |
| 1668 | //int pda = cpu_get_reg(devtag_get_device(machine, "maincpu"), M68K_PREF_DATA); | |
| 1664 | int addr = (messram_get_ptr(machine->device("messram"))[0x09] << 24) | (messram_get_ptr(machine->device("messram"))[0x08] << 16) |(messram_get_ptr(machine->device("messram"))[0x0b] << 8) | messram_get_ptr(machine->device("messram"))[0x0a]; | |
| 1665 | int sp = cpu_get_reg(machine->device("maincpu"), STATE_GENSP); | |
| 1666 | int pc = cpu_get_reg(machine->device("maincpu"), STATE_GENPC); | |
| 1667 | int sr = cpu_get_reg(machine->device("maincpu"), M68K_SR); | |
| 1668 | //int pda = cpu_get_reg(machine->device("maincpu"), M68K_PREF_DATA); | |
| 1669 | 1669 | if(strcmp(machine->gamedrv->name,"x68030") == 0) |
| 1670 | 1670 | { // byte order varies on the 68030 |
| 1671 | addr = (messram_get_ptr( | |
| 1671 | addr = (messram_get_ptr(m | |
| 1672 | 1672 | } |
| 1673 | cpu_set_reg(devtag_get_device(machine, "maincpu"), STATE_GENSP, sp - 14); | |
| 1674 | messram_get_ptr(devtag_get_device(machine, "messram"))[sp-11] = (val & 0xff000000) >> 24; | |
| 1675 | messram_get_ptr(devtag_get_device(machine, "messram"))[sp-12] = (val & 0x00ff0000) >> 16; | |
| 1676 | messram_get_ptr(devtag_get_device(machine, "messram"))[sp-9] = (val & 0x0000ff00) >> 8; | |
| 1677 | messram_get_ptr(devtag_get_device(machine, "messram"))[sp-10] = (val & 0x000000ff); // place address onto the stack | |
| 1678 | messram_get_ptr(devtag_get_device(machine, "messram"))[sp-3] = (pc & 0xff000000) >> 24; | |
| 1679 | messram_get_ptr(devtag_get_device(machine, "messram"))[sp-4] = (pc & 0x00ff0000) >> 16; | |
| 1680 | messram_get_ptr(devtag_get_device(machine, "messram"))[sp-1] = (pc & 0x0000ff00) >> 8; | |
| 1681 | messram_get_ptr(devtag_get_device(machine, "messram"))[sp-2] = (pc & 0x000000ff); // place PC onto the stack | |
| 1682 | messram_get_ptr(devtag_get_device(machine, "messram"))[sp-5] = (sr & 0xff00) >> 8; | |
| 1683 | messram_get_ptr(devtag_get_device(machine, "messram"))[sp-6] = (sr & 0x00ff); // place SR onto the stack | |
| 1684 | cpu_set_reg(devtag_get_device(machine, "maincpu"), STATE_GENPC, addr); // real exceptions seem to take too long to be acknowledged | |
| 1673 | cpu_set_reg(machine->device("maincpu"), STATE_GENSP, sp - 14); | |
| 1674 | messram_get_ptr(machine->device("messram"))[sp-11] = (val & 0xff000000) >> 24; | |
| 1675 | messram_get_ptr(machine->device("messram"))[sp-12] = (val & 0x00ff0000) >> 16; | |
| 1676 | messram_get_ptr(machine->device("messram"))[sp-9] = (val & 0x0000ff00) >> 8; | |
| 1677 | messram_get_ptr(machine->device("messram"))[sp-10] = (val & 0x000000ff); // place address onto the stack | |
| 1678 | messram_get_ptr(machine->device("messram"))[sp-3] = (pc & 0xff000000) >> 24; | |
| 1679 | messram_get_ptr(machine->device("messram"))[sp-4] = (pc & 0x00ff0000) >> 16; | |
| 1680 | messram_get_ptr(machine->device("messram"))[sp-1] = (pc & 0x0000ff00) >> 8; | |
| 1681 | messram_get_ptr(machine->device("messram"))[sp-2] = (pc & 0x000000ff); // place PC onto the stack | |
| 1682 | messram_get_ptr(machine->device("messram"))[sp-5] = (sr & 0xff00) >> 8; | |
| 1683 | messram_get_ptr(machine->device("messram"))[sp-6] = (sr & 0x00ff); // place SR onto the stack | |
| 1684 | cpu_set_reg(machine->device("maincpu"), STATE_GENPC, addr); // real exceptions seem to take too long to be acknowledged | |
| 1685 | 1685 | popmessage("Expansion access [%08x]: PC jump to %08x", val, addr); |
| 1686 | 1686 | } |
| 1687 | 1687 | } |
| r8453 | r8454 | |
| 1785 | 1785 | |
| 1786 | 1786 | static void x68k_dma_irq(running_machine *machine, int channel) |
| 1787 | 1787 | { |
| 1788 | running_device *device = | |
| 1788 | running_device *device = m | |
| 1789 | 1789 | current_vector[3] = hd63450_get_vector(device, channel); |
| 1790 | 1790 | current_irq_line = 3; |
| 1791 | 1791 | logerror("DMA#%i: DMA End (vector 0x%02x)\n",channel,current_vector[3]); |
| r8453 | r8454 | |
| 1802 | 1802 | |
| 1803 | 1803 | static void x68k_dma_error(running_machine *machine, int channel, int irq) |
| 1804 | 1804 | { |
| 1805 | running_device *device = | |
| 1805 | running_device *device = m | |
| 1806 | 1806 | if(irq != 0) |
| 1807 | 1807 | { |
| 1808 | 1808 | current_vector[3] = hd63450_get_error_vector(device,channel); |
| r8453 | r8454 | |
| 1881 | 1881 | |
| 1882 | 1882 | static IRQ_CALLBACK(x68k_int_ack) |
| 1883 | 1883 | { |
| 1884 | running_device *x68k_mfp = dev | |
| 1884 | running_device *x68k_mfp = dev | |
| 1885 | 1885 | |
| 1886 | 1886 | if(irqline == 6) // MFP |
| 1887 | 1887 | { |
| r8453 | r8454 | |
| 2417 | 2417 | UINT8* romdata = memory_region(machine, "user2"); |
| 2418 | 2418 | attotime irq_time; |
| 2419 | 2419 | |
| 2420 | memset(messram_get_ptr(devtag_get_device(machine, "messram")),0,messram_get_size(devtag_get_device(machine, "messram"))); | |
| 2421 | memcpy(messram_get_ptr(devtag_get_device(machine, "messram")),romdata,8); | |
| 2420 | memset(messram_get_ptr(machine->device("messram")),0,messram_get_size(machine->device("messram"))); | |
| 2421 | memcpy(messram_get_ptr(machine->device("messram")),romdata,8); | |
| 2422 | 2422 | |
| 2423 | 2423 | // init keyboard |
| 2424 | 2424 | x68k_sys.keyboard.delay = 500; // 3*100+200 |
| r8453 | r8454 | |
| 2477 | 2477 | } |
| 2478 | 2478 | |
| 2479 | 2479 | // reset CPU |
| 2480 | | |
| 2480 | m | |
| 2481 | 2481 | } |
| 2482 | 2482 | |
| 2483 | 2483 | static MACHINE_START( x68000 ) |
| r8453 | r8454 | |
| 2487 | 2487 | x68k_spriteram = (UINT16*)memory_region(machine, "user1"); |
| 2488 | 2488 | memory_install_read16_handler(space,0x000000,0xbffffb,0xffffffff,0,(read16_space_func)x68k_emptyram_r); |
| 2489 | 2489 | memory_install_write16_handler(space,0x000000,0xbffffb,0xffffffff,0,(write16_space_func)x68k_emptyram_w); |
| 2490 | memory_install_readwrite_bank(space,0x000000,messram_get_size(devtag_get_device(machine, "messram"))-1,0xffffffff,0,"bank1"); | |
| 2491 | memory_set_bankptr(machine, "bank1",messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 2490 | memory_install_readwrite_bank(space,0x000000,messram_get_size(machine->device("messram"))-1,0xffffffff,0,"bank1"); | |
| 2491 | memory_set_bankptr(machine, "bank1",messram_get_ptr(machine->device("messram"))); | |
| 2492 | 2492 | memory_install_read16_handler(space,0xc00000,0xdfffff,0xffffffff,0,x68k_gvram_r); |
| 2493 | 2493 | memory_install_write16_handler(space,0xc00000,0xdfffff,0xffffffff,0,x68k_gvram_w); |
| 2494 | 2494 | memory_set_bankptr(machine, "bank2",x68k_gvram); // so that code in VRAM is executable - needed for Terra Cresta |
| r8453 | r8454 | |
| 2517 | 2517 | x68k_spriteram = (UINT16*)memory_region(machine, "user1"); |
| 2518 | 2518 | memory_install_read32_handler(space,0x000000,0xbffffb,0xffffffff,0,(read32_space_func)x68k_rom0_r); |
| 2519 | 2519 | memory_install_write32_handler(space,0x000000,0xbffffb,0xffffffff,0,(write32_space_func)x68k_rom0_w); |
| 2520 | memory_install_readwrite_bank(space,0x000000,messram_get_size( | |
| 2520 | memory_install_readwrite_bank(space,0x000000,messram_get_size(m | |
| 2521 | 2521 | // mirror? Human68k 3.02 explicitly adds 0x3000000 to some pointers |
| 2522 | memory_install_readwrite_bank(space,0x3000000,0x3000000+messram_get_size(devtag_get_device(machine, "messram"))-1,0xffffffff,0,"bank5"); | |
| 2523 | memory_set_bankptr(machine, "bank1",messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 2524 | memory_set_bankptr(machine, "bank5",messram_get_ptr(devtag_get_device(machine, "messram"))); | |
| 2522 | memory_install_readwrite_bank(space,0x3000000,0x3000000+messram_get_size(machine->device("messram"))-1,0xffffffff,0,"bank5"); | |
| 2523 | memory_set_bankptr(machine, "bank1",messram_get_ptr(machine->device("messram"))); | |
| 2524 | memory_set_bankptr(machine, "bank5",messram_get_ptr(machine->device("messram"))); | |
| 2525 | 2525 | memory_install_read32_handler(space,0xc00000,0xdfffff,0xffffffff,0,x68k_gvram32_r); |
| 2526 | 2526 | memory_install_write32_handler(space,0xc00000,0xdfffff,0xffffffff,0,x68k_gvram32_w); |
| 2527 | 2527 | memory_set_bankptr(machine, "bank2",x68k_gvram); // so that code in VRAM is executable - needed for Terra Cresta |
| r8453 | r8454 | |
| 2567 | 2567 | |
| 2568 | 2568 | mfp_init(); |
| 2569 | 2569 | |
| 2570 | cpu_set_irq_callback( | |
| 2570 | cpu_set_irq_callback(m | |
| 2571 | 2571 | |
| 2572 | 2572 | // init keyboard |
| 2573 | 2573 | x68k_sys.keyboard.delay = 500; // 3*100+200 |
| r8453 | r8454 | |
|---|---|---|
| 147 | 147 | victor9k_state *state = (victor9k_state *)machine->driver_data; |
| 148 | 148 | |
| 149 | 149 | /* find devices */ |
| 150 | state->crt = | |
| 150 | state->crt = m | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | static VIDEO_UPDATE( victor9k ) |
| r8453 | r8454 | |
| 980 | 980 | cpu_set_irq_callback(machine->firstcpu, victor9k_irq_callback); |
| 981 | 981 | |
| 982 | 982 | /* find devices */ |
| 983 | state->ieee488 = devtag_get_device(machine, IEEE488_TAG); | |
| 984 | state->pic = devtag_get_device(machine, I8259A_TAG); | |
| 985 | state->ssda = devtag_get_device(machine, MC6852_TAG); | |
| 986 | state->cvsd = devtag_get_device(machine, HC55516_TAG); | |
| 987 | state->floppy[0].image = devtag_get_device(machine, FLOPPY_0); | |
| 988 | state->floppy[1].image = devtag_get_device(machine, FLOPPY_1); | |
| 983 | state->ieee488 = machine->device(IEEE488_TAG); | |
| 984 | state->pic = machine->device(I8259A_TAG); | |
| 985 | state->ssda = machine->device(MC6852_TAG); | |
| 986 | state->cvsd = machine->device(HC55516_TAG); | |
| 987 | state->floppy[0].image = machine->device(FLOPPY_0); | |
| 988 | state->floppy[1].image = machine->device(FLOPPY_1); | |
| 989 | 989 | |
| 990 | 990 | /* memory banking */ |
| 991 | 991 | const address_space *program = cputag_get_address_space(machine, I8088_TAG, ADDRESS_SPACE_PROGRAM); |
| 992 | UINT8 *ram = messram_get_ptr(devtag_get_device(machine, "messram")); | |
| 993 | int ram_size = messram_get_size(devtag_get_device(machine, "messram")); | |
| 992 | UINT8 *ram = messram_get_ptr(machine->device("messram")); | |
| 993 | int ram_size = messram_get_size(machine->device("messram")); | |
| 994 | 994 | |
| 995 | 995 | memory_install_ram(program, 0x00000, ram_size - 1, 0, 0, ram); |
| 996 | 996 | } |
| r8453 | r8454 | |
|---|---|---|
| 432 | 432 | { |
| 433 | 433 | pc8001_state *state = (pc8001_state *)machine->driver_data; |
| 434 | 434 | const address_space *program = cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM); |
| 435 | running_device *messram = | |
| 435 | running_device *messram = m | |
| 436 | 436 | |
| 437 | 437 | /* look up devices */ |
| 438 | state->i8257 = devtag_get_device(machine, I8257_TAG); | |
| 439 | state->upd1990a = devtag_get_device(machine, UPD1990A_TAG); | |
| 440 | state->upd3301 = devtag_get_device(machine, UPD3301_TAG); | |
| 441 | state->speaker = devtag_get_device(machine, SPEAKER_TAG); | |
| 442 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 443 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); | |
| 438 | state->i8257 = machine->device(I8257_TAG); | |
| 439 | state->upd1990a = machine->device(UPD1990A_TAG); | |
| 440 | state->upd3301 = machine->device(UPD3301_TAG); | |
| 441 | state->speaker = machine->device(SPEAKER_TAG); | |
| 442 | state->cassette = machine->device(CASSETTE_TAG); | |
| 443 | state->centronics = machine->device(CENTRONICS_TAG); | |
| 444 | 444 | |
| 445 | 445 | /* initialize RTC */ |
| 446 | 446 | upd1990a_cs_w(state->upd1990a, 1); |
| r8453 | r8454 | |
|---|---|---|
| 240 | 240 | beta_state *state = (beta_state *)machine->driver_data; |
| 241 | 241 | |
| 242 | 242 | /* find devices */ |
| 243 | state->speaker = | |
| 243 | state->speaker = m | |
| 244 | 244 | |
| 245 | 245 | state->led_refresh_timer = timer_alloc(machine, led_refresh, 0); |
| 246 | 246 |
| r8453 | r8454 | |
|---|---|---|
| 994 | 994 | px4_state *px4 = (px4_state *)machine->driver_data; |
| 995 | 995 | |
| 996 | 996 | /* find devices */ |
| 997 | px4->ram = | |
| 997 | px4->ram = m | |
| 998 | 998 | |
| 999 | 999 | /* init 7508 */ |
| 1000 | 1000 | px4->one_sec_int_enabled = TRUE; |
| r8453 | r8454 | |
| 1006 | 1006 | px4->transmit_timer = timer_alloc(machine, transmit_data, NULL); |
| 1007 | 1007 | |
| 1008 | 1008 | /* printer */ |
| 1009 | px4->printer = | |
| 1009 | px4->printer = m | |
| 1010 | 1010 | |
| 1011 | 1011 | /* external cassette or barcode reader */ |
| 1012 | 1012 | px4->ext_cas_timer = timer_alloc(machine, ext_cassette_read, NULL); |
| 1013 | px4->ext_cas = | |
| 1013 | px4->ext_cas = m | |
| 1014 | 1014 | px4->ear_last_state = 0; |
| 1015 | 1015 | |
| 1016 | 1016 | /* external devices */ |
| 1017 | px4->sio_device = | |
| 1017 | px4->sio_device = m | |
| 1018 | 1018 | px4->rs232c_device = NULL; |
| 1019 | 1019 | |
| 1020 | 1020 | /* map os rom and last half of memory */ |
| r8453 | r8454 | |
|---|---|---|
| 268 | 268 | poly880_state *state = (poly880_state *)machine->driver_data; |
| 269 | 269 | |
| 270 | 270 | /* find devices */ |
| 271 | state->cassette = | |
| 271 | state->cassette = m | |
| 272 | 272 | |
| 273 | 273 | /* register for state saving */ |
| 274 | 274 | state_save_register_global(machine, state->digit); |
| r8453 | r8454 | |
|---|---|---|
| 201 | 201 | for (i = 0; i < 0x10000; i++) |
| 202 | 202 | gfx[i] = (((i&0x1)?0x00:0xFF)^((i&0x100)?0x00:0xff)); |
| 203 | 203 | // init sound channels to both be on lowest pitch and max volume |
| 204 | cpu_set_clockscale( | |
| 204 | cpu_set_clockscale(m | |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | static READ8_HANDLER( socrates_rom_bank_r ) |
| r8453 | r8454 | |
| 605 | 605 | |
| 606 | 606 | static WRITE8_HANDLER(socrates_sound_w) |
| 607 | 607 | { |
| 608 | running_device *socr_snd = | |
| 608 | running_device *socr_snd = | |
| 609 | 609 | switch(offset) |
| 610 | 610 | { |
| 611 | 611 | case 0: |
| r8453 | r8454 | |
|---|---|---|
| 227 | 227 | void ts2068_update_memory(running_machine *machine) |
| 228 | 228 | { |
| 229 | 229 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 230 | UINT8 *messram = messram_get_ptr( | |
| 230 | UINT8 *messram = messram_get_ptr(m | |
| 231 | 231 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 232 | 232 | unsigned char *ChosenROM, *ExROM, *DOCK; |
| 233 | 233 | |
| r8453 | r8454 | |
| 599 | 599 | static MACHINE_RESET( tc2048 ) |
| 600 | 600 | { |
| 601 | 601 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 602 | UINT8 *messram = messram_get_ptr( | |
| 602 | UINT8 *messram = messram_get_ptr(m | |
| 603 | 603 | |
| 604 | 604 | memory_set_bankptr(machine, "bank1", messram); |
| 605 | 605 | memory_set_bankptr(machine, "bank2", messram); |
| r8453 | r8454 | |
|---|---|---|
| 14 | 14 | |
| 15 | 15 | static WRITE8_HANDLER(vector_terminal_w) |
| 16 | 16 | { |
| 17 | running_device *devconf = | |
| 17 | running_device *devconf = | |
| 18 | 18 | terminal_write(devconf,0,data); |
| 19 | 19 | } |
| 20 | 20 | |
| r8453 | r8454 | |
| 56 | 56 | static MACHINE_RESET(vector4) |
| 57 | 57 | { |
| 58 | 58 | received_char = 0; |
| 59 | cpu_set_reg( | |
| 59 | cpu_set_reg(m | |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | static WRITE8_DEVICE_HANDLER( vector4_kbd_put ) |
| r8453 | r8454 | |
|---|---|---|
| 74 | 74 | |
| 75 | 75 | state->bank = data & 0x07; |
| 76 | 76 | |
| 77 | switch (messram_get_size( | |
| 77 | switch (messram_get_size(m | |
| 78 | 78 | { |
| 79 | 79 | case 64 * 1024: |
| 80 | 80 | max_ram_bank = BANK_RAM1; |
| r8453 | r8454 | |
| 156 | 156 | |
| 157 | 157 | state->bank = data & 0x07; |
| 158 | 158 | |
| 159 | switch (messram_get_size( | |
| 159 | switch (messram_get_size(m | |
| 160 | 160 | { |
| 161 | 161 | case 64 * 1024: |
| 162 | 162 | case 96 * 1024: |
| r8453 | r8454 | |
| 240 | 240 | { |
| 241 | 241 | if (state) |
| 242 | 242 | { |
| 243 | if (cpu_get_reg(dev | |
| 243 | if (cpu_get_reg(dev | |
| 244 | 244 | cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_NMI, HOLD_LINE); |
| 245 | 245 | } |
| 246 | 246 | else |
| r8453 | r8454 | |
| 252 | 252 | static READ8_HANDLER( bw2_wd2797_r ) |
| 253 | 253 | { |
| 254 | 254 | UINT8 result = 0xff; |
| 255 | running_device *fdc = | |
| 255 | running_device *fdc = | |
| 256 | 256 | |
| 257 | 257 | switch (offset & 0x03) |
| 258 | 258 | { |
| r8453 | r8454 | |
| 275 | 275 | |
| 276 | 276 | static WRITE8_HANDLER( bw2_wd2797_w ) |
| 277 | 277 | { |
| 278 | running_device *fdc = | |
| 278 | running_device *fdc = | |
| 279 | 279 | switch (offset & 0x3) |
| 280 | 280 | { |
| 281 | 281 | case 0: |
| r8453 | r8454 | |
| 313 | 313 | |
| 314 | 314 | static WRITE8_DEVICE_HANDLER( bw2_8255_a_w ) |
| 315 | 315 | { |
| 316 | running_device *fdc = dev | |
| 316 | running_device *fdc = dev | |
| 317 | 317 | /* |
| 318 | 318 | |
| 319 | 319 | PA0 KB0 Keyboard line select 0 |
| r8453 | r8454 | |
| 502 | 502 | bw2_state *state = (bw2_state *) machine->driver_data; |
| 503 | 503 | |
| 504 | 504 | /* allocate work memory */ |
| 505 | state->work_ram = auto_alloc_array(machine, UINT8, messram_get_size( | |
| 505 | state->work_ram = auto_alloc_array(machine, UINT8, messram_get_size(m | |
| 506 | 506 | |
| 507 | 507 | /* allocate video memory */ |
| 508 | 508 | state->video_ram = auto_alloc_array(machine, UINT8, BW2_VIDEORAM_SIZE); |
| r8453 | r8454 | |
| 516 | 516 | bw2_state *state = (bw2_state *) machine->driver_data; |
| 517 | 517 | |
| 518 | 518 | /* find devices */ |
| 519 | state->msm8251 = devtag_get_device(machine, MSM8251_TAG); | |
| 520 | state->msm6255 = devtag_get_device(machine, MSM6255_TAG); | |
| 521 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); | |
| 519 | state->msm8251 = machine->device(MSM8251_TAG); | |
| 520 | state->msm6255 = machine->device(MSM6255_TAG); | |
| 521 | state->centronics = machine->device(CENTRONICS_TAG); | |
| 522 | 522 | |
| 523 | 523 | /* memory banking */ |
| 524 | 524 | memory_configure_bank(machine, "bank1", BANK_RAM1, 1, state->work_ram, 0); |
| r8453 | r8454 | |
| 527 | 527 | |
| 528 | 528 | /* register for state saving */ |
| 529 | 529 | state_save_register_global(machine, state->keyboard_row); |
| 530 | state_save_register_global_pointer(machine, state->work_ram, messram_get_size( | |
| 530 | state_save_register_global_pointer(machine, state->work_ram, messram_get_size(m | |
| 531 | 531 | state_save_register_global_pointer(machine, state->ramcard_ram, BW2_RAMCARD_SIZE); |
| 532 | 532 | state_save_register_global(machine, state->bank); |
| 533 | 533 | state_save_register_global(machine, state->selected_drive); |
| r8453 | r8454 | |
|---|---|---|
| 82 | 82 | case 0xfa: |
| 83 | 83 | case 0xfb: |
| 84 | 84 | /* additional 64k ram */ |
| 85 | if (messram_get_size( | |
| 85 | if (messram_get_size( | |
| 86 | 86 | { |
| 87 | 87 | memory_install_readwrite_bank(space, start, end, 0, 0, page_num); |
| 88 | memory_set_bankptr(space->machine, page_num, messram_get_ptr( | |
| 88 | memory_set_bankptr(space->machine, page_num, messram_get_ptr( | |
| 89 | 89 | } |
| 90 | 90 | else |
| 91 | 91 | { |
| r8453 | r8454 | |
| 99 | 99 | case 0xff: |
| 100 | 100 | /* basic 64k ram */ |
| 101 | 101 | memory_install_readwrite_bank(space, start, end, 0, 0, page_num); |
| 102 | memory_set_bankptr(space->machine, page_num, messram_get_ptr( | |
| 102 | memory_set_bankptr(space->machine, page_num, messram_get_ptr( | |
| 103 | 103 | break; |
| 104 | 104 | |
| 105 | 105 | default: |
| r8453 | r8454 | |
| 183 | 183 | |
| 184 | 184 | static MACHINE_RESET( enterprise ) |
| 185 | 185 | { |
| 186 | cpu_set_input_line_vector( | |
| 186 | cpu_set_input_line_vector(m | |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | |
| r8453 | r8454 | |
| 239 | 239 | */ |
| 240 | 240 | static WRITE8_HANDLER( exdos_card_w ) |
| 241 | 241 | { |
| 242 | running_device *fdc = | |
| 242 | running_device *fdc = | |
| 243 | 243 | |
| 244 | 244 | /* drive */ |
| 245 | 245 | if (BIT(data, 0)) wd17xx_set_drive(fdc, 0); |
| r8453 | r8454 | |
|---|---|---|
| 158 | 158 | mc10->keyboard_strobe = 0x00; |
| 159 | 159 | |
| 160 | 160 | /* find devices */ |
| 161 | mc10->mc6847 = devtag_get_device(machine, "mc6847"); | |
| 162 | mc10->dac = devtag_get_device(machine, "dac"); | |
| 163 | mc10->cassette = devtag_get_device(machine, "cassette"); | |
| 161 | mc10->mc6847 = machine->device("mc6847"); | |
| 162 | mc10->dac = machine->device("dac"); | |
| 163 | mc10->cassette = machine->device("cassette"); | |
| 164 | 164 | |
| 165 | 165 | /* initialize memory */ |
| 166 | mc10->ram = messram_get_ptr(devtag_get_device(machine, "messram")); | |
| 167 | mc10->ram_size = messram_get_size(devtag_get_device(machine, "messram")); | |
| 166 | mc10->ram = messram_get_ptr(machine->device("messram")); | |
| 167 | mc10->ram_size = messram_get_size(machine->device("messram")); | |
| 168 | 168 | |
| 169 | 169 | memory_set_bankptr(machine, "bank1", mc10->ram); |
| 170 | 170 |
| r8453 | r8454 | |
|---|---|---|
| 712 | 712 | memory_region(machine, SY6502_TAG)[0x0b] = mame_rand(machine) & 0x0ff; |
| 713 | 713 | |
| 714 | 714 | /* find devices */ |
| 715 | state->mc6847 = devtag_get_device(machine, MC6847_TAG); | |
| 716 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 715 | state->mc6847 = machine->device(MC6847_TAG); | |
| 716 | state->cassette = machine->device(CASSETTE_TAG); | |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | /*------------------------------------------------- |
| r8453 | r8454 | |
|---|---|---|
| 177 | 177 | static MC6845_UPDATE_ROW( apricot_update_row ) |
| 178 | 178 | { |
| 179 | 179 | apricot_state *apricot = (apricot_state *)device->machine->driver_data; |
| 180 | UINT8 *ram = messram_get_ptr(dev | |
| 180 | UINT8 *ram = messram_get_ptr(dev | |
| 181 | 181 | int i, x; |
| 182 | 182 | |
| 183 | 183 | if (apricot->video_mode) |
| r8453 | r8454 | |
| 237 | 237 | static DRIVER_INIT( apricot ) |
| 238 | 238 | { |
| 239 | 239 | apricot_state *apricot = (apricot_state *)machine->driver_data; |
| 240 | running_device *maincpu = | |
| 240 | running_device *maincpu = m | |
| 241 | 241 | const address_space *prg = cpu_get_address_space(maincpu, ADDRESS_SPACE_PROGRAM); |
| 242 | 242 | |
| 243 | UINT8 *ram = messram_get_ptr(devtag_get_device(machine, "messram")); | |
| 244 | UINT32 ram_size = messram_get_size(devtag_get_device(machine, "messram")); | |
| 243 | UINT8 *ram = messram_get_ptr(machine->device("messram")); | |
| 244 | UINT32 ram_size = messram_get_size(machine->device("messram")); | |
| 245 | 245 | |
| 246 | 246 | memory_unmap_readwrite(prg, 0x40000, 0xeffff, 0, 0); |
| 247 | 247 | memory_install_ram(prg, 0x00000, ram_size - 1, 0, 0, ram); |
| 248 | 248 | |
| 249 | 249 | cpu_set_irq_callback(maincpu, apricot_irq_ack); |
| 250 | 250 | |
| 251 | apricot->pic8259 = devtag_get_device(machine, "ic31"); | |
| 252 | apricot->wd2793 = devtag_get_device(machine, "ic68"); | |
| 253 | apricot->mc6845 = devtag_get_device(machine, "ic30"); | |
| 251 | apricot->pic8259 = machine->device("ic31"); | |
| 252 | apricot->wd2793 = machine->device("ic68"); | |
| 253 | apricot->mc6845 = machine->device("ic30"); | |
| 254 | 254 | |
| 255 | 255 | apricot->video_mode = 0; |
| 256 | 256 | apricot->display_on = 1; |
| r8453 | r8454 | |
|---|---|---|
| 539 | 539 | static MACHINE_RESET( coleco ) |
| 540 | 540 | { |
| 541 | 541 | last_state = 0; |
| 542 | cpu_set_input_line_vector( | |
| 542 | cpu_set_input_line_vector(m | |
| 543 | 543 | memset(&memory_region(machine, "maincpu")[0x6000], 0xff, 0x400); // initialize RAM |
| 544 | 544 | } |
| 545 | 545 |
| r8453 | r8454 | |
|---|---|---|
| 293 | 293 | const address_space *program = cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM); |
| 294 | 294 | |
| 295 | 295 | /* find devices */ |
| 296 | state->z80pio2 = devtag_get_device(machine, Z80PIO2_TAG); | |
| 297 | state->speaker = devtag_get_device(machine, SPEAKER_TAG); | |
| 298 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 296 | state->z80pio2 = machine->device(Z80PIO2_TAG); | |
| 297 | state->speaker = machine->device(SPEAKER_TAG); | |
| 298 | state->cassette = machine->device(CASSETTE_TAG); | |
| 299 | 299 | |
| 300 | 300 | /* setup memory banking */ |
| 301 | 301 | memory_configure_bank(machine, "bank1", 0, 1, memory_region(machine, Z80_TAG), 0); // TODO |
| r8453 | r8454 | |
| 317 | 317 | memory_install_readwrite_bank(program, 0x0800, 0x0fff, 0, 0, "bank2"); |
| 318 | 318 | memory_install_readwrite_bank(program, 0x1000, 0x17ff, 0, 0, "bank3"); |
| 319 | 319 | |
| 320 | switch (messram_get_size( | |
| 320 | switch (messram_get_size(m | |
| 321 | 321 | { |
| 322 | 322 | case 1*1024: |
| 323 | 323 | memory_install_readwrite_bank(program, 0x2000, 0x23ff, 0, 0, "bank4"); |
| r8453 | r8454 | |
|---|---|---|
| 89 | 89 | |
| 90 | 90 | static VIDEO_UPDATE( apf ) |
| 91 | 91 | { |
| 92 | running_device *mc6847 = | |
| 92 | running_device *mc6847 = | |
| 93 | 93 | return mc6847_update(mc6847, bitmap, cliprect); |
| 94 | 94 | } |
| 95 | 95 | |
| r8453 | r8454 | |
| 145 | 145 | static WRITE8_DEVICE_HANDLER( apf_m1000_pia_out_b_func ) |
| 146 | 146 | { |
| 147 | 147 | apf_state *state = (apf_state *)device->machine->driver_data; |
| 148 | running_device *mc6847 = dev | |
| 148 | running_device *mc6847 = dev | |
| 149 | 149 | |
| 150 | 150 | /* bit 7..4 video control -- TODO: bit 5 and 4? */ |
| 151 | 151 | mc6847_ag_w(mc6847, BIT(data, 7)); |
| r8453 | r8454 | |
| 164 | 164 | |
| 165 | 165 | static WRITE8_DEVICE_HANDLER(apf_m1000_pia_out_cb2_func) |
| 166 | 166 | { |
| 167 | running_device *speaker = dev | |
| 167 | running_device *speaker = dev | |
| 168 | 168 | speaker_level_w(speaker, data); |
| 169 | 169 | } |
| 170 | 170 | |
| r8453 | r8454 | |
| 247 | 247 | |
| 248 | 248 | data = 0x000; |
| 249 | 249 | |
| 250 | if (cassette_input(dev | |
| 250 | if (cassette_input(dev | |
| 251 | 251 | data =(1<<7); |
| 252 | 252 | |
| 253 | 253 | return data; |
| r8453 | r8454 | |
| 296 | 296 | state->keyboard_data = input_port_read(device->machine, keynames[keyboard_line]); |
| 297 | 297 | |
| 298 | 298 | /* bit 4: cassette motor control */ |
| 299 | cassette_change_state(dev | |
| 299 | cassette_change_state(dev | |
| 300 | 300 | (data & 0x10) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, |
| 301 | 301 | CASSETTE_MASK_MOTOR); |
| 302 | 302 | |
| 303 | 303 | /* bit 6: cassette write */ |
| 304 | cassette_output(dev | |
| 304 | cassette_output(dev | |
| 305 | 305 | (data & 0x40) ? -1.0 : 1.0); |
| 306 | 306 | } |
| 307 | 307 | |
| r8453 | r8454 | |
| 373 | 373 | static WRITE8_HANDLER(apf_dischw_w) |
| 374 | 374 | { |
| 375 | 375 | int drive; |
| 376 | running_device *fdc = | |
| 376 | running_device *fdc = | |
| 377 | 377 | |
| 378 | 378 | /* bit 3 is index of drive to select */ |
| 379 | 379 | drive = (data>>3) & 0x01; |
| r8453 | r8454 | |
| 396 | 396 | |
| 397 | 397 | static WRITE8_HANDLER(apf_wd179x_command_w) |
| 398 | 398 | { |
| 399 | wd17xx_command_w( | |
| 399 | wd17xx_command_w( | |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | static WRITE8_HANDLER(apf_wd179x_track_w) |
| 403 | 403 | { |
| 404 | wd17xx_track_w( | |
| 404 | wd17xx_track_w( | |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | static WRITE8_HANDLER(apf_wd179x_sector_w) |
| 408 | 408 | { |
| 409 | wd17xx_sector_w( | |
| 409 | wd17xx_sector_w( | |
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | static WRITE8_HANDLER(apf_wd179x_data_w) |
| 413 | 413 | { |
| 414 | wd17xx_data_w( | |
| 414 | wd17xx_data_w( | |
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | static READ8_HANDLER(apf_wd179x_status_r) |
| 418 | 418 | { |
| 419 | return ~wd17xx_status_r( | |
| 419 | return ~wd17xx_status_r( | |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | static READ8_HANDLER(apf_wd179x_track_r) |
| 423 | 423 | { |
| 424 | return ~wd17xx_track_r( | |
| 424 | return ~wd17xx_track_r( | |
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | static READ8_HANDLER(apf_wd179x_sector_r) |
| 428 | 428 | { |
| 429 | return ~wd17xx_sector_r( | |
| 429 | return ~wd17xx_sector_r( | |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | static READ8_HANDLER(apf_wd179x_data_r) |
| 433 | 433 | { |
| 434 | return wd17xx_data_r( | |
| 434 | return wd17xx_data_r( | |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | static ADDRESS_MAP_START(apf_imagination_map, ADDRESS_SPACE_PROGRAM, 8) |
| r8453 | r8454 | |
|---|---|---|
| 505 | 505 | } |
| 506 | 506 | s3c240x_irq_regs[4] |= (1 << int_type); // INTPND |
| 507 | 507 | s3c240x_irq_regs[5] = int_type; // INTOFFSET |
| 508 | cpu_set_input_line( | |
| 508 | cpu_set_input_line( m | |
| 509 | 509 | } |
| 510 | 510 | else |
| 511 | 511 | { |
| 512 | cpu_set_input_line( | |
| 512 | cpu_set_input_line( m | |
| 513 | 513 | } |
| 514 | 514 | } |
| 515 | 515 | |
| r8453 | r8454 | |
| 521 | 521 | s3c240x_irq_regs[0] |= (1 << int_type); // SRCPND |
| 522 | 522 | s3c240x_irq_regs[4] |= (1 << int_type); // INTPND |
| 523 | 523 | s3c240x_irq_regs[5] = int_type; // INTOFFSET |
| 524 | cpu_set_input_line( | |
| 524 | cpu_set_input_line( m | |
| 525 | 525 | } |
| 526 | 526 | else |
| 527 | 527 | { |
| r8453 | r8454 | |
| 967 | 967 | |
| 968 | 968 | static UINT8 smc_read( running_machine *machine) |
| 969 | 969 | { |
| 970 | running_device *smartmedia = | |
| 970 | running_device *smartmedia = m | |
| 971 | 971 | UINT8 data; |
| 972 | 972 | data = smartmedia_data_r( smartmedia); |
| 973 | 973 | verboselog( machine, 5, "smc_read %08X\n", data); |
| r8453 | r8454 | |
| 979 | 979 | verboselog( machine, 5, "smc_write %08X\n", data); |
| 980 | 980 | if ((smc.chip) && (!smc.read)) |
| 981 | 981 | { |
| 982 | running_device *smartmedia = | |
| 982 | running_device *smartmedia = m | |
| 983 | 983 | if (smc.cmd_latch) |
| 984 | 984 | { |
| 985 | 985 | verboselog( machine, 5, "smartmedia_command_w %08X\n", data); |
| r8453 | r8454 | |
| 1107 | 1107 | // PDDAT |
| 1108 | 1108 | case 0x24 / 4 : |
| 1109 | 1109 | { |
| 1110 | running_device *smartmedia = | |
| 1110 | running_device *smartmedia = m | |
| 1111 | 1111 | // smartmedia |
| 1112 | 1112 | data = (data & ~0x000003C0); |
| 1113 | 1113 | if (!smc.busy) data = data | 0x00000200; |
| r8453 | r8454 | |
| 1119 | 1119 | // PEDAT |
| 1120 | 1120 | case 0x30 / 4 : |
| 1121 | 1121 | { |
| 1122 | running_device *smartmedia = | |
| 1122 | running_device *smartmedia = m | |
| 1123 | 1123 | // smartmedia |
| 1124 | 1124 | data = (data & ~0x0000003C); |
| 1125 | 1125 | if (smc.cmd_latch) data = data | 0x00000020; |
| r8453 | r8454 | |
| 1634 | 1634 | if (s3c240x_iis.fifo_index == 2) |
| 1635 | 1635 | { |
| 1636 | 1636 | running_device *dac[2]; |
| 1637 | dac[0] = devtag_get_device( machine, "dac1"); | |
| 1638 | dac[1] = devtag_get_device( machine, "dac2"); | |
| 1637 | dac[0] = machine->device( "dac1"); | |
| 1638 | dac[1] = machine->device( "dac2"); | |
| 1639 | 1639 | s3c240x_iis.fifo_index = 0; |
| 1640 | 1640 | dac_signed_data_16_w( dac[0], s3c240x_iis.fifo[0] + 0x8000); |
| 1641 | 1641 | dac_signed_data_16_w( dac[1], s3c240x_iis.fifo[1] + 0x8000); |
| r8453 | r8454 | |
|---|---|---|
| 34 | 34 | |
| 35 | 35 | static WRITE8_HANDLER(sio_data_w) |
| 36 | 36 | { |
| 37 | running_device *devconf = | |
| 37 | running_device *devconf = | |
| 38 | 38 | terminal_write(devconf,0,data); |
| 39 | 39 | } |
| 40 | 40 | |
| r8453 | r8454 | |
| 82 | 82 | static MACHINE_RESET(altair) |
| 83 | 83 | { |
| 84 | 84 | // Set startup addess done by turn-key |
| 85 | cpu_set_reg( | |
| 85 | cpu_set_reg(m | |
| 86 | 86 | |
| 87 | 87 | term_data = 0; |
| 88 | 88 | } |
| r8453 | r8454 | |
|---|---|---|
| 1827 | 1827 | |
| 1828 | 1828 | static READ32_HANDLER( stv_scsp_regs_r32 ) |
| 1829 | 1829 | { |
| 1830 | running_device *scsp = | |
| 1830 | running_device *scsp = | |
| 1831 | 1831 | |
| 1832 | 1832 | offset <<= 1; |
| 1833 | 1833 | return (scsp_r(scsp, offset+1, 0xffff) | (scsp_r(scsp, offset, 0xffff)<<16)); |
| r8453 | r8454 | |
| 1835 | 1835 | |
| 1836 | 1836 | static WRITE32_HANDLER( stv_scsp_regs_w32 ) |
| 1837 | 1837 | { |
| 1838 | running_device *scsp = | |
| 1838 | running_device *scsp = | |
| 1839 | 1839 | |
| 1840 | 1840 | offset <<= 1; |
| 1841 | 1841 | scsp_w(scsp, offset, data>>16, mem_mask >> 16); |
| r8453 | r8454 | |
| 1849 | 1849 | logerror("cpu %s (PC=%08X) MINIT write = %08x\n", space->cpu->tag(), cpu_get_pc(space->cpu),data); |
| 1850 | 1850 | cpuexec_boost_interleave(space->machine, minit_boost_timeslice, ATTOTIME_IN_USEC(minit_boost)); |
| 1851 | 1851 | cpuexec_trigger(space->machine, 1000); |
| 1852 | sh2_set_frt_input( | |
| 1852 | sh2_set_frt_input( | |
| 1853 | 1853 | } |
| 1854 | 1854 | |
| 1855 | 1855 | static WRITE32_HANDLER( sinit_w ) |
| 1856 | 1856 | { |
| 1857 | 1857 | logerror("cpu %s (PC=%08X) SINIT write = %08x\n", space->cpu->tag(), cpu_get_pc(space->cpu),data); |
| 1858 | 1858 | cpuexec_boost_interleave(space->machine, sinit_boost_timeslice, ATTOTIME_IN_USEC(sinit_boost)); |
| 1859 | sh2_set_frt_input( | |
| 1859 | sh2_set_frt_input( | |
| 1860 | 1860 | } |
| 1861 | 1861 | |
| 1862 | 1862 | static UINT32 backup[64*1024/4]; |
| r8453 | r8454 | |
| 2172 | 2172 | saturn_region = rgn; |
| 2173 | 2173 | |
| 2174 | 2174 | // set compatible options |
| 2175 | sh2drc_set_options(devtag_get_device(machine, "maincpu"), SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL); | |
| 2176 | sh2drc_set_options(devtag_get_device(machine, "slave"), SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL); | |
| 2175 | sh2drc_set_options(machine->device("maincpu"), SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL); | |
| 2176 | sh2drc_set_options(machine->device("slave"), SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL); | |
| 2177 | 2177 | |
| 2178 | 2178 | /* get the current date/time from the core */ |
| 2179 | 2179 | machine->current_datetime(systime); |
| r8453 | r8454 | |
| 2220 | 2220 | |
| 2221 | 2221 | static MACHINE_START( saturn ) |
| 2222 | 2222 | { |
| 2223 | scsp_set_ram_base( | |
| 2223 | scsp_set_ram_base(m | |
| 2224 | 2224 | |
| 2225 | 2225 | // save states |
| 2226 | 2226 | state_save_register_global_pointer(machine, smpc_ram, 0x80); |
| r8453 | r8454 | |
|---|---|---|
| 154 | 154 | va_start( v, s_fmt ); |
| 155 | 155 | vsprintf( buf, s_fmt, v ); |
| 156 | 156 | va_end( v ); |
| 157 | logerror( "%06x: %s", cpu_get_pc( | |
| 157 | logerror( "%06x: %s", cpu_get_pc(m | |
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | #else |
| r8453 | r8454 | |
| 913 | 913 | { |
| 914 | 914 | /* Reset and enable the sound cpu */ |
| 915 | 915 | //cputag_set_input_line(space->machine, "soundcpu", INPUT_LINE_HALT, CLEAR_LINE); |
| 916 | // | |
| 916 | // | |
| 917 | 917 | } |
| 918 | 918 | } |
| 919 | 919 | else |
| r8453 | r8454 | |
|---|---|---|
| 128 | 128 | static TIMER_CALLBACK(timer_callback) |
| 129 | 129 | { |
| 130 | 130 | _4004clk_state *state = (_4004clk_state *)machine->driver_data; |
| 131 | i4004_set_test( | |
| 131 | i4004_set_test(m | |
| 132 | 132 | state->timer^=1; |
| 133 | 133 | } |
| 134 | 134 | |
| r8453 | r8454 | |
| 136 | 136 | { |
| 137 | 137 | _4004clk_state *state = (_4004clk_state *)machine->driver_data; |
| 138 | 138 | state->timer = 0; |
| 139 | state->dac = | |
| 139 | state->dac = m | |
| 140 | 140 | |
| 141 | 141 | timer_pulse(machine, ATTOTIME_IN_HZ(120), NULL, 0, timer_callback); |
| 142 | 142 |
| r8453 | r8454 | |
|---|---|---|
| 229 | 229 | c80_state *state = (c80_state *)machine->driver_data; |
| 230 | 230 | |
| 231 | 231 | /* find devices */ |
| 232 | state->cassette = | |
| 232 | state->cassette = m | |
| 233 | 233 | |
| 234 | 234 | /* register for state saving */ |
| 235 | 235 | state_save_register_global(machine, state->keylatch); |
| r8453 | r8454 | |
|---|---|---|
| 272 | 272 | state->colorram = auto_alloc_array(machine, UINT8, TMC2000E_COLORRAM_SIZE); |
| 273 | 273 | |
| 274 | 274 | /* find devices */ |
| 275 | state->cdp1864 = devtag_get_device(machine, CDP1864_TAG); | |
| 276 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 275 | state->cdp1864 = machine->device(CDP1864_TAG); | |
| 276 | state->cassette = machine->device(CASSETTE_TAG); | |
| 277 | 277 | |
| 278 | 278 | /* register for state saving */ |
| 279 | 279 | state_save_register_global_pointer(machine, state->colorram, TMC2000E_COLORRAM_SIZE); |
| r8453 | r8454 | |
|---|---|---|
| 36 | 36 | #include "formats/pc_dsk.h" |
| 37 | 37 | #include "devices/messram.h" |
| 38 | 38 | |
| 39 | static READ8_HANDLER(at_dma8237_1_r) { return i8237_r(devtag_get_device(space->machine, "dma8237_2"), offset / 2); } | |
| 40 | static WRITE8_HANDLER(at_dma8237_1_w) { i8237_w(devtag_get_device(space->machine, "dma8237_2"), offset / 2, data); } | |
| 39 | static READ8_HANDLER(at_dma8237_1_r) { return i8237_r(space->machine->device("dma8237_2"), offset / 2); } | |
| 40 | static WRITE8_HANDLER(at_dma8237_1_w) { i8237_w(space->machine->device("dma8237_2"), offset / 2, data); } | |
| 41 | 41 | |
| 42 | 42 | static READ64_HANDLER( bebox_dma8237_1_r ) |
| 43 | 43 | { |
| r8453 | r8454 | |
| 86 | 86 | |
| 87 | 87 | static READ64_HANDLER(bb_slave_64be_r) |
| 88 | 88 | { |
| 89 | running_device *device = | |
| 89 | running_device *device = | |
| 90 | 90 | |
| 91 | 91 | // 2e94 is the real address, 2e84 is where the PC appears to be under full DRC |
| 92 | 92 | if ((cpu_get_pc(space->cpu) == 0xfff02e94) || (cpu_get_pc(space->cpu) == 0xfff02e84)) |
| r8453 | r8454 | |
|---|---|---|
| 24 | 24 | va_start( v, s_fmt ); |
| 25 | 25 | vsprintf( buf, s_fmt, v ); |
| 26 | 26 | va_end( v ); |
| 27 | logerror( "%08x: %s", cpu_get_pc( | |
| 27 | logerror( "%08x: %s", cpu_get_pc(m | |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | #else |
| r8453 | r8454 | |
| 195 | 195 | // TODO |
| 196 | 196 | |
| 197 | 197 | //avr8_maybe_start_timer_1(regs); |
| 198 | //cpu_set_input_line( | |
| 198 | //cpu_set_input_line(m | |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | static TIMER_CALLBACK( ocr1b_timer_compare ) |
| r8453 | r8454 | |
| 206 | 206 | // TODO |
| 207 | 207 | |
| 208 | 208 | //avr8_maybe_start_timer_1(regs); |
| 209 | //cpu_set_input_line( | |
| 209 | //cpu_set_input_line(m | |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | static READ8_HANDLER( avr8_read ) |
| r8453 | r8454 | |
| 838 | 838 | AVR8_TCNT1H = 0; |
| 839 | 839 | AVR8_TCNT1L = 0; |
| 840 | 840 | |
| 841 | dac_data_w( | |
| 841 | dac_data_w(m | |
| 842 | 842 | } |
| 843 | 843 | |
| 844 | 844 | static MACHINE_DRIVER_START( craft ) |
| r8453 | r8454 | |
|---|---|---|
| 151 | 151 | |
| 152 | 152 | static VIDEO_UPDATE( ec65 ) |
| 153 | 153 | { |
| 154 | running_device *mc6845 = | |
| 154 | running_device *mc6845 = | |
| 155 | 155 | mc6845_update(mc6845, bitmap, cliprect); |
| 156 | 156 | return 0; |
| 157 | 157 | } |
| r8453 | r8454 | |
|---|---|---|
| 21 | 21 | |
| 22 | 22 | static READ8_DEVICE_HANDLER( ins8154_b1_port_a_r ) |
| 23 | 23 | { |
| 24 | running_device *ttl74145 = dev | |
| 24 | running_device *ttl74145 = dev | |
| 25 | 25 | UINT8 key_line = ttl74145_r(ttl74145, 0, 0); |
| 26 | 26 | |
| 27 | 27 | switch (key_line) |
| r8453 | r8454 | |
| 42 | 42 | |
| 43 | 43 | static WRITE8_DEVICE_HANDLER( ins8154_b1_port_a_w ) |
| 44 | 44 | { |
| 45 | ttl74145_w(dev | |
| 45 | ttl74145_w(dev | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | |
| r8453 | r8454 | |
| 52 | 52 | |
| 53 | 53 | static WRITE8_DEVICE_HANDLER( acrnsys1_led_segment_w ) |
| 54 | 54 | { |
| 55 | running_device *ttl74145 = dev | |
| 55 | running_device *ttl74145 = dev | |
| 56 | 56 | UINT8 key_line = ttl74145_r(ttl74145, 0, 0); |
| 57 | 57 | |
| 58 | 58 | output_set_digit_value(key_line, data); |
| r8453 | r8454 | |
|---|---|---|
| 44 | 44 | |
| 45 | 45 | static TIMER_DEVICE_CALLBACK( pegasus_firq ) |
| 46 | 46 | { |
| 47 | running_device *cpu = | |
| 47 | running_device *cpu = | |
| 48 | 48 | cpu_set_input_line(cpu, M6809_FIRQ_LINE, HOLD_LINE); |
| 49 | 49 | } |
| 50 | 50 | |
| r8453 | r8454 | |
| 115 | 115 | /* Must return the A register except when it is doing a rom search */ |
| 116 | 116 | static READ8_HANDLER( pegasus_protection_r ) |
| 117 | 117 | { |
| 118 | UINT8 data = cpu_get_reg( | |
| 118 | UINT8 data = cpu_get_reg( | |
| 119 | 119 | if (data == 0x20) data = 0xff; |
| 120 | 120 | return data; |
| 121 | 121 | } |
| r8453 | r8454 | |
| 334 | 334 | |
| 335 | 335 | static MACHINE_START( pegasus ) |
| 336 | 336 | { |
| 337 | pegasus_cass = | |
| 337 | pegasus_cass = m | |
| 338 | 338 | FNT = memory_region(machine, "pcg"); |
| 339 | 339 | } |
| 340 | 340 |
| r8453 | r8454 | |
|---|---|---|
| 75 | 75 | static READ8_HANDLER( act_fdc_r ) |
| 76 | 76 | { |
| 77 | 77 | act_state *state = (act_state *)space->machine->driver_data; |
| 78 | running_device* dev = | |
| 78 | running_device* dev = | |
| 79 | 79 | |
| 80 | 80 | // printf("%02x\n",offset); |
| 81 | 81 | |
| r8453 | r8454 | |
| 103 | 103 | static WRITE8_HANDLER( act_fdc_w ) |
| 104 | 104 | { |
| 105 | 105 | act_state *state = (act_state *)space->machine->driver_data; |
| 106 | running_device* dev = | |
| 106 | running_device* dev = | |
| 107 | 107 | |
| 108 | 108 | // printf("%02x %02x\n",offset,data); |
| 109 | 109 | |
| r8453 | r8454 | |
| 166 | 166 | static WRITE8_HANDLER( actf1_sys_w ) |
| 167 | 167 | { |
| 168 | 168 | // static UINT8 cur_fdrv; |
| 169 | // running_device* dev = | |
| 169 | // running_device* dev = | |
| 170 | 170 | |
| 171 | 171 | switch(offset) |
| 172 | 172 | { |
| r8453 | r8454 | |
|---|---|---|
| 300 | 300 | { |
| 301 | 301 | vg5k_state *vg5k = (vg5k_state *)machine->driver_data; |
| 302 | 302 | |
| 303 | vg5k->ef9345 = devtag_get_device(machine, "ef9345"); | |
| 304 | vg5k->dac = devtag_get_device(machine, "dac"); | |
| 305 | vg5k->printer = devtag_get_device(machine, "printer"); | |
| 306 | vg5k->cassette = devtag_get_device(machine, "cassette"); | |
| 303 | vg5k->ef9345 = machine->device("ef9345"); | |
| 304 | vg5k->dac = machine->device("dac"); | |
| 305 | vg5k->printer = machine->device("printer"); | |
| 306 | vg5k->cassette = machine->device("cassette"); | |
| 307 | 307 | |
| 308 | 308 | timer_pulse(machine, ATTOTIME_IN_MSEC(20), NULL, 0, z80_irq); |
| 309 | 309 | |
| r8453 | r8454 | |
| 363 | 363 | |
| 364 | 364 | /* install expansion memory*/ |
| 365 | 365 | const address_space *program = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 366 | UINT8 *ram = messram_get_ptr(devtag_get_device(machine, "messram")); | |
| 367 | UINT16 ram_size = messram_get_size(devtag_get_device(machine, "messram")); | |
| 366 | UINT8 *ram = messram_get_ptr(machine->device("messram")); | |
| 367 | UINT16 ram_size = messram_get_size(machine->device("messram")); | |
| 368 | 368 | |
| 369 | 369 | if (ram_size > 0x4000) |
| 370 | 370 | memory_install_ram(program, 0x8000, 0x3fff + ram_size, 0, 0, ram); |
| r8453 | r8454 | |
|---|---|---|
| 66 | 66 | |
| 67 | 67 | static WRITE8_HANDLER(elwro800jr_fdc_control_w) |
| 68 | 68 | { |
| 69 | running_device *fdc = | |
| 69 | running_device *fdc = | |
| 70 | 70 | |
| 71 | 71 | floppy_mon_w(floppy_get_device(space->machine, 0), !BIT(data, 0)); |
| 72 | 72 | floppy_mon_w(floppy_get_device(space->machine, 1), !BIT(data, 1)); |
| r8453 | r8454 | |
| 87 | 87 | static void elwro800jr_mmu_w(running_machine *machine, UINT8 data) |
| 88 | 88 | { |
| 89 | 89 | UINT8 *prom = memory_region(machine, "proms") + 0x200; |
| 90 | UINT8 *messram = messram_get_ptr( | |
| 90 | UINT8 *messram = messram_get_ptr(m | |
| 91 | 91 | UINT8 cs; |
| 92 | 92 | UINT8 ls175; |
| 93 | 93 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| r8453 | r8454 | |
| 154 | 154 | |
| 155 | 155 | static READ8_DEVICE_HANDLER(i8255_port_c_r) |
| 156 | 156 | { |
| 157 | running_device *printer = dev | |
| 157 | running_device *printer = dev | |
| 158 | 158 | return (centronics_ack_r(printer) << 2); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | static WRITE8_DEVICE_HANDLER(i8255_port_c_w) |
| 162 | 162 | { |
| 163 | running_device *printer = dev | |
| 163 | running_device *printer = dev | |
| 164 | 164 | centronics_strobe_w(printer, (data >> 7) & 0x01); |
| 165 | 165 | } |
| 166 | 166 | |
| r8453 | r8454 | |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /* cassette input from wav */ |
| 245 | if (cassette_input( | |
| 245 | if (cassette_input( | |
| 246 | 246 | { |
| 247 | 247 | data &= ~0x40; |
| 248 | 248 | } |
| r8453 | r8454 | |
| 261 | 261 | else if (!BIT(cs,2)) |
| 262 | 262 | { |
| 263 | 263 | // CS55 |
| 264 | running_device *ppi = | |
| 264 | running_device *ppi = | |
| 265 | 265 | return i8255a_r(ppi, (offset & 0x03) ^ 0x03); |
| 266 | 266 | } |
| 267 | 267 | else if (!BIT(cs,3)) |
| 268 | 268 | { |
| 269 | 269 | // CSFDC |
| 270 | running_device *fdc = | |
| 270 | running_device *fdc = | |
| 271 | 271 | if (offset & 1) |
| 272 | 272 | { |
| 273 | 273 | return upd765_data_r(fdc,0); |
| r8453 | r8454 | |
| 280 | 280 | else if (!BIT(cs,4)) |
| 281 | 281 | { |
| 282 | 282 | // CS51 |
| 283 | running_device *usart = | |
| 283 | running_device *usart = | |
| 284 | 284 | if (offset & 1) |
| 285 | 285 | { |
| 286 | 286 | return msm8251_status_r(usart, 0); |
| r8453 | r8454 | |
| 319 | 319 | else if (!BIT(cs,2)) |
| 320 | 320 | { |
| 321 | 321 | // CS55 |
| 322 | running_device *ppi = | |
| 322 | running_device *ppi = | |
| 323 | 323 | i8255a_w(ppi, (offset & 0x03) ^ 0x03, data); |
| 324 | 324 | } |
| 325 | 325 | else if (!BIT(cs,3)) |
| 326 | 326 | { |
| 327 | 327 | // CSFDC |
| 328 | running_device *fdc = | |
| 328 | running_device *fdc = | |
| 329 | 329 | if (offset & 1) |
| 330 | 330 | { |
| 331 | 331 | upd765_data_w(fdc, 0, data); |
| r8453 | r8454 | |
| 334 | 334 | else if (!BIT(cs,4)) |
| 335 | 335 | { |
| 336 | 336 | // CS51 |
| 337 | running_device *usart = | |
| 337 | running_device *usart = | |
| 338 | 338 | if (offset & 1) |
| 339 | 339 | { |
| 340 | 340 | msm8251_control_w(usart, 0, data); |
| r8453 | r8454 | |
| 492 | 492 | static MACHINE_RESET(elwro800) |
| 493 | 493 | { |
| 494 | 494 | spectrum_state *state = (spectrum_state *)machine->driver_data; |
| 495 | UINT8 *messram = messram_get_ptr( | |
| 495 | UINT8 *messram = messram_get_ptr(m | |
| 496 | 496 | |
| 497 | 497 | state->df_on_databus = 0xdf; |
| 498 | 498 | memset(messram, 0, 64*1024); |
| r8453 | r8454 | |
|---|---|---|
| 134 | 134 | |
| 135 | 135 | static READ8_HANDLER( jupiter_io_r ) |
| 136 | 136 | { |
| 137 | running_device *speaker = | |
| 137 | running_device *speaker = | |
| 138 | 138 | UINT8 data = 0xff; |
| 139 | 139 | |
| 140 | 140 | if ( ( offset & 0xff ) != 0xfe ) |
| r8453 | r8454 | |
| 170 | 170 | } |
| 171 | 171 | if ( ! ( offset & 0x8000 ) ) |
| 172 | 172 | { |
| 173 | // cassette_output( | |
| 173 | // cassette_output( | |
| 174 | 174 | speaker_level_w(speaker,0); |
| 175 | 175 | data = ( data & 0xe0 ) | ( data & input_port_read( space->machine, "KEY7" ) );; |
| 176 | 176 | } |
| 177 | if ( cassette_input( | |
| 177 | if ( cassette_input( | |
| 178 | 178 | { |
| 179 | 179 | data &= ~0x20; |
| 180 | 180 | } |
| r8453 | r8454 | |
| 184 | 184 | |
| 185 | 185 | static WRITE8_HANDLER( jupiter_port_fe_w ) |
| 186 | 186 | { |
| 187 | running_device *speaker = devtag_get_device(space->machine, "speaker"); | |
| 188 | // cassette_output( devtag_get_device(machine, "cassette"), 1 ); | |
| 187 | running_device *speaker = space->machine->device("speaker"); | |
| 188 | // cassette_output( machine->device("cassette"), 1 ); | |
| 189 | 189 | speaker_level_w(speaker,1); |
| 190 | 190 | } |
| 191 | 191 |
| r8453 | r8454 | |
|---|---|---|
| 271 | 271 | */ |
| 272 | 272 | static READ8_HANDLER(tms7041_porta_r) |
| 273 | 273 | { |
| 274 | running_device *tms5220c = | |
| 274 | running_device *tms5220c = | |
| 275 | 275 | UINT8 data = 0x00; |
| 276 | 276 | |
| 277 | 277 | logerror("tms7041_porta_r\n"); |
| r8453 | r8454 | |
| 316 | 316 | |
| 317 | 317 | static WRITE8_HANDLER(tms7041_portb_w) |
| 318 | 318 | { |
| 319 | running_device *tms5220c = | |
| 319 | running_device *tms5220c = | |
| 320 | 320 | |
| 321 | 321 | logerror("tms7041_portb_w: data = 0x%02x\n", data); |
| 322 | 322 | |
| r8453 | r8454 | |
| 386 | 386 | |
| 387 | 387 | static WRITE8_HANDLER(tms7041_portd_w) |
| 388 | 388 | { |
| 389 | running_device *tms5220c = | |
| 389 | running_device *tms5220c = | |
| 390 | 390 | |
| 391 | 391 | logerror("tms7041_portd_w: data = 0x%02x\n", data); |
| 392 | 392 |
| r8453 | r8454 | |
|---|---|---|
| 141 | 141 | |
| 142 | 142 | static READ8_DEVICE_HANDLER( vcc_portb_r ) |
| 143 | 143 | { |
| 144 | device = dev | |
| 144 | device = dev | |
| 145 | 145 | if (s14001a_bsy_r(device) != 0) |
| 146 | 146 | return 0x80; |
| 147 | 147 | else |
| r8453 | r8454 | |
| 155 | 155 | |
| 156 | 156 | static WRITE8_DEVICE_HANDLER( vcc_porta_w ) |
| 157 | 157 | { |
| 158 | device = dev | |
| 158 | device = dev | |
| 159 | 159 | s14001a_set_volume(device, 15); // hack, s14001a core should assume a volume of 15 unless otherwise stated... |
| 160 | 160 | s14001a_reg_w(device, data & 0x3f); |
| 161 | 161 | s14001a_rst_w(device, (data & 0x80)>>7); |
| r8453 | r8454 | |
|---|---|---|
| 26 | 26 | |
| 27 | 27 | static WRITE16_HANDLER(sun1_upd7201_w) |
| 28 | 28 | { |
| 29 | running_device *devconf = | |
| 29 | running_device *devconf = | |
| 30 | 30 | if (offset==0) terminal_write(devconf,0,data >> 8); |
| 31 | 31 | } |
| 32 | 32 | |
| r8453 | r8454 | |
| 49 | 49 | |
| 50 | 50 | memcpy((UINT8*)sun1_ram,user1,0x4000); |
| 51 | 51 | |
| 52 | | |
| 52 | m | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 |
| r8453 | r8454 | |
|---|---|---|
| 174 | 174 | |
| 175 | 175 | static TIMER_CALLBACK( update_nmi ) |
| 176 | 176 | { |
| 177 | running_device *speaker = | |
| 177 | running_device *speaker = m | |
| 178 | 178 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI,PULSE_LINE); |
| 179 | 179 | // dac_data_w(0,led_status&64?128:0); |
| 180 | 180 | beep_set_state(speaker,led_status&64?1:0); |
| r8453 | r8454 | |
|---|---|---|
| 40 | 40 | |
| 41 | 41 | static MACHINE_RESET(horizon) |
| 42 | 42 | { |
| 43 | cpu_set_reg( | |
| 43 | cpu_set_reg(m | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | static MACHINE_RESET(horizon_sd) |
| 47 | 47 | { |
| 48 | cpu_set_reg( | |
| 48 | cpu_set_reg(m | |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | static WRITE8_DEVICE_HANDLER( horizon_kbd_put ) |
| r8453 | r8454 | |
|---|---|---|
| 37 | 37 | } |
| 38 | 38 | else |
| 39 | 39 | { |
| 40 | memory_set_bankptr(space->machine, "bank2", messram_get_ptr( | |
| 40 | memory_set_bankptr(space->machine, "bank2", messram_get_ptr( | |
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
| r8453 | r8454 | |
| 59 | 59 | |
| 60 | 60 | static WRITE8_HANDLER (vdisk_data_w) |
| 61 | 61 | { |
| 62 | messram_get_ptr( | |
| 62 | messram_get_ptr( | |
| 63 | 63 | vdisk_addr++; |
| 64 | 64 | vdisk_addr&=0x7ffff; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | static READ8_HANDLER (vdisk_data_r) |
| 68 | 68 | { |
| 69 | UINT8 retVal = messram_get_ptr( | |
| 69 | UINT8 retVal = messram_get_ptr( | |
| 70 | 70 | vdisk_addr++; |
| 71 | 71 | vdisk_addr &= 0x7ffff; |
| 72 | 72 | return retVal; |
| r8453 | r8454 | |
| 162 | 162 | // bit 1 is TC state |
| 163 | 163 | // bit 2 is drive selected |
| 164 | 164 | // bit 3 is motor state |
| 165 | running_device *floppy = | |
| 165 | running_device *floppy = | |
| 166 | 166 | if (BIT(data,0)==0) { |
| 167 | 167 | //reset |
| 168 | 168 | upd765_reset(floppy,0); |
| r8453 | r8454 | |
| 318 | 318 | |
| 319 | 319 | static MACHINE_RESET(pyl601) |
| 320 | 320 | { |
| 321 | memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x0000); | |
| 322 | memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xc000); | |
| 323 | memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xe000); | |
| 324 | memory_set_bankptr(machine, "bank4", messram_get_ptr(devtag_get_device(machine, "messram")) + 0xe700); | |
| 321 | memory_set_bankptr(machine, "bank1", messram_get_ptr(machine->device("messram")) + 0x0000); | |
| 322 | memory_set_bankptr(machine, "bank2", messram_get_ptr(machine->device("messram")) + 0xc000); | |
| 323 | memory_set_bankptr(machine, "bank3", messram_get_ptr(machine->device("messram")) + 0xe000); | |
| 324 | memory_set_bankptr(machine, "bank4", messram_get_ptr(machine->device("messram")) + 0xe700); | |
| 325 | 325 | memory_set_bankptr(machine, "bank5", memory_region(machine, "maincpu") + 0xf000); |
| 326 | memory_set_bankptr(machine, "bank6", messram_get_ptr( | |
| 326 | memory_set_bankptr(machine, "bank6", messram_get_ptr(m | |
| 327 | 327 | |
| 328 | | |
| 328 | m | |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | static VIDEO_START( pyl601 ) |
| r8453 | r8454 | |
| 334 | 334 | |
| 335 | 335 | static VIDEO_UPDATE( pyl601 ) |
| 336 | 336 | { |
| 337 | running_device *mc6845 = | |
| 337 | running_device *mc6845 = | |
| 338 | 338 | mc6845_update(mc6845, bitmap, cliprect); |
| 339 | 339 | return 0; |
| 340 | 340 | } |
| r8453 | r8454 | |
| 349 | 349 | { |
| 350 | 350 | for (column = 0; column < x_count; column++) |
| 351 | 351 | { |
| 352 | UINT8 code = messram_get_ptr(dev | |
| 352 | UINT8 code = messram_get_ptr(dev | |
| 353 | 353 | code = ((code << 1) | (code >> 7)) & 0xff; |
| 354 | 354 | if (column == cursor_x-2) |
| 355 | 355 | { |
| r8453 | r8454 | |
| 374 | 374 | { |
| 375 | 375 | for (i = 0; i < x_count; i++) |
| 376 | 376 | { |
| 377 | data = messram_get_ptr(dev | |
| 377 | data = messram_get_ptr(dev | |
| 378 | 378 | for (bit = 0; bit < 8; bit++) |
| 379 | 379 | { |
| 380 | 380 | *BITMAP_ADDR16(bitmap, y, (i * 8) + bit) = BIT(data, 7) ? 1 : 0; |
| r8453 | r8454 | |
| 394 | 394 | { |
| 395 | 395 | for (column = 0; column < x_count; column++) |
| 396 | 396 | { |
| 397 | UINT8 code = messram_get_ptr(dev | |
| 397 | UINT8 code = messram_get_ptr(dev | |
| 398 | 398 | data = charrom[((code << 4) | (ra & 0x07)) & 0xfff]; |
| 399 | 399 | if (column == cursor_x) |
| 400 | 400 | { |
| r8453 | r8454 | |
| 416 | 416 | { |
| 417 | 417 | for (i = 0; i < x_count; i++) |
| 418 | 418 | { |
| 419 | data = messram_get_ptr(dev | |
| 419 | data = messram_get_ptr(dev | |
| 420 | 420 | for (bit = 0; bit < 8; bit++) |
| 421 | 421 | { |
| 422 | 422 | *BITMAP_ADDR16(bitmap, y, (i * 8) + bit) = BIT(data, 7) ? 1 : 0; |
| r8453 | r8454 | |
| 457 | 457 | |
| 458 | 458 | static DRIVER_INIT(pyl601) |
| 459 | 459 | { |
| 460 | memset(messram_get_ptr( | |
| 460 | memset(messram_get_ptr(m | |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | static INTERRUPT_GEN( pyl601_interrupt ) |
| r8453 | r8454 | |
|---|---|---|
| 305 | 305 | { |
| 306 | 306 | scv_state *state = (scv_state *)space->machine->driver_data; |
| 307 | 307 | |
| 308 | //logerror("%04x: scv_portc_w: data = 0x%02x\n", cpu_get_pc( | |
| 308 | //logerror("%04x: scv_portc_w: data = 0x%02x\n", cpu_get_pc( | |
| 309 | 309 | state->portc = data; |
| 310 | 310 | |
| 311 | 311 | scv_set_banks( space->machine ); |
| 312 | upd1771_pcm_w( | |
| 312 | upd1771_pcm_w( | |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 |
| r8453 | r8454 | |
|---|---|---|
| 41 | 41 | |
| 42 | 42 | static VIDEO_UPDATE( h19 ) |
| 43 | 43 | { |
| 44 | running_device *mc6845 = | |
| 44 | running_device *mc6845 = | |
| 45 | 45 | mc6845_update(mc6845, bitmap, cliprect); |
| 46 | 46 | return 0; |
| 47 | 47 | } |
| r8453 | r8454 | |
|---|---|---|
| 71 | 71 | archimedes_init(machine); |
| 72 | 72 | |
| 73 | 73 | // reset the DAC to centerline |
| 74 | dac_signed_data_w( | |
| 74 | dac_signed_data_w(m | |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | static MACHINE_RESET( a310 ) |
| r8453 | r8454 | |
|---|---|---|
| 340 | 340 | /* %001 */ |
| 341 | 341 | /* ram */ |
| 342 | 342 | case 0x01: |
| 343 | addr = messram_get_ptr( | |
| 343 | addr = messram_get_ptr(m | |
| 344 | 344 | memory_set_bankptr(machine, "bank3", addr); |
| 345 | 345 | memory_set_bankptr(machine, "bank7", addr); |
| 346 | 346 | avigo_banked_opbase[2] = ((UINT8 *) addr) - (2 * 0x4000); |
| r8453 | r8454 | |
| 438 | 438 | avigo_flash_at_0x8000 = 0; |
| 439 | 439 | |
| 440 | 440 | /* clear */ |
| 441 | memset(messram_get_ptr( | |
| 441 | memset(messram_get_ptr(m | |
| 442 | 442 | |
| 443 | 443 | memory_set_direct_update_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), avigo_opbase_handler); |
| 444 | 444 | |
| 445 | 445 | addr = (unsigned char *)intelflash_getmemptr(0); |
| 446 | 446 | avigo_setbank(machine, 0, addr, avigo_flash_0x0000_read_handler, avigo_flash_0x0000_write_handler); |
| 447 | 447 | |
| 448 | avigo_setbank(machine, 3, messram_get_ptr( | |
| 448 | avigo_setbank(machine, 3, messram_get_ptr(m | |
| 449 | 449 | |
| 450 | 450 | /* 0x08000 is specially banked! */ |
| 451 | 451 | avigo_refresh_memory(machine); |
| r8453 | r8454 | |
| 774 | 774 | |
| 775 | 775 | static WRITE8_HANDLER(avigo_speaker_w) |
| 776 | 776 | { |
| 777 | running_device *speaker = | |
| 777 | running_device *speaker = | |
| 778 | 778 | UINT8 previous_speaker; |
| 779 | 779 | |
| 780 | 780 | previous_speaker = avigo_speaker_data; |
| r8453 | r8454 | |
|---|---|---|
| 116 | 116 | |
| 117 | 117 | static WRITE_LINE_DEVICE_HANDLER( lx800_reset_w ) |
| 118 | 118 | { |
| 119 | dev | |
| 119 | dev | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | |
| r8453 | r8454 | |
| 128 | 128 | { |
| 129 | 129 | lx800_state *lx800 = (lx800_state *)machine->driver_data; |
| 130 | 130 | |
| 131 | lx800->speaker = | |
| 131 | lx800->speaker = m | |
| 132 | 132 | |
| 133 | 133 | beep_set_state(lx800->speaker, 0); |
| 134 | 134 | beep_set_frequency(lx800->speaker, 4000); /* ? */ |
| r8453 | r8454 | |
|---|---|---|
| 29 | 29 | |
| 30 | 30 | static MACHINE_RESET(ccs2810) |
| 31 | 31 | { |
| 32 | cpu_set_reg( | |
| 32 | cpu_set_reg(m | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | static VIDEO_START( ccs2810 ) |
| r8453 | r8454 | |
|---|---|---|
| 389 | 389 | { |
| 390 | 390 | e01_state *state = (e01_state *)machine->driver_data; |
| 391 | 391 | |
| 392 | UINT8 *ram = messram_get_ptr( | |
| 392 | UINT8 *ram = messram_get_ptr(m | |
| 393 | 393 | UINT8 *rom = memory_region(machine, R65C102_TAG); |
| 394 | 394 | |
| 395 | 395 | /* setup memory banking */ |
| r8453 | r8454 | |
|---|---|---|
| 126 | 126 | |
| 127 | 127 | static VIDEO_UPDATE( zrt80 ) |
| 128 | 128 | { |
| 129 | running_device *mc6845 = | |
| 129 | running_device *mc6845 = | |
| 130 | 130 | mc6845_update(mc6845, bitmap, cliprect); |
| 131 | 131 | return 0; |
| 132 | 132 | } |
| r8453 | r8454 | |
|---|---|---|
| 568 | 568 | |
| 569 | 569 | static VIDEO_UPDATE( c64 ) |
| 570 | 570 | { |
| 571 | running_device *vic2 = | |
| 571 | running_device *vic2 = | |
| 572 | 572 | |
| 573 | 573 | vic2_video_update(vic2, bitmap, cliprect); |
| 574 | 574 | return 0; |
| r8453 | r8454 | |
|---|---|---|
| 522 | 522 | static MACHINE_RESET(ti68k) |
| 523 | 523 | { |
| 524 | 524 | t68k_state *state = (t68k_state *)machine->driver_data; |
| 525 | cpu_set_reg( | |
| 525 | cpu_set_reg(m | |
| 526 | 526 | |
| 527 | 527 | state->kb_mask = 0xff; |
| 528 | 528 | state->on_key = 0; |
| r8453 | r8454 | |
|---|---|---|
| 56 | 56 | |
| 57 | 57 | static MACHINE_RESET(ipds) |
| 58 | 58 | { |
| 59 | cpu_set_reg( | |
| 59 | cpu_set_reg(m | |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | static VIDEO_UPDATE( ipds ) |
| 63 | 63 | { |
| 64 | running_device *devconf = | |
| 64 | running_device *devconf = | |
| 65 | 65 | i8275_update( devconf, bitmap, cliprect); |
| 66 | 66 | VIDEO_UPDATE_CALL ( generic_bitmapped ); |
| 67 | 67 | return 0; |
| r8453 | r8454 | |
|---|---|---|
| 140 | 140 | { |
| 141 | 141 | xerox820_state *state = (xerox820_state *)machine->driver_data; |
| 142 | 142 | const address_space *program = cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM); |
| 143 | UINT8 *ram = messram_get_ptr( | |
| 143 | UINT8 *ram = messram_get_ptr(m | |
| 144 | 144 | |
| 145 | 145 | if (bank) |
| 146 | 146 | { |
| r8453 | r8454 | |
| 161 | 161 | { |
| 162 | 162 | xerox820_state *state = (xerox820_state *)machine->driver_data; |
| 163 | 163 | const address_space *program = cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM); |
| 164 | UINT8 *ram = messram_get_ptr( | |
| 164 | UINT8 *ram = messram_get_ptr(m | |
| 165 | 165 | |
| 166 | 166 | if (bank) |
| 167 | 167 | { |
| r8453 | r8454 | |
| 582 | 582 | static WRITE_LINE_DEVICE_HANDLER( xerox820_wd1771_intrq_w ) |
| 583 | 583 | { |
| 584 | 584 | xerox820_state *driver_state = (xerox820_state *)device->machine->driver_data; |
| 585 | int halt = cpu_get_reg(dev | |
| 585 | int halt = cpu_get_reg(dev | |
| 586 | 586 | |
| 587 | 587 | driver_state->fdc_irq = state; |
| 588 | 588 | |
| r8453 | r8454 | |
| 595 | 595 | static WRITE_LINE_DEVICE_HANDLER( xerox820_wd1771_drq_w ) |
| 596 | 596 | { |
| 597 | 597 | xerox820_state *driver_state = (xerox820_state *)device->machine->driver_data; |
| 598 | int halt = cpu_get_reg(dev | |
| 598 | int halt = cpu_get_reg(dev | |
| 599 | 599 | |
| 600 | 600 | driver_state->fdc_drq = state; |
| 601 | 601 | |
| r8453 | r8454 | |
| 718 | 718 | xerox820_state *state = (xerox820_state *)machine->driver_data; |
| 719 | 719 | |
| 720 | 720 | /* find devices */ |
| 721 | state->kbpio = devtag_get_device(machine, Z80KBPIO_TAG); | |
| 722 | state->z80ctc = devtag_get_device(machine, Z80CTC_TAG); | |
| 723 | state->wd1771 = devtag_get_device(machine, WD1771_TAG); | |
| 721 | state->kbpio = machine->device(Z80KBPIO_TAG); | |
| 722 | state->z80ctc = machine->device(Z80CTC_TAG); | |
| 723 | state->wd1771 = machine->device(WD1771_TAG); | |
| 724 | 724 | |
| 725 | 725 | for (drive = 0; drive < 2; drive++) |
| 726 | 726 | { |
| r8453 | r8454 | |
|---|---|---|
| 14 | 14 | |
| 15 | 15 | static WRITE8_HANDLER(swtpc_terminal_w) |
| 16 | 16 | { |
| 17 | running_device *devconf = | |
| 17 | running_device *devconf = | |
| 18 | 18 | terminal_write(devconf,0,data); |
| 19 | 19 | } |
| 20 | 20 |
| r8453 | r8454 | |
|---|---|---|
| 187 | 187 | timer ^=1; |
| 188 | 188 | if (timer==1) drum_index++; |
| 189 | 189 | if (drum_index==13) drum_index=0; |
| 190 | i4004_set_test( | |
| 190 | i4004_set_test(m | |
| 191 | 191 | |
| 192 | 192 | } |
| 193 | 193 |
| r8453 | r8454 | |
|---|---|---|
| 403 | 403 | if (read_or_write) |
| 404 | 404 | { |
| 405 | 405 | mame_fwrite(file, state->ram, 0x8000); |
| 406 | mame_fwrite(file, messram_get_ptr( | |
| 406 | mame_fwrite(file, messram_get_ptr(m | |
| 407 | 407 | mc146818_save_stream(file); |
| 408 | 408 | } |
| 409 | 409 | else |
| r8453 | r8454 | |
| 411 | 411 | if (file) |
| 412 | 412 | { |
| 413 | 413 | mame_fread(file, state->ram, 0x8000); |
| 414 | mame_fread(file, messram_get_ptr( | |
| 414 | mame_fread(file, messram_get_ptr(m | |
| 415 | 415 | mc146818_load_stream(file); |
| 416 | 416 | |
| 417 | 417 | /* reload register A and B for restore the periodic irq state */ |
| r8453 | r8454 | |
| 452 | 452 | micronic_state *state = (micronic_state *)machine->driver_data; |
| 453 | 453 | |
| 454 | 454 | /* find devices */ |
| 455 | state->hd61830 = devtag_get_device(machine, HD61830_TAG); | |
| 456 | state->speaker = devtag_get_device(machine, "beep"); | |
| 455 | state->hd61830 = machine->device(HD61830_TAG); | |
| 456 | state->speaker = machine->device("beep"); | |
| 457 | 457 | |
| 458 | 458 | /* ROM banks */ |
| 459 | 459 | memory_configure_bank(machine, "bank1", 0x00, 0x02, memory_region(machine, Z80_TAG), 0x10000); |
| 460 | 460 | |
| 461 | 461 | /* RAM banks */ |
| 462 | memory_configure_bank(machine, "bank1", 0x02, 0x07, messram_get_ptr( | |
| 462 | memory_configure_bank(machine, "bank1", 0x02, 0x07, messram_get_ptr(m | |
| 463 | 463 | |
| 464 | 464 | state->rtc_periodic_irq = timer_alloc(machine, rtc_periodic_irq, 0); |
| 465 | 465 |
| r8453 | r8454 | |
|---|---|---|
| 38 | 38 | va_start( v, s_fmt ); |
| 39 | 39 | vsprintf( buf, s_fmt, v ); |
| 40 | 40 | va_end( v ); |
| 41 | logerror( "%08x: %s", cpu_get_pc( | |
| 41 | logerror( "%08x: %s", cpu_get_pc(m | |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
| r8453 | r8454 | |
| 128 | 128 | return nHPC_MiscStatus; |
| 129 | 129 | case 0x01bc: |
| 130 | 130 | // verboselog(machine, 2, "HPC CPU Serial EEPROM Read\n" ); |
| 131 | return ( ( eeprom_read_bit( | |
| 131 | return ( ( eeprom_read_bit( | |
| 132 | 132 | case 0x01c4: |
| 133 | 133 | verboselog(machine, 2, "HPC Local IO Register 0 Mask Read: %08x (%08x)\n", nHPC_LocalIOReg0Mask, mem_mask ); |
| 134 | 134 | return nHPC_LocalIOReg0Mask; |
| r8453 | r8454 | |
| 148 | 148 | case 0x0d04: |
| 149 | 149 | verboselog(machine, 2, "HPC DUART0 Channel B Data Read\n" ); |
| 150 | 150 | // return 0; |
| 151 | scc = | |
| 151 | scc = | |
| 152 | 152 | return scc8530_r(scc, 2); |
| 153 | 153 | case 0x0d08: |
| 154 | 154 | verboselog(machine, 2, "HPC DUART0 Channel A Control Read (%08x)\n", mem_mask ); |
| r8453 | r8454 | |
| 157 | 157 | case 0x0d0c: |
| 158 | 158 | verboselog(machine, 2, "HPC DUART0 Channel A Data Read\n" ); |
| 159 | 159 | // return 0; |
| 160 | scc = | |
| 160 | scc = | |
| 161 | 161 | return scc8530_r(scc, 3); |
| 162 | 162 | case 0x0d10: |
| 163 | 163 | // verboselog(machine, 2, "HPC DUART1 Channel B Control Read\n" ); |
| r8453 | r8454 | |
| 206 | 206 | running_device *eeprom; |
| 207 | 207 | running_machine *machine = space->machine; |
| 208 | 208 | |
| 209 | eeprom = | |
| 209 | eeprom = | |
| 210 | 210 | offset <<= 2; |
| 211 | 211 | if( offset >= 0x0e00 && offset <= 0x0e7c ) |
| 212 | 212 | { |
| r8453 | r8454 | |
| 341 | 341 | break; |
| 342 | 342 | case 0x0d00: |
| 343 | 343 | verboselog(machine, 2, "HPC DUART0 Channel B Control Write: %08x (%08x)\n", data, mem_mask ); |
| 344 | scc = | |
| 344 | scc = | |
| 345 | 345 | scc8530_w(scc, 0, data); |
| 346 | 346 | break; |
| 347 | 347 | case 0x0d04: |
| 348 | 348 | verboselog(machine, 2, "HPC DUART0 Channel B Data Write: %08x (%08x)\n", data, mem_mask ); |
| 349 | scc = | |
| 349 | scc = | |
| 350 | 350 | scc8530_w(scc, 2, data); |
| 351 | 351 | break; |
| 352 | 352 | case 0x0d08: |
| 353 | 353 | verboselog(machine, 2, "HPC DUART0 Channel A Control Write: %08x (%08x)\n", data, mem_mask ); |
| 354 | scc = | |
| 354 | scc = | |
| 355 | 355 | scc8530_w(scc, 1, data); |
| 356 | 356 | break; |
| 357 | 357 | case 0x0d0c: |
| 358 | 358 | verboselog(machine, 2, "HPC DUART0 Channel A Data Write: %08x (%08x)\n", data, mem_mask ); |
| 359 | scc = | |
| 359 | scc = | |
| 360 | 360 | scc8530_w(scc, 3, data); |
| 361 | 361 | break; |
| 362 | 362 | case 0x0d10: |
| r8453 | r8454 | |
|---|---|---|
| 518 | 518 | const address_space *program = cputag_get_address_space(machine, CDP1802_TAG, ADDRESS_SPACE_PROGRAM); |
| 519 | 519 | |
| 520 | 520 | /* find devices */ |
| 521 | state->dm9368 = devtag_get_device(machine, DM9368_TAG); | |
| 522 | state->cdp1864 = devtag_get_device(machine, CDP1864_TAG); | |
| 523 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); | |
| 524 | state->speaker = devtag_get_device(machine, SPEAKER_TAG); | |
| 521 | state->dm9368 = machine->device(DM9368_TAG); | |
| 522 | state->cdp1864 = machine->device(CDP1864_TAG); | |
| 523 | state->cassette = machine->device(CASSETTE_TAG); | |
| 524 | state->speaker = machine->device(SPEAKER_TAG); | |
| 525 | 525 | |
| 526 | 526 | /* initialize LED display */ |
| 527 | 527 | dm9368_rbi_w(state->dm9368, 1); |
| r8453 | r8454 | |
| 533 | 533 | memory_configure_bank(machine, "bank2", 0, 1, memory_region(machine, CDP1802_TAG) + 0xff00, 0); |
| 534 | 534 | memory_set_bank(machine, "bank2", 0); |
| 535 | 535 | |
| 536 | switch (messram_get_size( | |
| 536 | switch (messram_get_size(m | |
| 537 | 537 | { |
| 538 | 538 | case 256: |
| 539 | 539 | memory_unmap_readwrite(program, 0x0000, 0xbfff, 0, 0); |
| r8453 | r8454 | |
|---|---|---|
| 710 | 710 | |
| 711 | 711 | static INTERRUPT_GEN( bbcb_vsync ) |
| 712 | 712 | { |
| 713 | running_device *via_0 = dev | |
| 713 | running_device *via_0 = dev | |
| 714 | 714 | via_ca1_w(via_0, 1); |
| 715 | 715 | via_ca1_w(via_0, 0); |
| 716 | 716 | bbc_frameclock(); |
| r8453 | r8454 | |
|---|---|---|
| 36 | 36 | va_start( v, s_fmt ); |
| 37 | 37 | vsprintf( buf, s_fmt, v ); |
| 38 | 38 | va_end( v ); |
| 39 | logerror( "%08x: %s", cpu_get_pc( | |
| 39 | logerror( "%08x: %s", cpu_get_pc(m | |
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | |
| r8453 | r8454 | |
| 85 | 85 | // master enable? |
| 86 | 86 | if (state->IME & 1) |
| 87 | 87 | { |
| 88 | cpu_set_input_line(devtag_get_device(machine, "maincpu"), ARM7_IRQ_LINE, ASSERT_LINE); | |
| 89 | cpu_set_input_line(devtag_get_device(machine, "maincpu"), ARM7_IRQ_LINE, CLEAR_LINE); | |
| 88 | cpu_set_input_line(machine->device("maincpu"), ARM7_IRQ_LINE, ASSERT_LINE); | |
| 89 | cpu_set_input_line(machine->device("maincpu"), ARM7_IRQ_LINE, CLEAR_LINE); | |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | } |
| r8453 | r8454 | |
| 141 | 141 | int ctrl; |
| 142 | 142 | int srcadd, dstadd; |
| 143 | 143 | UINT32 src, dst; |
| 144 | const address_space *space = cpu_get_address_space( | |
| 144 | const address_space *space = cpu_get_address_space(m | |
| 145 | 145 | gba_state *state = (gba_state *)machine->driver_data; |
| 146 | 146 | |
| 147 | 147 | src = state->dma_src[ch]; |
| r8453 | r8454 | |
| 291 | 291 | |
| 292 | 292 | if (state->SOUNDCNT_H & 0x200) |
| 293 | 293 | { |
| 294 | running_device *dac_device = | |
| 294 | running_device *dac_device = m | |
| 295 | 295 | |
| 296 | 296 | dac_signed_data_w(dac_device, state->fifo_a[state->fifo_a_ptr]^0x80); |
| 297 | 297 | } |
| 298 | 298 | if (state->SOUNDCNT_H & 0x100) |
| 299 | 299 | { |
| 300 | running_device *dac_device = | |
| 300 | running_device *dac_device = m | |
| 301 | 301 | |
| 302 | 302 | dac_signed_data_w(dac_device, state->fifo_a[state->fifo_a_ptr]^0x80); |
| 303 | 303 | } |
| r8453 | r8454 | |
| 331 | 331 | |
| 332 | 332 | if (state->SOUNDCNT_H & 0x2000) |
| 333 | 333 | { |
| 334 | running_device *dac_device = | |
| 334 | running_device *dac_device = m | |
| 335 | 335 | |
| 336 | 336 | dac_signed_data_w(dac_device, state->fifo_b[state->fifo_b_ptr]^0x80); |
| 337 | 337 | } |
| 338 | 338 | if (state->SOUNDCNT_H & 0x1000) |
| 339 | 339 | { |
| 340 | running_device *dac_device = | |
| 340 | running_device *dac_device = m | |
| 341 | 341 | |
| 342 | 342 | dac_signed_data_w(dac_device, state->fifo_b[state->fifo_b_ptr]^0x80); |
| 343 | 343 | } |
| r8453 | r8454 | |
| 499 | 499 | { |
| 500 | 500 | UINT32 retval = 0; |
| 501 | 501 | running_machine *machine = space->machine; |
| 502 | running_device *gb_device = | |
| 502 | running_device *gb_device = | |
| 503 | 503 | gba_state *state = (gba_state *)machine->driver_data; |
| 504 | 504 | |
| 505 | 505 | switch( offset ) |
| r8453 | r8454 | |
| 1017 | 1017 | static WRITE32_HANDLER( gba_io_w ) |
| 1018 | 1018 | { |
| 1019 | 1019 | running_machine *machine = space->machine; |
| 1020 | running_device *gb_device = | |
| 1020 | running_device *gb_device = | |
| 1021 | 1021 | gba_state *state = (gba_state *)machine->driver_data; |
| 1022 | 1022 | |
| 1023 | 1023 | switch( offset ) |
| r8453 | r8454 | |
| 1417 | 1417 | // DAC A reset? |
| 1418 | 1418 | if (data & 0x0800) |
| 1419 | 1419 | { |
| 1420 | running_device *gb_a_l = devtag_get_device(machine, "direct_a_left"); | |
| 1421 | running_device *gb_a_r = devtag_get_device(machine, "direct_a_right"); | |
| 1420 | running_device *gb_a_l = machine->device("direct_a_left"); | |
| 1421 | running_device *gb_a_r = machine->device("direct_a_right"); | |
| 1422 | 1422 | |
| 1423 | 1423 | state->fifo_a_ptr = 17; |
| 1424 | 1424 | state->fifo_a_in = 17; |
| r8453 | r8454 | |
| 1429 | 1429 | // DAC B reset? |
| 1430 | 1430 | if (data & 0x8000) |
| 1431 | 1431 | { |
| 1432 | running_device *gb_b_l = devtag_get_device(machine, "direct_b_left"); | |
| 1433 | running_device *gb_b_r = devtag_get_device(machine, "direct_b_right"); | |
| 1432 | running_device *gb_b_l = machine->device("direct_b_left"); | |
| 1433 | running_device *gb_b_r = machine->device("direct_b_right"); | |
| 1434 | 1434 | |
| 1435 | 1435 | state->fifo_b_ptr = 17; |
| 1436 | 1436 | state->fifo_b_in = 17; |
| r8453 | r8454 | |
| 1442 | 1442 | case 0x0084/4: |
| 1443 | 1443 | if( (mem_mask) & 0x000000ff ) |
| 1444 | 1444 | { |
| 1445 | running_device *gb_a_l = devtag_get_device(machine, "direct_a_left"); | |
| 1446 | running_device *gb_a_r = devtag_get_device(machine, "direct_a_right"); | |
| 1447 | running_device *gb_b_l = devtag_get_device(machine, "direct_b_left"); | |
| 1448 | running_device *gb_b_r = devtag_get_device(machine, "direct_b_right"); | |
| 1445 | running_device *gb_a_l = machine->device("direct_a_left"); | |
| 1446 | running_device *gb_a_r = machine->device("direct_a_right"); | |
| 1447 | running_device *gb_b_l = machine->device("direct_b_left"); | |
| 1448 | running_device *gb_b_r = machine->device("direct_b_right"); | |
| 1449 | 1449 | |
| 1450 | 1450 | gb_sound_w(gb_device, 0x16, data); |
| 1451 | 1451 | if ((data & 0x80) && !(state->SOUNDCNT_X & 0x80)) |
| r8453 | r8454 | |
| 1822 | 1822 | state->HALTCNT = data & 0x000000ff; |
| 1823 | 1823 | |
| 1824 | 1824 | // either way, wait for an IRQ |
| 1825 | cpu_spinuntil_int( | |
| 1825 | cpu_spinuntil_int(m | |
| 1826 | 1826 | } |
| 1827 | 1827 | } |
| 1828 | 1828 | if( (mem_mask) & 0xffff0000 ) |
| r8453 | r8454 | |
| 2004 | 2004 | |
| 2005 | 2005 | static MACHINE_RESET( gba ) |
| 2006 | 2006 | { |
| 2007 | running_device *gb_a_l = devtag_get_device(machine, "direct_a_left"); | |
| 2008 | running_device *gb_a_r = devtag_get_device(machine, "direct_a_right"); | |
| 2009 | running_device *gb_b_l = devtag_get_device(machine, "direct_b_left"); | |
| 2010 | running_device *gb_b_r = devtag_get_device(machine, "direct_b_right"); | |
| 2007 | running_device *gb_a_l = machine->device("direct_a_left"); | |
| 2008 | running_device *gb_a_r = machine->device("direct_a_right"); | |
| 2009 | running_device *gb_b_l = machine->device("direct_b_left"); | |
| 2010 | running_device *gb_b_r = machine->device("direct_b_right"); | |
| 2011 | 2011 | gba_state *state = (gba_state *)machine->driver_data; |
| 2012 | 2012 | |
| 2013 | 2013 | memset(state, 0, sizeof(state)); |
| r8453 | r8454 | |
| 2273 | 2273 | |
| 2274 | 2274 | if (state->eeprom_bits == 0) |
| 2275 | 2275 | { |
| 2276 | mame_printf_verbose("%08x: EEPROM: %02x to %x\n", cpu_get_pc( | |
| 2276 | mame_printf_verbose("%08x: EEPROM: %02x to %x\n", cpu_get_pc( | |
| 2277 | 2277 | state->gba_eeprom[state->eeprom_addr] = state->eep_data; |
| 2278 | 2278 | state->eeprom_addr++; |
| 2279 | 2279 | state->eep_data = 0; |
| r8453 | r8454 | |
| 2323 | 2323 | |
| 2324 | 2324 | if (cart_size <= (16 * 1024 * 1024)) |
| 2325 | 2325 | { |
| 2326 | memory_install_read32_handler(cpu_get_address_space(devtag_get_device(image.device().machine, "maincpu"), ADDRESS_SPACE_PROGRAM), 0xd000000, 0xdffffff, 0, 0, eeprom_r); | |
| 2327 | memory_install_write32_handler(cpu_get_address_space(devtag_get_device(image.device().machine, "maincpu"), ADDRESS_SPACE_PROGRAM), 0xd000000, 0xdffffff, 0, 0, eeprom_w); | |
| 2326 | memory_install_read32_handler(cpu_get_address_space(image.device().machine->device("maincpu"), ADDRESS_SPACE_PROGRAM), 0xd000000, 0xdffffff, 0, 0, eeprom_r); | |
| 2327 | memory_install_write32_handler(cpu_get_address_space(image.device().machine->device("maincpu"), ADDRESS_SPACE_PROGRAM), 0xd000000, 0xdffffff, 0, 0, eeprom_w); | |
| 2328 | 2328 | } |
| 2329 | 2329 | else |
| 2330 | 2330 | { |
| 2331 | memory_install_read32_handler(cpu_get_address_space(devtag_get_device(image.device().machine, "maincpu"), ADDRESS_SPACE_PROGRAM), 0xdffff00, 0xdffffff, 0, 0, eeprom_r); | |
| 2332 | memory_install_write32_handler(cpu_get_address_space(devtag_get_device(image.device().machine, "maincpu"), ADDRESS_SPACE_PROGRAM), 0xdffff00, 0xdffffff, 0, 0, eeprom_w); | |
| 2331 | memory_install_read32_handler(cpu_get_address_space(image.device().machine->device("maincpu"), ADDRESS_SPACE_PROGRAM), 0xdffff00, 0xdffffff, 0, 0, eeprom_r); | |
| 2332 | memory_install_write32_handler(cpu_get_address_space(image.device().machine->device("maincpu"), ADDRESS_SPACE_PROGRAM), 0xdffff00, 0xdffffff, 0, 0, eeprom_w); | |
| 2333 | 2333 | } |
| 2334 | 2334 | break; |
| 2335 | 2335 | } |
| r8453 | r8454 | |
| 2338 | 2338 | state->nvptr = (UINT8 *)&state->gba_sram; |
| 2339 | 2339 | state->nvsize = 0x10000; |
| 2340 | 2340 | |
| 2341 | memory_install_read32_handler(cpu_get_address_space(devtag_get_device(image.device().machine, "maincpu"), ADDRESS_SPACE_PROGRAM), 0xe000000, 0xe00ffff, 0, 0, sram_r); | |
| 2342 | memory_install_write32_handler(cpu_get_address_space(devtag_get_device(image.device().machine, "maincpu"), ADDRESS_SPACE_PROGRAM), 0xe000000, 0xe00ffff, 0, 0, sram_w); | |
| 2341 | memory_install_read32_handler(cpu_get_address_space(image.device().machine->device("maincpu"), ADDRESS_SPACE_PROGRAM), 0xe000000, 0xe00ffff, 0, 0, sram_r); | |
| 2342 | memory_install_write32_handler(cpu_get_address_space(image.device().machine->device("maincpu"), ADDRESS_SPACE_PROGRAM), 0xe000000, 0xe00ffff, 0, 0, sram_w); | |
| 2343 | 2343 | break; |
| 2344 | 2344 | } |
| 2345 | 2345 | else if (!memcmp(&ROM[i], "FLASH1M_", 8)) |
| r8453 | r8454 | |
| 2349 | 2349 | state->flash_size = 0x20000; |
| 2350 | 2350 | state->flash_mask = 0x1ffff/4; |
| 2351 | 2351 | |
| 2352 | memory_install_read32_handler(cpu_get_address_space(devtag_get_device(image.device().machine, "maincpu"), ADDRESS_SPACE_PROGRAM), 0xe000000, 0xe01ffff, 0, 0, flash_r); | |
| 2353 | memory_install_write32_handler(cpu_get_address_space(devtag_get_device(image.device().machine, "maincpu"), ADDRESS_SPACE_PROGRAM), 0xe000000, 0xe01ffff, 0, 0, flash_w); | |
| 2352 | memory_install_read32_handler(cpu_get_address_space(image.device().machine->device("maincpu"), ADDRESS_SPACE_PROGRAM), 0xe000000, 0xe01ffff, 0, 0, flash_r); | |
| 2353 | memory_install_write32_handler(cpu_get_address_space(image.device().machine->device("maincpu"), ADDRESS_SPACE_PROGRAM), 0xe000000, 0xe01ffff, 0, 0, flash_w); | |
| 2354 | 2354 | break; |
| 2355 | 2355 | } |
| 2356 | 2356 | else if (!memcmp(&ROM[i], "FLASH", 5)) |
| r8453 | r8454 | |
| 2360 | 2360 | state->flash_size = 0x10000; |
| 2361 | 2361 | state->flash_mask = 0xffff/4; |
| 2362 | 2362 | |
| 2363 | memory_install_read32_handler(cpu_get_address_space(devtag_get_device(image.device().machine, "maincpu"), ADDRESS_SPACE_PROGRAM), 0xe000000, 0xe00ffff, 0, 0, flash_r); | |
| 2364 | memory_install_write32_handler(cpu_get_address_space(devtag_get_device(image.device().machine, "maincpu"), ADDRESS_SPACE_PROGRAM), 0xe000000, 0xe00ffff, 0, 0, flash_w); | |
| 2363 | memory_install_read32_handler(cpu_get_address_space(image.device().machine->device("maincpu"), ADDRESS_SPACE_PROGRAM), 0xe000000, 0xe00ffff, 0, 0, flash_r); | |
| 2364 | memory_install_write32_handler(cpu_get_address_space(image.device().machine->device("maincpu"), ADDRESS_SPACE_PROGRAM), 0xe000000, 0xe00ffff, 0, 0, flash_w); | |
| 2365 | 2365 | break; |
| 2366 | 2366 | } |
| 2367 | 2367 | else if (!memcmp(&ROM[i], "SIIRTC_V", 8)) |
| r8453 | r8454 | |
|---|---|---|
| 61 | 61 | case 0x08d: |
| 62 | 62 | case 0x08e: |
| 63 | 63 | case 0x08f: |
| 64 | return kc85_ctc_r( | |
| 64 | return kc85_ctc_r( | |
| 65 | 65 | |
| 66 | 66 | } |
| 67 | 67 | |
| r8453 | r8454 | |
| 105 | 105 | case 0x08d: |
| 106 | 106 | case 0x08e: |
| 107 | 107 | case 0x08f: |
| 108 | kc85_ctc_w( | |
| 108 | kc85_ctc_w( | |
| 109 | 109 | return; |
| 110 | 110 | } |
| 111 | 111 | |
| r8453 | r8454 | |
| 157 | 157 | case 0x08d: |
| 158 | 158 | case 0x08e: |
| 159 | 159 | case 0x08f: |
| 160 | return kc85_ctc_r( | |
| 160 | return kc85_ctc_r( | |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | logerror("unhandled port r: %04x\n",offset); |
| r8453 | r8454 | |
| 190 | 190 | case 0x08d: |
| 191 | 191 | case 0x08e: |
| 192 | 192 | case 0x08f: |
| 193 | kc85_ctc_w( | |
| 193 | kc85_ctc_w( | |
| 194 | 194 | return; |
| 195 | 195 | } |
| 196 | 196 |
| Previous | 15994 Revisions | Next |